DATAGEODE-46 - Refactor API names used in the Annotation config and GemFire Mock Objects support.

This commit is contained in:
John Blum
2017-09-22 21:49:27 -07:00
parent 57ac541dde
commit 52c29de30e
26 changed files with 107 additions and 95 deletions

View File

@@ -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

View File

@@ -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")

View File

@@ -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 {
}

View File

@@ -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")

View File

@@ -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")
})

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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.

View File

@@ -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) {