SGF-673 - Refactor API names used in the Annotation config and GemFire Mock Objects support.
This commit is contained in:
@@ -324,11 +324,11 @@ public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfi
|
||||
* @return the resolved {@link PdxSerializer} from configuration.
|
||||
* @see org.apache.geode.pdx.PdxSerializer
|
||||
* @see #newPdxSerializer(BeanFactory)
|
||||
* @see #beanFactory()
|
||||
* @see #getBeanFactory()
|
||||
*/
|
||||
protected PdxSerializer resolvePdxSerializer(String pdxSerializerBeanName) {
|
||||
|
||||
BeanFactory beanFactory = beanFactory();
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
|
||||
return Optional.ofNullable(pdxSerializerBeanName)
|
||||
.filter(beanFactory::containsBean)
|
||||
@@ -346,7 +346,7 @@ public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfi
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T extends PdxSerializer> T newPdxSerializer() {
|
||||
return newPdxSerializer(beanFactory());
|
||||
return newPdxSerializer(getBeanFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,8 +443,8 @@ public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfi
|
||||
*/
|
||||
protected <T extends CacheFactoryBean> T configureCacheFactoryBean(T gemfireCache) {
|
||||
|
||||
gemfireCache.setBeanClassLoader(beanClassLoader());
|
||||
gemfireCache.setBeanFactory(beanFactory());
|
||||
gemfireCache.setBeanClassLoader(getBeanClassLoader());
|
||||
gemfireCache.setBeanFactory(getBeanFactory());
|
||||
gemfireCache.setCacheXml(getCacheXml());
|
||||
gemfireCache.setClose(isClose());
|
||||
gemfireCache.setCopyOnRead(getCopyOnRead());
|
||||
|
||||
@@ -189,7 +189,7 @@ public class AddCacheServerConfiguration extends AbstractAnnotationConfigSupport
|
||||
return Optional.ofNullable(this.cacheServerConfigurers)
|
||||
.filter(cacheServerConfigurers -> !cacheServerConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
|
||||
@@ -204,7 +204,7 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
||||
return Optional.ofNullable(this.poolConfigurers)
|
||||
.filter(poolConfigurers -> !poolConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ApacheShiroSecurityConfiguration extends AbstractAnnotationConfigSu
|
||||
* @see org.springframework.beans.factory.BeanFactory
|
||||
*/
|
||||
protected ListableBeanFactory getListableBeanFactory() {
|
||||
return (ListableBeanFactory) beanFactory();
|
||||
return (ListableBeanFactory) getBeanFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -146,7 +146,7 @@ public class AutoRegionLookupConfiguration extends AbstractAnnotationConfigSuppo
|
||||
}
|
||||
catch (ParseException ignore) {
|
||||
// try resolving as a Spring property placeholder expression...
|
||||
return environment().getProperty(enabled, Boolean.TYPE, false);
|
||||
return getEnvironment().getProperty(enabled, Boolean.TYPE, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class CacheServerConfiguration extends PeerCacheConfiguration {
|
||||
return Optional.ofNullable(this.cacheServerConfigurers)
|
||||
.filter(cacheServerConfigurers -> !cacheServerConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ClientCacheConfiguration extends AbstractCacheConfiguration {
|
||||
return Optional.ofNullable(this.clientCacheConfigurers)
|
||||
.filter(clientCacheConfigurers -> !clientCacheConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ContinuousQueryConfiguration extends AbstractAnnotationConfigSuppor
|
||||
return Optional.ofNullable(this.configurers)
|
||||
.filter(configurers -> !configurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
@@ -191,7 +191,7 @@ public class ContinuousQueryConfiguration extends AbstractAnnotationConfigSuppor
|
||||
|
||||
return Optional.ofNullable(getErrorHandlerBeanName())
|
||||
.filter(StringUtils::hasText)
|
||||
.map(errorHandlerBeanName -> beanFactory().getBean(errorHandlerBeanName, ErrorHandler.class));
|
||||
.map(errorHandlerBeanName -> getBeanFactory().getBean(errorHandlerBeanName, ErrorHandler.class));
|
||||
}
|
||||
|
||||
protected Optional<Integer> resolvePhase() {
|
||||
@@ -206,7 +206,7 @@ public class ContinuousQueryConfiguration extends AbstractAnnotationConfigSuppor
|
||||
|
||||
return Optional.ofNullable(getTaskExecutorBeanName())
|
||||
.filter(StringUtils::hasText)
|
||||
.map(taskExecutorBeanName -> beanFactory().getBean(taskExecutorBeanName, Executor.class));
|
||||
.map(taskExecutorBeanName -> getBeanFactory().getBean(taskExecutorBeanName, Executor.class));
|
||||
}
|
||||
|
||||
public void setErrorHandlerBeanName(String errorHandlerBeanName) {
|
||||
|
||||
@@ -211,7 +211,7 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
||||
return Optional.ofNullable(this.diskStoreConfigurers)
|
||||
.filter(diskStoreConfigurers -> !diskStoreConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ public class EntityDefinedRegionsConfiguration extends AbstractAnnotationConfigS
|
||||
|
||||
return Optional.ofNullable(this.mappingContext).orElseGet(() -> {
|
||||
try {
|
||||
this.mappingContext = beanFactory().getBean(GemfireMappingContext.class);
|
||||
this.mappingContext = getBeanFactory().getBean(GemfireMappingContext.class);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
this.mappingContext = new GemfireMappingContext();
|
||||
@@ -382,7 +382,7 @@ public class EntityDefinedRegionsConfiguration extends AbstractAnnotationConfigS
|
||||
return Optional.ofNullable(this.regionConfigurers)
|
||||
.filter(regionConfigurers -> !regionConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.ofNullable(beanFactory())
|
||||
Optional.of(getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
|
||||
@@ -276,7 +276,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration {
|
||||
return Optional.ofNullable(this.indexConfigurers)
|
||||
.filter(indexConfigurers -> !indexConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(beanFactory())
|
||||
Optional.of(getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PeerCacheConfiguration extends AbstractCacheConfiguration {
|
||||
return Optional.ofNullable(this.peerCacheConfigurers)
|
||||
.filter(peerCacheConfigurers -> !peerCacheConfigurers.isEmpty())
|
||||
.orElseGet(() ->
|
||||
Optional.of(this.beanFactory())
|
||||
Optional.of(this.getBeanFactory())
|
||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||
.map(beanFactory -> {
|
||||
Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||
|
||||
@@ -148,7 +148,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @return a new {@link EvaluationContext}.
|
||||
* @see org.springframework.beans.factory.BeanFactory
|
||||
* @see org.springframework.expression.EvaluationContext
|
||||
* @see #beanFactory()
|
||||
* @see #getBeanFactory()
|
||||
*/
|
||||
protected EvaluationContext newEvaluationContext(BeanFactory beanFactory) {
|
||||
|
||||
@@ -157,7 +157,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
evaluationContext.addPropertyAccessor(new BeanFactoryAccessor());
|
||||
evaluationContext.addPropertyAccessor(new EnvironmentAccessor());
|
||||
evaluationContext.addPropertyAccessor(new MapAccessor());
|
||||
evaluationContext.setTypeLocator(new StandardTypeLocator(beanClassLoader()));
|
||||
evaluationContext.setTypeLocator(new StandardTypeLocator(getBeanClassLoader()));
|
||||
|
||||
configureTypeConverter(evaluationContext, beanFactory);
|
||||
|
||||
@@ -265,7 +265,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @return the {@link ClassLoader} used by the Spring {@link BeanFactory} to load classes for bean definitions.
|
||||
* @see #setBeanClassLoader(ClassLoader)
|
||||
*/
|
||||
protected ClassLoader beanClassLoader() {
|
||||
protected ClassLoader getBeanClassLoader() {
|
||||
return this.beanClassLoader;
|
||||
}
|
||||
|
||||
@@ -276,10 +276,10 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @return the configured {@link ClassLoader} or the
|
||||
* {@link Thread#getContextClassLoader() Thread Context ClassLoader}.
|
||||
* @see java.lang.Thread#getContextClassLoader()
|
||||
* @see #beanClassLoader()
|
||||
* @see #getBeanClassLoader()
|
||||
*/
|
||||
protected ClassLoader resolveBeanClassLoader() {
|
||||
return Optional.ofNullable(beanClassLoader()).orElseGet(() -> Thread.currentThread().getContextClassLoader());
|
||||
return Optional.ofNullable(getBeanClassLoader()).orElseGet(() -> Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,7 +288,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
configureTypeConverter(evaluationContext(), beanFactory);
|
||||
configureTypeConverter(getEvaluationContext(), beanFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +298,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @throws IllegalStateException if the Spring {@link BeanFactory} was not properly configured.
|
||||
* @see org.springframework.beans.factory.BeanFactory
|
||||
*/
|
||||
protected BeanFactory beanFactory() {
|
||||
protected BeanFactory getBeanFactory() {
|
||||
return Optional.ofNullable(this.beanFactory)
|
||||
.orElseThrow(() -> newIllegalStateException("BeanFactory is required"));
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @return a reference to the Spring {@link Environment}.
|
||||
* @see org.springframework.core.env.Environment
|
||||
*/
|
||||
protected Environment environment() {
|
||||
protected Environment getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @return a reference to the {@link EvaluationContext} used to evaluate SpEL expressions.
|
||||
* @see org.springframework.expression.EvaluationContext
|
||||
*/
|
||||
protected EvaluationContext evaluationContext() {
|
||||
protected EvaluationContext getEvaluationContext() {
|
||||
return this.evaluationContext;
|
||||
}
|
||||
|
||||
@@ -454,11 +454,11 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @see org.springframework.beans.factory.support.AbstractBeanDefinition
|
||||
* @see org.springframework.beans.factory.support.BeanDefinitionRegistry
|
||||
* @see org.springframework.beans.factory.support.BeanDefinitionReaderUtils#registerWithGeneratedName(AbstractBeanDefinition, BeanDefinitionRegistry)
|
||||
* @see #beanFactory()
|
||||
* @see #getBeanFactory()
|
||||
*/
|
||||
protected AbstractBeanDefinition register(AbstractBeanDefinition beanDefinition) {
|
||||
|
||||
BeanFactory beanFactory = beanFactory();
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
|
||||
return (beanFactory instanceof BeanDefinitionRegistry
|
||||
? register(beanDefinition, (BeanDefinitionRegistry) beanFactory)
|
||||
@@ -500,7 +500,7 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
|
||||
String propertyName = asArrayProperty(propertyNamePrefix, index, propertyNameSuffix);
|
||||
|
||||
found = environment().containsProperty(propertyName);
|
||||
found = getEnvironment().containsProperty(propertyName);
|
||||
|
||||
if (found) {
|
||||
propertyNames.add(propertyName);
|
||||
@@ -766,11 +766,11 @@ public abstract class AbstractAnnotationConfigSupport
|
||||
* @param defaultValue default value to return if the property is not defined or not set.
|
||||
* @return the value of the property identified by {@link String name} or default value if the property
|
||||
* is not defined or not set.
|
||||
* @see #environment()
|
||||
* @see #getEnvironment()
|
||||
*/
|
||||
protected <T> T resolveProperty(String propertyName, Class<T> targetType, T defaultValue) {
|
||||
|
||||
return Optional.ofNullable(environment())
|
||||
return Optional.ofNullable(getEnvironment())
|
||||
.filter(environment -> environment.containsProperty(propertyName))
|
||||
.map(environment -> environment.getProperty(environment.resolveRequiredPlaceholders(propertyName),
|
||||
targetType, defaultValue))
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class EmbeddedServiceConfigurationSupport extends AbstractAnnota
|
||||
* @see org.springframework.data.gemfire.config.annotation.AbstractCacheConfiguration
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T extends AbstractCacheConfiguration> T cacheConfiguration() {
|
||||
protected <T extends AbstractCacheConfiguration> T getCacheConfiguration() {
|
||||
return Optional.ofNullable((T) this.cacheConfiguration)
|
||||
.orElseThrow(() -> newIllegalStateException("AbstractCacheConfiguration is required"));
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public abstract class EmbeddedServiceConfigurationSupport extends AbstractAnnota
|
||||
|
||||
if (hasProperties(gemfireProperties)) {
|
||||
try {
|
||||
cacheConfiguration().add(gemfireProperties);
|
||||
getCacheConfiguration().add(gemfireProperties);
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
registerGemFirePropertiesBeanPostProcessor(registry, gemfireProperties);
|
||||
@@ -179,15 +179,17 @@ public abstract class EmbeddedServiceConfigurationSupport extends AbstractAnnota
|
||||
* @return a Spring managed bean instance for the given, required {@link Class} type, or {@literal null}
|
||||
* if no bean instance of the given, required {@link Class} type could be found.
|
||||
* @throws BeansException if the Spring manage bean of the required {@link Class} type could not be resolved.
|
||||
* @see #beanFactory()
|
||||
* @see #getBeanFactory()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T> T resolveBean(Class<T> beanType) {
|
||||
|
||||
BeanFactory beanFactory = beanFactory();
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
|
||||
if (beanFactory instanceof AutowireCapableBeanFactory) {
|
||||
|
||||
AutowireCapableBeanFactory autowiringBeanFactory = (AutowireCapableBeanFactory) beanFactory;
|
||||
|
||||
NamedBeanHolder<T> beanHolder = autowiringBeanFactory.resolveNamedBean(beanType);
|
||||
|
||||
return (T) autowiringBeanFactory.configureBean(beanHolder.getBeanInstance(), beanHolder.getBeanName());
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking
|
||||
* @see EnableGemFireMockObjects
|
||||
*/
|
||||
public class ClientCacheIntegrationTests {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ClientCacheIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
static class ClosingClientCacheConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -123,7 +123,7 @@ public class ClientCacheIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
static class CloseSuppressingClientCacheConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -138,7 +138,7 @@ public class ClientCacheIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableGemFireMocking(useSingletonCache = true)
|
||||
@EnableGemFireMockObjects(useSingletonCache = true)
|
||||
static class MultiClientCacheConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ClientRegionIntegrationTests {
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
static class ClientRegionConfiguration {
|
||||
|
||||
@Bean("Example")
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.server.SubscriptionEvictionPolicy;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
|
||||
* @see org.springframework.data.gemfire.server.SubscriptionEvictionPolicy
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class CacheServerPropertiesIntegrationTests {
|
||||
@@ -193,7 +193,7 @@ public class CacheServerPropertiesIntegrationTests {
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableCacheServer(name = "TestCacheServer", bindAddress = "192.16.0.22", hostnameForClients = "skullbox",
|
||||
maxConnections = 100, maxThreads = 8, messageTimeToLive = 300, port = 11235, subscriptionCapacity = 100,
|
||||
subscriptionEvictionPolicy = SubscriptionEvictionPolicy.ENTRY)
|
||||
@@ -211,7 +211,7 @@ public class CacheServerPropertiesIntegrationTests {
|
||||
}
|
||||
|
||||
@CacheServerApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableCacheServer(name = "TestCacheServer")
|
||||
static class TestCacheServersConfiguration {
|
||||
}
|
||||
|
||||
@@ -35,14 +35,16 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* The ClientCachePropertiesIntegrationTests class...
|
||||
* Integration tests for {@link ClientCacheApplication}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class ClientCachePropertiesIntegrationTests {
|
||||
|
||||
@@ -237,7 +239,7 @@ public class ClientCachePropertiesIntegrationTests {
|
||||
|
||||
// TODO add more tests!
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnablePdx(ignoreUnreadFields = true, readSerialized = true, serializerBeanName = "mockPdxSerializer")
|
||||
@ClientCacheApplication(name = "TestClientCache", copyOnRead = true,
|
||||
criticalHeapPercentage = 95.0f, evictionHeapPercentage = 80.0f, idleTimeout = 15000L,
|
||||
@@ -263,7 +265,7 @@ public class ClientCachePropertiesIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnablePdx(serializerBeanName = "mockPdxSerializer")
|
||||
@ClientCacheApplication(name = "TestClientCache")
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -29,14 +29,16 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* The DiskStorePropertiesIntegrationTests class...
|
||||
* Integration tests for {@link EnableDiskStore}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStore
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class DiskStorePropertiesIntegrationTests {
|
||||
|
||||
@@ -155,7 +157,7 @@ public class DiskStorePropertiesIntegrationTests {
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableDiskStore(name = "TestDiskStore", allowForceCompaction = true, compactionThreshold = 65,
|
||||
diskUsageCriticalPercentage = 95.0f, diskUsageWarningPercentage = 75.0f, maxOplogSize = 2048L)
|
||||
@SuppressWarnings("unused")
|
||||
@@ -172,7 +174,7 @@ public class DiskStorePropertiesIntegrationTests {
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableDiskStores(diskStores = {
|
||||
@EnableDiskStore(name = "TestDiskStoreOne"), @EnableDiskStore(name = "TestDiskStoreTwo")
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Integration test for {@link EnableBeanFactoryLocator} and {@link BeanFactoryLocatorConfiguration}.
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockin
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.BeanFactoryLocatorConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableBeanFactoryLocator
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class EnableBeanFactoryLocatorConfigurationIntegrationTests {
|
||||
@@ -82,12 +82,12 @@ public class EnableBeanFactoryLocatorConfigurationIntegrationTests {
|
||||
assertThat(gemfireCache.isUseBeanFactoryLocator()).isTrue();
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
static class TestBeanFactoryLocatorDisabledConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableBeanFactoryLocator
|
||||
@PeerCacheApplication
|
||||
static class TestBeanFactoryLocatorEnabledConfiguration {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.junit.Test;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link EnableDiskStore} and {@link EnableDiskStores} annotations as well as
|
||||
@@ -44,6 +44,7 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockin
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStores
|
||||
* @see org.springframework.data.gemfire.config.annotation.DiskStoreConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.DiskStoresConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class EnableDiskStoresConfigurationUnitTests {
|
||||
@@ -166,7 +167,7 @@ public class EnableDiskStoresConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableDiskStore(name = "TestDiskStore", allowForceCompaction = true, autoCompact = true, compactionThreshold = 75,
|
||||
diskUsageCriticalPercentage = 95.0f, diskUsageWarningPercentage = 75.0f, maxOplogSize = 8192L, queueSize = 100,
|
||||
timeInterval = 2000L, writeBufferSize = 65536, diskDirectories = {
|
||||
@@ -178,7 +179,7 @@ public class EnableDiskStoresConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnableDiskStores(autoCompact = true, compactionThreshold = 75, maxOplogSize = 2048L, diskStores = {
|
||||
@EnableDiskStore(name = "TestDiskStoreOne", queueSize = 100),
|
||||
@EnableDiskStore(name = "TestDiskStoreTwo", allowForceCompaction = true,
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class EnableGemFirePropertiesIntegrationTests {
|
||||
@@ -551,70 +551,70 @@ public class EnableGemFirePropertiesIntegrationTests {
|
||||
assertThat(gemfireProperties.getProperty("statistic-sample-rate")).isEqualTo("100");
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableAuth
|
||||
@EnableGemFireProperties
|
||||
static class TestAuthGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableHttpService
|
||||
static class TestHttpGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableLocator
|
||||
static class TestLocatorGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableLogging
|
||||
static class TestLoggingGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableManager
|
||||
static class TestManagerGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableMemcachedServer
|
||||
static class TestMemcachedServerGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableOffHeap(memorySize = "64g")
|
||||
static class TestOffHeapGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableRedisServer
|
||||
static class TestRedisServerGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableSecurity
|
||||
static class TestSecurityGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableSsl(components = { EnableSsl.Component.CLUSTER, EnableSsl.Component.GATEWAY, EnableSsl.Component.HTTP,
|
||||
@@ -622,7 +622,7 @@ public class EnableGemFirePropertiesIntegrationTests {
|
||||
static class TestSslGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableSsl(components = { EnableSsl.Component.GATEWAY, EnableSsl.Component.JMX, EnableSsl.Component.LOCATOR,
|
||||
@@ -630,7 +630,7 @@ public class EnableGemFirePropertiesIntegrationTests {
|
||||
static class TestInheritedSslGemFirePropertiesConfiguration {
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication
|
||||
@EnableGemFireProperties
|
||||
@EnableStatistics
|
||||
|
||||
@@ -33,14 +33,16 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* The PeerCachePropertiesIntegrationTests class...
|
||||
* Integration tests for {@link PeerCacheApplication}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class PeerCachePropertiesIntegrationTests {
|
||||
|
||||
@@ -161,7 +163,7 @@ public class PeerCachePropertiesIntegrationTests {
|
||||
|
||||
//TODO add more tests
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@EnablePdx(ignoreUnreadFields = true, readSerialized = true, serializerBeanName = "mockPdxSerializer")
|
||||
@PeerCacheApplication(name = "TestPeerCache", criticalHeapPercentage = 90.0f, evictionHeapPercentage = 75.0f,
|
||||
lockLease = 300, lockTimeout = 120)
|
||||
@@ -179,7 +181,7 @@ public class PeerCachePropertiesIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@PeerCacheApplication(name = "TestPeerCache")
|
||||
@SuppressWarnings("unused")
|
||||
static class TestDynamicPeerCacheConfiguration {
|
||||
|
||||
@@ -31,14 +31,17 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMocking;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* The PoolPropertiesIntegrationTests class...
|
||||
* Integration tests for {@link EnablePool} and {@link EnablePools}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePool
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePools
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class PoolPropertiesIntegrationTests {
|
||||
|
||||
@@ -237,7 +240,7 @@ public class PoolPropertiesIntegrationTests {
|
||||
300000, 4, true);
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@ClientCacheApplication
|
||||
@EnablePool(name = "TestPool", idleTimeout = 10000L, maxConnections = 200, minConnections = 20)
|
||||
static class TestPoolConfiguration {
|
||||
@@ -251,7 +254,7 @@ public class PoolPropertiesIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableGemFireMocking
|
||||
@EnableGemFireMockObjects
|
||||
@ClientCacheApplication
|
||||
@EnablePools(pools = { @EnablePool(name = "TestPoolOne"), @EnablePool(name = "TestPoolTwo") })
|
||||
static class TestPoolsConfiguration {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.apache.geode.cache.GemFireCache;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* The {@link EnableGemFireMocking} annotation enables mocking of GemFire Objects in Unit Tests.
|
||||
* The {@link EnableGemFireMockObjects} annotation enables mocking of GemFire Objects in Unit Tests.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.lang.annotation.Documented
|
||||
@@ -42,9 +42,9 @@ import org.springframework.context.annotation.Import;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
@Import(GemFireMockingConfiguration.class)
|
||||
@Import(GemFireMockObjectsConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public @interface EnableGemFireMocking {
|
||||
public @interface EnableGemFireMockObjects {
|
||||
|
||||
/**
|
||||
* Determines whether the mock {@link GemFireCache} created for Unit Tests is a Singleton.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.data.gemfire.test.mock.MockGemFireObjectsSupport;
|
||||
import org.springframework.data.gemfire.test.mock.config.MockGemFireObjectsBeanPostProcessor;
|
||||
|
||||
/**
|
||||
* The {@link GemFireMockingConfiguration} class is a Spring {@link Configuration @Configuration} class
|
||||
* The {@link GemFireMockObjectsConfiguration} class is a Spring {@link Configuration @Configuration} class
|
||||
* containing bean definitions to configure GemFire Object mocking.
|
||||
*
|
||||
* @author John Blum
|
||||
@@ -46,7 +46,7 @@ import org.springframework.data.gemfire.test.mock.config.MockGemFireObjectsBeanP
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Configuration
|
||||
public class GemFireMockingConfiguration implements ImportAware {
|
||||
public class GemFireMockObjectsConfiguration implements ImportAware {
|
||||
|
||||
private boolean useSingletonCache = false;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GemFireMockingConfiguration implements ImportAware {
|
||||
}
|
||||
|
||||
private Class<? extends Annotation> getAnnotationType() {
|
||||
return EnableGemFireMocking.class;
|
||||
return EnableGemFireMockObjects.class;
|
||||
}
|
||||
|
||||
private boolean isAnnotationPresent(AnnotationMetadata importingClassMetadata) {
|
||||
Reference in New Issue
Block a user