Rename spring-boot-data-gemfire module to spring-boot-starter-data-gemfire.
Rename spring-boot-data-geode module to spring-boot-starter-data-geode.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
apply plugin: 'io.spring.convention.spring-module'
|
||||
|
||||
apply from: IDE_GRADLE
|
||||
|
||||
description = "Spring Boot for Apache Geode"
|
||||
|
||||
dependencies {
|
||||
|
||||
compile "org.springframework:spring-context-support"
|
||||
compile "org.springframework:spring-jcl"
|
||||
compile "org.springframework.data:spring-data-geode:$springDataGeodeVersion"
|
||||
|
||||
compile("org.springframework.boot:spring-boot-starter") {
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging";
|
||||
}
|
||||
|
||||
testCompile "org.assertj:assertj-core"
|
||||
testCompile "junit:junit"
|
||||
testCompile "org.mockito:mockito-core"
|
||||
testCompile "edu.umd.cs.mtc:multithreadedtc"
|
||||
|
||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging";
|
||||
}
|
||||
|
||||
testCompile slf4jDependencies
|
||||
|
||||
// integrationTestRuntime "org.springframework.shell:spring-shell"
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
|
||||
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalStateException;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers;
|
||||
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.cache.GemfireCacheManager;
|
||||
import org.springframework.data.gemfire.cache.config.EnableGemfireCaching;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
|
||||
/**
|
||||
* Cache auto-configuration for Spring's Cache Abstraction, using Apache Geode as the caching provider.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.cache.GemfireCacheManager
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean({ CacheFactoryBean.class, Cache.class, ClientCacheFactoryBean.class, ClientCache.class })
|
||||
@ConditionalOnClass(GemfireCacheManager.class)
|
||||
@ConditionalOnMissingBean(CacheManager.class)
|
||||
@EnableGemfireCaching
|
||||
@SuppressWarnings("all")
|
||||
class GeodeCachingProviderAutoConfiguration {
|
||||
|
||||
private final CacheManagerCustomizers cacheManagerCustomizers;
|
||||
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private GemfireCacheManager cacheManager;
|
||||
|
||||
GeodeCachingProviderAutoConfiguration(CacheProperties cacheProperties, CacheManagerCustomizers cacheManagerCustomizers) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.cacheManagerCustomizers = cacheManagerCustomizers;
|
||||
}
|
||||
|
||||
GemfireCacheManager getCacheManager() {
|
||||
return Optional.ofNullable(this.cacheManager)
|
||||
.orElseThrow(() -> newIllegalStateException("GemfireCacheManager was not properly configured"));
|
||||
}
|
||||
|
||||
Optional<CacheManagerCustomizers> getCacheManagerCustomizers() {
|
||||
return Optional.ofNullable(this.cacheManagerCustomizers);
|
||||
}
|
||||
|
||||
Optional<CacheProperties> getCacheProperties() {
|
||||
return Optional.ofNullable(this.cacheProperties);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void onGeodeCachingInitialization() {
|
||||
getCacheManagerCustomizers()
|
||||
.ifPresent(cacheManagerCustomizers -> cacheManagerCustomizers.customize(getCacheManager()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
|
||||
/**
|
||||
* Spring Boot {@link EnableAutoConfiguration auto-configuration} for bootstrapping an Apache Geode {@link ClientCache}
|
||||
* instance constructed, configured and initialized with Spring Data for Apache Geode.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ ClientCacheFactoryBean.class, ClientCache.class })
|
||||
@ConditionalOnMissingBean(ClientCache.class)
|
||||
@ClientCacheApplication
|
||||
@SuppressWarnings("all")
|
||||
public class GeodeClientCacheAutoConfiguration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableContinuousQueries;
|
||||
|
||||
/**
|
||||
* Spring Boot {@link EnableAutoConfiguration auto-configuration} enabling Apache Geode's Continuous Query (CQ)
|
||||
* functionality in an Spring Boot, Apache Geode {@link ClientCache} application.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableContinuousQueries
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(ClientCache.class)
|
||||
@ConditionalOnClass({ ClientCacheFactoryBean.class, ClientCache.class })
|
||||
@ConditionalOnMissingBean(name = "continuousQueryBeanPostProcessor", value = Cache.class)
|
||||
@EnableContinuousQueries
|
||||
public class GeodeContinuousQueryAutoConfiguration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.function.config.EnableGemfireFunctionExecutions;
|
||||
|
||||
/**
|
||||
* Spring Boot {@link EnableAutoConfiguration auto-configuration} enabling Apache Geode's Function Execution
|
||||
* functionality in a Spring Boot, Apache Geode {@link ClientCache} application.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(ClientCache.class)
|
||||
@ConditionalOnClass({ ClientCacheFactoryBean.class, ClientCache.class })
|
||||
@EnableGemfireFunctionExecutions
|
||||
@SuppressWarnings("unused")
|
||||
public class GeodeFunctionExecutionAutoConfiguration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.gemfire.repository.GemfireRepository;
|
||||
import org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
|
||||
/**
|
||||
* Spring Boot {@link EnableAutoConfiguration auto-configuration} for Spring Data's Geode Repositories.
|
||||
*
|
||||
* Activates when there is a bean of type {@link Cache} or {@link ClientCache} configured in the Spring context,
|
||||
* the Spring Data Geode {@link org.springframework.data.gemfire.repository.GemfireRepository} type is on the classpath,
|
||||
* and there is no other existing {@link org.springframework.data.gemfire.repository.GemfireRepository} configured.
|
||||
*
|
||||
* Once in effect, the auto-configuration is the equivalent of enabling Geode Repositories using the
|
||||
* {@link org.springframework.data.gemfire.repository.config.EnableGemfireRepositories} annotation.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.boot.data.geode.autoconfigure.GeodeRepositoriesAutoConfigurationRegistrar
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository
|
||||
* @see org.springframework.data.gemfire.repository.config.EnableGemfireRepositories
|
||||
* @see org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension
|
||||
* @see org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean({ Cache.class, ClientCache.class })
|
||||
@ConditionalOnClass(GemfireRepository.class)
|
||||
@ConditionalOnMissingBean({ GemfireRepositoryConfigurationExtension.class, GemfireRepositoryFactoryBean.class })
|
||||
@ConditionalOnProperty(prefix = "spring.data.geode.repositories",
|
||||
name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@Import(GeodeRepositoriesAutoConfigurationRegistrar.class)
|
||||
public class GeodeRepositoriesAutoConfiguration {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.data.gemfire.repository.config.EnableGemfireRepositories;
|
||||
import org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension;
|
||||
import org.springframework.data.repository.config.RepositoryConfigurationExtension;
|
||||
|
||||
/**
|
||||
* Spring {@link ImportBeanDefinitionRegistrar} used to auto-configure Spring Data Geode Repositories.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport
|
||||
* @see org.springframework.boot.data.geode.autoconfigure.GeodeRepositoriesAutoConfiguration
|
||||
* @see org.springframework.data.gemfire.repository.config.EnableGemfireRepositories
|
||||
* @see org.springframework.data.gemfire.repository.config.GemfireRepositoryConfigurationExtension
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class GeodeRepositoriesAutoConfigurationRegistrar
|
||||
extends AbstractRepositoryConfigurationSourceSupport {
|
||||
|
||||
@Override
|
||||
protected Class<? extends Annotation> getAnnotation() {
|
||||
return EnableGemfireRepositories.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getConfiguration() {
|
||||
return EnableGeodeRepositoriesConfiguration.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RepositoryConfigurationExtension getRepositoryConfigurationExtension() {
|
||||
return new GemfireRepositoryConfigurationExtension();
|
||||
}
|
||||
|
||||
@EnableGemfireRepositories
|
||||
private static class EnableGeodeRepositoriesConfiguration {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Spring Boot auto-configuration for Spring Data Geode.
|
||||
*/
|
||||
package org.springframework.boot.data.geode.autoconfigure;
|
||||
@@ -0,0 +1,7 @@
|
||||
# Auto Configuration
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
org.springframework.boot.data.geode.autoconfigure.GeodeClientCacheAutoConfiguration,\
|
||||
org.springframework.boot.data.geode.autoconfigure.GeodeCachingProviderAutoConfiguration,\
|
||||
org.springframework.boot.data.geode.autoconfigure.GeodeContinuousQueryAutoConfiguration,\
|
||||
org.springframework.boot.data.geode.autoconfigure.GeodeFunctionExecutionAutoConfiguration,\
|
||||
org.springframework.boot.data.geode.autoconfigure.GeodeRepositoriesAutoConfiguration
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.data.geode.cache.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.util.RegionUtils;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration test testing the auto-configuration of an Apache Geode {@link ClientCache} instance.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.boot.test.context.SpringBootTest
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@SuppressWarnings("unused")
|
||||
public class SpringBootApacheGeodeCacheClientApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
|
||||
@Test
|
||||
public void clientCacheAndClientRegionAreAvailable() {
|
||||
|
||||
assertThat(this.clientCache).isNotNull();
|
||||
|
||||
Region<Object, Object> example = this.clientCache.getRegion("Example");
|
||||
|
||||
assertThat(example).isNotNull();
|
||||
assertThat(example.getName()).isEqualTo("Example");
|
||||
assertThat(example.getFullPath()).isEqualTo(RegionUtils.toRegionPath("Example"));
|
||||
|
||||
example.put(1, "test");
|
||||
|
||||
assertThat(example.get(1)).isEqualTo("test");
|
||||
}
|
||||
|
||||
@SpringBootApplication
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean("Example")
|
||||
public ClientRegionFactoryBean<Object, Object> exampleRegion(GemFireCache gemfireCache) {
|
||||
|
||||
ClientRegionFactoryBean<Object, Object> clientRegion = new ClientRegionFactoryBean<>();
|
||||
|
||||
clientRegion.setCache(gemfireCache);
|
||||
clientRegion.setClose(false);
|
||||
clientRegion.setShortcut(ClientRegionShortcut.LOCAL);
|
||||
|
||||
return clientRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user