diff --git a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java index 39b818c8..76bb9379 100644 --- a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java +++ b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java @@ -121,7 +121,7 @@ public abstract class GemfireUtils { } public static void main(final String... args) { - System.out.printf("GemFire Version %1$s%n", GEMFIRE_VERSION); + System.out.printf("GemFire Product Name (%1$s) Version (%2$s)%n", GEMFIRE_NAME, GEMFIRE_VERSION); //System.out.printf("Is GemFire Version 6.5 of Above? %1$s%n", isGemfireVersion65OrAbove()); //System.out.printf("Is GemFire Version 7.0 of Above? %1$s%n", isGemfireVersion7OrAbove()); } 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 706e43db..96a5b308 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GemfireV7GatewayNamespaceTest.java @@ -30,12 +30,17 @@ import java.util.List; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.data.gemfire.GemfireUtils; import org.springframework.data.gemfire.RecreatingContextTest; 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; @@ -54,6 +59,9 @@ import com.gemstone.gemfire.cache.wan.GatewayTransportFilter; * @author David Turanski * @author John Blum */ +@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 { 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 304231ad..c1964921 100644 --- a/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/GemfireV8GatewayNamespaceTest.java @@ -25,7 +25,10 @@ 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; @@ -50,6 +53,8 @@ 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/listener/ListenerContainerTests.java b/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java index 1fbbc10c..a4714e01 100644 --- a/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java +++ b/src/test/java/org/springframework/data/gemfire/listener/ListenerContainerTests.java @@ -24,8 +24,13 @@ 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; @@ -35,6 +40,9 @@ 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(); @@ -100,4 +108,4 @@ public class ListenerContainerTests { System.out.println("Bag is " + bag); ForkUtil.sendSignal(); } -} \ No newline at end of file +} 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 02583be2..0b9a764c 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 @@ -24,9 +24,14 @@ import static org.junit.Assert.assertTrue; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.context.support.GenericXmlApplicationContext; 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.junit4.SpringJUnit4ClassRunner; import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.client.Pool; @@ -36,6 +41,9 @@ import com.gemstone.gemfire.cache.query.CqQuery; * @author Costin Leau * @author John Blum */ +@RunWith(SpringJUnit4ClassRunner.class) +@IfProfileValue(name = GemfireProfileValueSource.PRODUCT_NAME_KEY, value = GemfireProfileValueSource.PIVOTAL_GEMFIRE_PRODUCT_NAME) +@ProfileValueSourceConfiguration(GemfireProfileValueSource.class) public class ContainerXmlSetupTest { @BeforeClass diff --git a/src/test/java/org/springframework/data/gemfire/test/GemfireProfileValueSource.java b/src/test/java/org/springframework/data/gemfire/test/GemfireProfileValueSource.java new file mode 100644 index 00000000..fefa8b8e --- /dev/null +++ b/src/test/java/org/springframework/data/gemfire/test/GemfireProfileValueSource.java @@ -0,0 +1,51 @@ +/* + * Copyright 2010-2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.data.gemfire.test; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.springframework.data.gemfire.GemfireUtils; +import org.springframework.test.annotation.ProfileValueSource; + +/** + * The GemfireProfileValueSource class is a custom Spring test framework ProfileValueSource used to determine + * profile and environment specific configuration for test enablement. + * + * @author John Blum + * @see org.springframework.test.annotation.ProfileValueSource + * @since 1.7.0 + */ +@SuppressWarnings("unused") +public class GemfireProfileValueSource implements ProfileValueSource { + + public static final String APACHE_GEODE_PRODUCT_NAME = "Apache Geode"; + public static final String PIVOTAL_GEMFIRE_PRODUCT_NAME = "Pivotal GemFire"; + public static final String PRODUCT_NAME_KEY = "product.name"; + + private static final Map PROFILE_VALUES = new ConcurrentHashMap(); + + static { + PROFILE_VALUES.put(PRODUCT_NAME_KEY, GemfireUtils.GEMFIRE_NAME); + } + + @Override + public String get(final String key) { + return PROFILE_VALUES.get(key); + } + +} 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 a4b4cb08..b861e77d 100644 --- a/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java +++ b/src/test/java/org/springframework/data/gemfire/wan/CachePartitionRegionWithConcurrentParallelAsyncEventQueueAndGatewaySenderIntegrationTest.java @@ -27,6 +27,9 @@ 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; @@ -53,6 +56,8 @@ 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 c9206e5c..fb5a5fc3 100644 --- a/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java +++ b/src/test/java/org/springframework/data/gemfire/wan/ManualGatewayReceiverStartIntegrationTest.java @@ -26,7 +26,10 @@ 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; @@ -46,6 +49,8 @@ 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 {