From f904f6ad867db497a0353ed83d1dbf8ecfd82335 Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 25 Apr 2016 21:36:20 -0700 Subject: [PATCH] SGF-490 - Re-instate GemFire WAN and CQ functionality. --- build.gradle | 4 +- pom.xml | 12 ++- .../data/gemfire/GemfireUtils.java | 17 ++-- .../LookupRegionMutationIntegrationTest.java | 14 ++- ...creatingSpringApplicationContextTest.java} | 38 ++++---- .../data/gemfire/SubRegionTest.java | 8 +- .../gemfire/config/CacheNamespaceTest.java | 4 - ...usQueryListenerContainerNamespaceTest.java | 6 -- ...GatewayReceiverAutoStartNamespaceTest.java | 6 -- ...ewayReceiverDefaultStartNamespaceTest.java | 6 -- ...tewayReceiverManualStartNamespaceTest.java | 6 -- .../config/GemfireV7GatewayNamespaceTest.java | 71 +++++++------- .../config/GemfireV8GatewayNamespaceTest.java | 5 - .../SubRegionSubElementNamespaceTest.java | 6 -- .../config/TemplateRegionsNamespaceTests.java | 13 +-- .../listener/ListenerContainerTests.java | 9 -- .../adapter/ContainerXmlSetupTest.java | 6 -- ...tQueueAndGatewaySenderIntegrationTest.java | 5 - ...alGatewayReceiverStartIntegrationTest.java | 6 -- ...pRegionMutationIntegrationTest-context.xml | 94 ++++++------------- ...ListenerContainerNamespaceTest-context.xml | 4 +- .../TemplateRegionsNamespaceTests-context.xml | 86 ++++++----------- .../data/gemfire/config/cache-ns.xml | 12 +-- .../gemfire/config/subregionsubelement-ns.xml | 12 +-- 24 files changed, 168 insertions(+), 282 deletions(-) rename src/test/java/org/springframework/data/gemfire/{RecreatingContextTest.java => RecreatingSpringApplicationContextTest.java} (55%) diff --git a/build.gradle b/build.gradle index 702dd9b9..c021aab7 100644 --- a/build.gradle +++ b/build.gradle @@ -86,7 +86,7 @@ dependencies { exclude group: "com.fasterxml.jackson.core", module: "jackson-core" exclude group: "com.fasterxml.jackson.core", module: "jackson-databind" exclude group: "org.apache.hbase", module: "hbase" - exclude group: "org.apache.logging.log4j", module: "slf4j-log4j12-impl" + exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl" exclude group: "org.slf4j", module: "slf4j-api" exclude group: "org.springframework", module: "spring-aop" exclude group: "org.springframework", module: "spring-beans" @@ -100,6 +100,8 @@ dependencies { exclude group: "org.springframework.data", module: "spring-data-commons" exclude group: "org.springframework.shell", module: "spring-shell" } + compile("org.apache.geode:geode-cq:$gemfireVersion") + compile("org.apache.geode:geode-wan:$gemfireVersion") optional("com.google.code.findbugs:annotations:2.0.2") runtime("antlr:antlr:$antlrVersion") diff --git a/pom.xml b/pom.xml index 21c98924..56c218f1 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.logging.log4j - slf4j-log4j12-impl + log4j-slf4j-impl org.codehaus.jackson @@ -165,6 +165,16 @@ + + org.apache.geode + geode-cq + ${gemfire.version} + + + org.apache.geode + geode-wan + ${gemfire.version} + antlr diff --git a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java index 4ae83dd0..215a7282 100644 --- a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java +++ b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java @@ -43,10 +43,14 @@ public abstract class GemfireUtils extends CacheUtils { public final static String GEMFIRE_NAME = GemFireVersion.getProductName(); public final static String GEMFIRE_VERSION = CacheFactory.getVersion(); - // TODO use a more reliable means of determining implementing class for GemFire features such as Java's SPI support + private static final String ASYNC_EVENT_QUEUE_ELEMENT_NAME = "async-event-queue"; private static final String ASYNC_EVENT_QUEUE_TYPE_NAME = "com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue"; + private static final String CQ_ELEMENT_NAME = "cq-listener-container"; private static final String CQ_TYPE_NAME = "com.gemstone.gemfire.cache.query.internal.cq.CqServiceFactoryImpl"; - private static final String GATEWAY_TYPE_NAME = "com.gemstone.gemfire.internal.cache.wan.GatewaySenderFactoryImpl"; + private static final String GATEWAY_RECEIVER_ELEMENT_NAME = "gateway-receiver"; + private static final String GATEWAY_RECEIVER_TYPE_NAME = "com.gemstone.gemfire.internal.cache.wan.GatewayReceiverFactoryImpl"; + private static final String GATEWAY_SENDER_ELEMENT_NAME = "gateway-sender"; + private static final String GATEWAY_SENDER_TYPE_NAME = "com.gemstone.gemfire.internal.cache.wan.GatewaySenderFactoryImpl"; /* (non-Javadoc) */ public static boolean isClassAvailable(String fullyQualifiedClassName) { @@ -81,7 +85,7 @@ public abstract class GemfireUtils extends CacheUtils { /* (non-Javadoc) */ private static boolean isAsyncEventQueue(Element element) { - return "async-event-queue".equals(element.getLocalName()); + return ASYNC_EVENT_QUEUE_ELEMENT_NAME.equals(element.getLocalName()); } /* (non-Javadoc) */ @@ -91,7 +95,7 @@ public abstract class GemfireUtils extends CacheUtils { /* (non-Javadoc) */ private static boolean isContinuousQuery(Element element) { - return "cq-listener-container".equals(element.getLocalName()); + return CQ_ELEMENT_NAME.equals(element.getLocalName()); } /* (non-Javadoc) */ @@ -102,12 +106,13 @@ public abstract class GemfireUtils extends CacheUtils { /* (non-Javadoc) */ private static boolean isGateway(Element element) { String elementLocalName = element.getLocalName(); - return ("gateway-receiver".equals(elementLocalName) || "gateway-sender".equals(elementLocalName)); + return (GATEWAY_RECEIVER_ELEMENT_NAME.equals(elementLocalName) + || GATEWAY_SENDER_ELEMENT_NAME.equals(elementLocalName)); } /* (non-Javadoc) */ private static boolean isGatewayAvailable() { - return isClassAvailable(GATEWAY_TYPE_NAME); + return isClassAvailable(GATEWAY_SENDER_TYPE_NAME); } /* (non-Javadoc) */ diff --git a/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java index 3fafc869..94fb58bf 100644 --- a/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java +++ b/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java @@ -23,13 +23,13 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.List; import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.BeanNameAware; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.StringUtils; @@ -98,12 +98,10 @@ public class LookupRegionMutationIntegrationTest { } protected void assertGatewaySenders(Region region, List expectedGatewaySenderIds) { - if (GemfireProfileValueSource.isPivotalGemFire()) { - assertNotNull(region.getAttributes()); - assertNotNull(region.getAttributes().getGatewaySenderIds()); - assertEquals(expectedGatewaySenderIds.size(), region.getAttributes().getGatewaySenderIds().size()); - assertTrue(expectedGatewaySenderIds.containsAll(region.getAttributes().getGatewaySenderIds())); - } + assertNotNull(region.getAttributes()); + assertNotNull(region.getAttributes().getGatewaySenderIds()); + assertEquals(expectedGatewaySenderIds.size(), region.getAttributes().getGatewaySenderIds().size()); + assertTrue(expectedGatewaySenderIds.containsAll(region.getAttributes().getGatewaySenderIds())); } protected void assertGemFireComponent(Object gemfireComponent, String expectedName) { @@ -156,7 +154,7 @@ public class LookupRegionMutationIntegrationTest { assertNotNull(example.getAttributes().getAsyncEventQueueIds()); assertEquals(1, example.getAttributes().getAsyncEventQueueIds().size()); assertEquals("AEQ", example.getAttributes().getAsyncEventQueueIds().iterator().next()); - assertGatewaySenders(example, Arrays.asList("GWS")); + assertGatewaySenders(example, Collections.singletonList("GWS")); } protected interface Nameable extends BeanNameAware { diff --git a/src/test/java/org/springframework/data/gemfire/RecreatingContextTest.java b/src/test/java/org/springframework/data/gemfire/RecreatingSpringApplicationContextTest.java similarity index 55% rename from src/test/java/org/springframework/data/gemfire/RecreatingContextTest.java rename to src/test/java/org/springframework/data/gemfire/RecreatingSpringApplicationContextTest.java index 04f8c0d4..0233b4e0 100644 --- a/src/test/java/org/springframework/data/gemfire/RecreatingContextTest.java +++ b/src/test/java/org/springframework/data/gemfire/RecreatingSpringApplicationContextTest.java @@ -18,35 +18,39 @@ package org.springframework.data.gemfire; import org.junit.After; import org.junit.Before; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericXmlApplicationContext; /** - * Simple testing class that creates the app context after each method. + * The RecreatingSpringApplicationContextTest class is an abstract base class that creates the app context after each method. * Used to properly destroy the beans defined inside Spring. * * @author Costin Leau + * @author John Blum */ -public abstract class RecreatingContextTest { +public abstract class RecreatingSpringApplicationContextTest { - protected GenericXmlApplicationContext ctx; - - protected abstract String location(); - - protected void configureContext(){ - } + protected GenericXmlApplicationContext applicationContext; @Before - public void createCtx() { - ctx = new GenericXmlApplicationContext(); - configureContext(); - ctx.load(location()); - ctx.registerShutdownHook(); - ctx.refresh(); + public void createContext() { + applicationContext = configureContext(new GenericXmlApplicationContext()); + applicationContext.load(location()); + applicationContext.registerShutdownHook(); + applicationContext.refresh(); + } + + protected abstract String location(); + + protected T configureContext(T context){ + return context; } @After - public void destroyCtx() { - if (ctx != null) - ctx.destroy(); + public void destroyContext() { + if (applicationContext != null) { + applicationContext.destroy(); + } } + } diff --git a/src/test/java/org/springframework/data/gemfire/SubRegionTest.java b/src/test/java/org/springframework/data/gemfire/SubRegionTest.java index 8e224610..69a1dab0 100644 --- a/src/test/java/org/springframework/data/gemfire/SubRegionTest.java +++ b/src/test/java/org/springframework/data/gemfire/SubRegionTest.java @@ -29,7 +29,7 @@ import com.gemstone.gemfire.cache.Region; * @author David Turanski * @author John Blum */ -public class SubRegionTest extends RecreatingContextTest { +public class SubRegionTest extends RecreatingSpringApplicationContextTest { @Override protected String location() { return "org/springframework/data/gemfire/basic-subregion.xml"; @@ -84,8 +84,8 @@ public class SubRegionTest extends RecreatingContextTest { @SuppressWarnings("rawtypes") private void testContext() throws Exception { - Region parent = ctx.getBean("parent", Region.class); - Region child = ctx.getBean("/parent/child", Region.class); + Region parent = applicationContext.getBean("parent", Region.class); + Region child = applicationContext.getBean("/parent/child", Region.class); assertNotNull(parent.getSubregion("child")); assertSame(child, parent.getSubregion("child")); assertEquals("/parent/child", child.getFullPath()); @@ -93,7 +93,7 @@ public class SubRegionTest extends RecreatingContextTest { @SuppressWarnings("rawtypes") public void testChildOnly() throws Exception { - Region child = ctx.getBean("/parent/child", Region.class); + Region child = applicationContext.getBean("/parent/child", Region.class); assertEquals("/parent/child", child.getFullPath()); } } diff --git a/src/test/java/org/springframework/data/gemfire/config/CacheNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/CacheNamespaceTest.java index 50f6f60a..eb3fef18 100644 --- a/src/test/java/org/springframework/data/gemfire/config/CacheNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/CacheNamespaceTest.java @@ -37,7 +37,6 @@ import org.springframework.data.gemfire.GemfireBeanFactoryLocator; import org.springframework.data.gemfire.TestUtils; import org.springframework.data.gemfire.client.ClientCacheFactoryBean; import org.springframework.data.gemfire.test.GemfireProfileValueSource; -import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -53,7 +52,6 @@ import com.gemstone.gemfire.cache.util.TimestampedEntryEvent; * @author John Blum */ @RunWith(SpringJUnit4ClassRunner.class) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ContextConfiguration(locations = "cache-ns.xml") @SuppressWarnings("unused") public class CacheNamespaceTest{ @@ -124,8 +122,6 @@ public class CacheNamespaceTest{ } @Test - @IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) public void testCacheWithGatewayConflictResolver() { Cache cache = context.getBean("cache-with-gateway-conflict-resolver", Cache.class); diff --git a/src/test/java/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest.java index 9b46942d..d9e6e07a 100644 --- a/src/test/java/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest.java @@ -39,9 +39,6 @@ import org.springframework.data.gemfire.listener.ContinuousQueryListener; import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer; import org.springframework.data.gemfire.listener.GemfireMDP; import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.util.ErrorHandler; @@ -68,9 +65,6 @@ import com.gemstone.gemfire.cache.query.CqQuery; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @SuppressWarnings("unused") public class ContinuousQueryListenerContainerNamespaceTest { diff --git a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverAutoStartNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverAutoStartNamespaceTest.java index 4593af96..5b072576 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverAutoStartNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverAutoStartNamespaceTest.java @@ -24,11 +24,8 @@ import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; import org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -55,9 +52,6 @@ import com.gemstone.gemfire.cache.wan.GatewayReceiver; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "GatewayReceiverNamespaceTest-context.xml", initializers = GemfireTestApplicationContextInitializer.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ActiveProfiles("autoStart") @SuppressWarnings("unused") public class GatewayReceiverAutoStartNamespaceTest { diff --git a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverDefaultStartNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverDefaultStartNamespaceTest.java index 98da64ef..1be48e47 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverDefaultStartNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverDefaultStartNamespaceTest.java @@ -24,11 +24,8 @@ import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; import org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -55,9 +52,6 @@ import com.gemstone.gemfire.cache.wan.GatewayReceiver; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "GatewayReceiverNamespaceTest-context.xml", initializers = GemfireTestApplicationContextInitializer.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ActiveProfiles("defaultStart") @SuppressWarnings("unused") public class GatewayReceiverDefaultStartNamespaceTest { diff --git a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverManualStartNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverManualStartNamespaceTest.java index a535a60e..6c455f8f 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverManualStartNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GatewayReceiverManualStartNamespaceTest.java @@ -24,11 +24,8 @@ import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; import org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -54,9 +51,6 @@ import com.gemstone.gemfire.cache.wan.GatewayReceiver; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "GatewayReceiverNamespaceTest-context.xml", initializers = GemfireTestApplicationContextInitializer.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ActiveProfiles("manualStart") @SuppressWarnings("unused") public class GatewayReceiverManualStartNamespaceTest { diff --git a/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java index ace3d5b6..f9a920c4 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java @@ -29,16 +29,12 @@ import java.util.List; import org.junit.AfterClass; import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.data.gemfire.RecreatingContextTest; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.data.gemfire.RecreatingSpringApplicationContextTest; import org.springframework.data.gemfire.RegionFactoryBean; import org.springframework.data.gemfire.TestUtils; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor; import org.springframework.data.gemfire.wan.GatewaySenderFactoryBean; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.gemstone.gemfire.cache.Region; import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent; @@ -52,33 +48,21 @@ import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy; import com.gemstone.gemfire.cache.wan.GatewayTransportFilter; /** - * This test is only valid for GF 7.0 and above + * The GemfireV7GatewayNamespaceTest class is a test suite of test cases testing the GemFire 7.0 WAN functionality + * by configuring various Gateway senders and receivers. * * @author David Turanski * @author John Blum + * @see org.springframework.data.gemfire.RecreatingSpringApplicationContextTest + * @see com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue + * @see com.gemstone.gemfire.cache.wan.GatewayReceiver + * @see com.gemstone.gemfire.cache.wan.GatewaySender */ -@RunWith(SpringJUnit4ClassRunner.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @SuppressWarnings("unused") -public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { - - /* - * (non-Javadoc) - * @see org.springframework.data.gemfire.RecreatingContextTest#location() - */ - @Override - protected String location() { - return "/org/springframework/data/gemfire/config/gateway-v7-ns.xml"; - } - - @Override - protected void configureContext() { - ctx.getBeanFactory().addBeanPostProcessor(new GemfireTestBeanPostProcessor()); - } +public class GemfireV7GatewayNamespaceTest extends RecreatingSpringApplicationContextTest { @AfterClass + @SuppressWarnings("all") public static void tearDown() { for (String name : new File(".").list(new FilenameFilter() { @Override @@ -90,9 +74,28 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { } } + /* + * (non-Javadoc) + * @see org.springframework.data.gemfire.RecreatingSpringApplicationContextTest#configureContext(ConfigurableApplicationContext) + */ + @Override + protected T configureContext(final T context) { + context.getBeanFactory().addBeanPostProcessor(new GemfireTestBeanPostProcessor()); + return context; + } + + /* + * (non-Javadoc) + * @see org.springframework.data.gemfire.RecreatingSpringApplicationContextTest#location() + */ + @Override + protected String location() { + return "/org/springframework/data/gemfire/config/gateway-v7-ns.xml"; + } + @Test public void testAsyncEventQueue() { - AsyncEventQueue asyncEventQueue = ctx.getBean("async-event-queue", AsyncEventQueue.class); + AsyncEventQueue asyncEventQueue = applicationContext.getBean("async-event-queue", AsyncEventQueue.class); assertNotNull(asyncEventQueue); assertTrue(asyncEventQueue.isBatchConflationEnabled()); @@ -108,7 +111,7 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { @Test public void testGatewaySender() throws Exception { - GatewaySenderFactoryBean gatewaySenderFactoryBean = ctx.getBean("&gateway-sender", GatewaySenderFactoryBean.class); + GatewaySenderFactoryBean gatewaySenderFactoryBean = applicationContext.getBean("&gateway-sender", GatewaySenderFactoryBean.class); assertNotNull(gatewaySenderFactoryBean); assertNotNull(TestUtils.readField("cache", gatewaySenderFactoryBean)); @@ -136,12 +139,12 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { @Test @SuppressWarnings("rawtypes") public void testInnerGatewaySender() throws Exception { - Region region = ctx.getBean("region-inner-gateway-sender", Region.class); + Region region = applicationContext.getBean("region-inner-gateway-sender", Region.class); assertNotNull(region.getAttributes().getGatewaySenderIds()); assertEquals(2, region.getAttributes().getGatewaySenderIds().size()); - RegionFactoryBean regionFactoryBean = ctx.getBean("®ion-inner-gateway-sender", RegionFactoryBean.class); + RegionFactoryBean regionFactoryBean = applicationContext.getBean("®ion-inner-gateway-sender", RegionFactoryBean.class); Object[] gatewaySenders = TestUtils.readField("gatewaySenders", regionFactoryBean); @@ -183,7 +186,7 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { @Test public void testGatewaySenderWithEventTransportFilterRefs() throws Exception { - GatewaySenderFactoryBean gatewaySenderFactoryBean = ctx.getBean("&gateway-sender-with-event-transport-filter-refs", + GatewaySenderFactoryBean gatewaySenderFactoryBean = applicationContext.getBean("&gateway-sender-with-event-transport-filter-refs", GatewaySenderFactoryBean.class); assertNotNull(gatewaySenderFactoryBean); @@ -199,19 +202,19 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest { assertNotNull(eventFilters); assertEquals(1, eventFilters.size()); assertTrue(eventFilters.get(0) instanceof TestEventFilter); - assertSame(ctx.getBean("event-filter"), eventFilters.get(0)); + assertSame(applicationContext.getBean("event-filter"), eventFilters.get(0)); List transportFilters = TestUtils.readField("transportFilters", gatewaySenderFactoryBean); assertNotNull(transportFilters); assertEquals(1, transportFilters.size()); assertTrue(transportFilters.get(0) instanceof TestTransportFilter); - assertSame(ctx.getBean("transport-filter"), transportFilters.get(0)); + assertSame(applicationContext.getBean("transport-filter"), transportFilters.get(0)); } @Test public void testGatewayReceiver() { - GatewayReceiver gatewayReceiver = ctx.getBean("gateway-receiver", GatewayReceiver.class); + GatewayReceiver gatewayReceiver = applicationContext.getBean("gateway-receiver", GatewayReceiver.class); assertNotNull(gatewayReceiver); assertEquals("192.168.0.1", gatewayReceiver.getBindAddress()); diff --git a/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java index c1964921..304231ad 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java @@ -25,10 +25,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -53,8 +50,6 @@ import com.gemstone.gemfire.cache.wan.GatewaySender; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "gateway-v8-ns.xml", initializers = GemfireTestApplicationContextInitializer.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @SuppressWarnings("unused") public class GemfireV8GatewayNamespaceTest { diff --git a/src/test/java/org/springframework/data/gemfire/config/SubRegionSubElementNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/SubRegionSubElementNamespaceTest.java index b6c978d9..f2033ad5 100644 --- a/src/test/java/org/springframework/data/gemfire/config/SubRegionSubElementNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/SubRegionSubElementNamespaceTest.java @@ -26,10 +26,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -55,7 +52,6 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter; * @since 1.3.3 */ @RunWith(SpringJUnit4ClassRunner.class) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ContextConfiguration(locations = "subregionsubelement-ns.xml", initializers = GemfireTestApplicationContextInitializer.class) @SuppressWarnings("unused") @@ -87,8 +83,6 @@ public class SubRegionSubElementNamespaceTest { } @Test - @IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) public void testOrderItemsSubRegionGatewaySender() { Region orderItemsRegion = applicationContext.getBean("/Orders/Items", Region.class); diff --git a/src/test/java/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests.java b/src/test/java/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests.java index bfde037c..54727cc1 100644 --- a/src/test/java/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests.java @@ -35,7 +35,6 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanIsAbstractException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -182,13 +181,11 @@ public class TemplateRegionsNamespaceTests { } protected void assertGatewaySenders(final Region region, final String... gatewaySenderIds) { - if (GemfireProfileValueSource.isPivotalGemFire()) { - assertNotNull(region); - assertNotNull(region.getAttributes()); - assertNotNull(region.getAttributes().getGatewaySenderIds()); - assertEquals(gatewaySenderIds.length, region.getAttributes().getGatewaySenderIds().size()); - assertTrue(Arrays.asList(gatewaySenderIds).containsAll(region.getAttributes().getGatewaySenderIds())); - } + assertNotNull(region); + assertNotNull(region.getAttributes()); + assertNotNull(region.getAttributes().getGatewaySenderIds()); + assertEquals(gatewaySenderIds.length, region.getAttributes().getGatewaySenderIds().size()); + assertTrue(Arrays.asList(gatewaySenderIds).containsAll(region.getAttributes().getGatewaySenderIds())); } protected void assertDefaultMembershipAttributes(final MembershipAttributes membershipAttributes) { diff --git a/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java b/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java index 8455eab5..d24f1deb 100644 --- a/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java +++ b/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java @@ -24,13 +24,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.data.gemfire.ForkUtil; import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.gemstone.gemfire.cache.RegionService; import com.gemstone.gemfire.cache.client.ClientCacheFactory; @@ -40,10 +35,6 @@ import com.gemstone.gemfire.cache.query.CqEvent; /** * @author Costin Leau */ -@RunWith(SpringJUnit4ClassRunner.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) public class ListenerContainerTests { private final List bag = new ArrayList(); diff --git a/src/test/java/org/springframework/data/gemfire/listener/adapter/ContainerXmlSetupTest.java b/src/test/java/org/springframework/data/gemfire/listener/adapter/ContainerXmlSetupTest.java index 3bd7cdbe..560350d0 100644 --- a/src/test/java/org/springframework/data/gemfire/listener/adapter/ContainerXmlSetupTest.java +++ b/src/test/java/org/springframework/data/gemfire/listener/adapter/ContainerXmlSetupTest.java @@ -29,9 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.data.gemfire.ForkUtil; import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -44,9 +41,6 @@ import com.gemstone.gemfire.cache.query.CqQuery; * @author John Blum */ @RunWith(SpringJUnit4ClassRunner.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @ContextConfiguration("/org/springframework/data/gemfire/listener/container.xml") @SuppressWarnings("unused") public class ContainerXmlSetupTest { diff --git a/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java index b861e77d..a4b4cb08 100644 --- a/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java +++ b/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java @@ -27,9 +27,6 @@ import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -56,8 +53,6 @@ import com.gemstone.gemfire.cache.wan.GatewaySender; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @SuppressWarnings("unused") public class CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest { diff --git a/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java index 9f972490..c9206e5c 100644 --- a/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java +++ b/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java @@ -26,10 +26,7 @@ import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.data.gemfire.test.GemfireProfileValueSource; import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.annotation.ProfileValueSourceConfiguration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -49,9 +46,6 @@ import com.gemstone.gemfire.cache.wan.GatewayReceiver; */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(initializers = GemfireTestApplicationContextInitializer.class) -@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, - value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) -@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) @SuppressWarnings("unused") public class ManualGatewayReceiverStartIntegrationTest { diff --git a/src/test/resources/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest-context.xml b/src/test/resources/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest-context.xml index b815113e..d1d61c85 100644 --- a/src/test/resources/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest-context.xml +++ b/src/test/resources/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest-context.xml @@ -20,69 +20,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest-context.xml b/src/test/resources/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest-context.xml index 973f70f2..c225e87f 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest-context.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/ContinuousQueryListenerContainerNamespaceTest-context.xml @@ -11,11 +11,11 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd "> - + warning - + diff --git a/src/test/resources/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests-context.xml b/src/test/resources/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests-context.xml index 77785f68..11502f21 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests-context.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/TemplateRegionsNamespaceTests-context.xml @@ -102,65 +102,35 @@ - - + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/test/resources/org/springframework/data/gemfire/config/cache-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/cache-ns.xml index 640cf81e..71248924 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/cache-ns.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/cache-ns.xml @@ -39,12 +39,10 @@ - - - - - - - + + + + + diff --git a/src/test/resources/org/springframework/data/gemfire/config/subregionsubelement-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/subregionsubelement-ns.xml index 21172970..926cf659 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/subregionsubelement-ns.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/subregionsubelement-ns.xml @@ -36,13 +36,11 @@ - - - - - + + + - +