SGF-398 - Provide early support of Apache Geode (Pivotal GemFire OSS).
First iteration of SDG's test suite ran with Apache Geode; Implemented Spring test framework, profile support to enable/disable tests based on the presence of either Apache Geode or Pivotal GemFire.
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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<CqEvent> bag = new ArrayList<CqEvent>();
|
||||
@@ -100,4 +108,4 @@ public class ListenerContainerTests {
|
||||
System.out.println("Bag is " + bag);
|
||||
ForkUtil.sendSignal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<String, String> PROFILE_VALUES = new ConcurrentHashMap<String, String>();
|
||||
|
||||
static {
|
||||
PROFILE_VALUES.put(PRODUCT_NAME_KEY, GemfireUtils.GEMFIRE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(final String key) {
|
||||
return PROFILE_VALUES.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user