diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/AbstractCacheConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/AbstractCacheConfiguration.java index 70192e2c..b2e35b64 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/AbstractCacheConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/AbstractCacheConfiguration.java @@ -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 newPdxSerializer() { - return newPdxSerializer(beanFactory()); + return newPdxSerializer(getBeanFactory()); } /** @@ -443,8 +443,8 @@ public abstract class AbstractCacheConfiguration extends AbstractAnnotationConfi */ protected 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()); diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/AddCacheServerConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/AddCacheServerConfiguration.java index caea56e1..5892f206 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/AddCacheServerConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/AddCacheServerConfiguration.java @@ -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 beansOfType = ((ListableBeanFactory) beanFactory) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/AddPoolConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/AddPoolConfiguration.java index 41644a3b..4b31ff1c 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/AddPoolConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/AddPoolConfiguration.java @@ -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 beansOfType = ((ListableBeanFactory) beanFactory) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/ApacheShiroSecurityConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/ApacheShiroSecurityConfiguration.java index 51140d8b..9c34855a 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/ApacheShiroSecurityConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/ApacheShiroSecurityConfiguration.java @@ -117,7 +117,7 @@ public class ApacheShiroSecurityConfiguration extends AbstractAnnotationConfigSu * @see org.springframework.beans.factory.BeanFactory */ protected ListableBeanFactory getListableBeanFactory() { - return (ListableBeanFactory) beanFactory(); + return (ListableBeanFactory) getBeanFactory(); } /** diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/AutoRegionLookupConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/AutoRegionLookupConfiguration.java index 176b1aec..6b3a6f77 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/AutoRegionLookupConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/AutoRegionLookupConfiguration.java @@ -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); } } diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/CacheServerConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/CacheServerConfiguration.java index 83c1b16d..902c1efc 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/CacheServerConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/CacheServerConfiguration.java @@ -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 -> { diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.java index 26a69238..88c10ebd 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/ClientCacheConfiguration.java @@ -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 -> { diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/ContinuousQueryConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/ContinuousQueryConfiguration.java index 9753c5c3..fc2a15ef 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/ContinuousQueryConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/ContinuousQueryConfiguration.java @@ -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 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) { diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfiguration.java index cb41d346..1479b77a 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/DiskStoreConfiguration.java @@ -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 -> { diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/EntityDefinedRegionsConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/EntityDefinedRegionsConfiguration.java index 58b845a5..696f4224 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/EntityDefinedRegionsConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/EntityDefinedRegionsConfiguration.java @@ -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 beansOfType = ((ListableBeanFactory) beanFactory) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java index 6697f447..56820b58 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java @@ -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 beansOfType = ((ListableBeanFactory) beanFactory) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/PeerCacheConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/PeerCacheConfiguration.java index a1e767b8..9403e5f7 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/PeerCacheConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/PeerCacheConfiguration.java @@ -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 beansOfType = ((ListableBeanFactory) beanFactory) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/support/AbstractAnnotationConfigSupport.java b/src/main/java/org/springframework/data/gemfire/config/annotation/support/AbstractAnnotationConfigSupport.java index c55214c6..b786926f 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/support/AbstractAnnotationConfigSupport.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/support/AbstractAnnotationConfigSupport.java @@ -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 resolveProperty(String propertyName, Class 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)) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/support/EmbeddedServiceConfigurationSupport.java b/src/main/java/org/springframework/data/gemfire/config/annotation/support/EmbeddedServiceConfigurationSupport.java index 4730508f..6e5120a9 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/support/EmbeddedServiceConfigurationSupport.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/support/EmbeddedServiceConfigurationSupport.java @@ -78,7 +78,7 @@ public abstract class EmbeddedServiceConfigurationSupport extends AbstractAnnota * @see org.springframework.data.gemfire.config.annotation.AbstractCacheConfiguration */ @SuppressWarnings("unchecked") - protected T cacheConfiguration() { + protected 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 resolveBean(Class beanType) { - BeanFactory beanFactory = beanFactory(); + BeanFactory beanFactory = getBeanFactory(); if (beanFactory instanceof AutowireCapableBeanFactory) { + AutowireCapableBeanFactory autowiringBeanFactory = (AutowireCapableBeanFactory) beanFactory; + NamedBeanHolder beanHolder = autowiringBeanFactory.resolveNamedBean(beanType); return (T) autowiringBeanFactory.configureBean(beanHolder.getBeanInstance(), beanHolder.getBeanName()); diff --git a/src/test/java/org/springframework/data/gemfire/client/ClientCacheIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/client/ClientCacheIntegrationTests.java index 2d65b63f..70c5190a 100644 --- a/src/test/java/org/springframework/data/gemfire/client/ClientCacheIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/client/ClientCacheIntegrationTests.java @@ -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 diff --git a/src/test/java/org/springframework/data/gemfire/client/ClientRegionIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/client/ClientRegionIntegrationTests.java index 734ce568..819e0024 100644 --- a/src/test/java/org/springframework/data/gemfire/client/ClientRegionIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/client/ClientRegionIntegrationTests.java @@ -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") diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/CacheServerPropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/CacheServerPropertiesIntegrationTests.java index ef518121..1906891e 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/CacheServerPropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/CacheServerPropertiesIntegrationTests.java @@ -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 { } diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/ClientCachePropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/ClientCachePropertiesIntegrationTests.java index f1300bde..9538a1b8 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/ClientCachePropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/ClientCachePropertiesIntegrationTests.java @@ -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") diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java index b5a5ea7f..bc7aa4d5 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/DiskStorePropertiesIntegrationTests.java @@ -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") }) diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableBeanFactoryLocatorConfigurationIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableBeanFactoryLocatorConfigurationIntegrationTests.java index f8314560..86c0484b 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableBeanFactoryLocatorConfigurationIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableBeanFactoryLocatorConfigurationIntegrationTests.java @@ -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 { diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java index a860df6b..37670ab5 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableDiskStoresConfigurationUnitTests.java @@ -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, diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableGemFirePropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableGemFirePropertiesIntegrationTests.java index 7c48c46d..200e2734 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableGemFirePropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableGemFirePropertiesIntegrationTests.java @@ -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 diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/PeerCachePropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/PeerCachePropertiesIntegrationTests.java index dd936c35..69986ca9 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/PeerCachePropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/PeerCachePropertiesIntegrationTests.java @@ -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 { diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/PoolPropertiesIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/PoolPropertiesIntegrationTests.java index 77703625..653906f9 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/PoolPropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/PoolPropertiesIntegrationTests.java @@ -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 { diff --git a/src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMocking.java b/src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMockObjects.java similarity index 90% rename from src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMocking.java rename to src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMockObjects.java index 80f70bb8..98857831 100644 --- a/src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMocking.java +++ b/src/test/java/org/springframework/data/gemfire/test/mock/annotation/EnableGemFireMockObjects.java @@ -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. diff --git a/src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockingConfiguration.java b/src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockObjectsConfiguration.java similarity index 94% rename from src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockingConfiguration.java rename to src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockObjectsConfiguration.java index 78d4e798..0ee47127 100644 --- a/src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockingConfiguration.java +++ b/src/test/java/org/springframework/data/gemfire/test/mock/annotation/GemFireMockObjectsConfiguration.java @@ -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 getAnnotationType() { - return EnableGemFireMocking.class; + return EnableGemFireMockObjects.class; } private boolean isAnnotationPresent(AnnotationMetadata importingClassMetadata) {