INT-4266: Disable multicast for Gemfire tests

JIRA: https://jira.spring.io/browse/INT-4266
This commit is contained in:
Artem Bilan
2017-05-01 09:53:20 -04:00
committed by Gary Russell
parent 12d2d8c677
commit 883281f58f
9 changed files with 90 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import java.util.Properties;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -39,6 +41,7 @@ import com.gemstone.gemfire.cache.Region;
* @author Mark Fisher
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.1
*/
public class CacheListeningMessageProducerTests {
@@ -55,6 +58,11 @@ public class CacheListeningMessageProducerTests {
public static void setup() throws Exception {
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
regionFactoryBean = new RegionFactoryBean<String, String>() { };
regionFactoryBean.setName("test.receiveNewValuePayloadForCreateEvent");
regionFactoryBean.setCache(cacheFactoryBean.getObject());

View File

@@ -1,51 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder properties-ref="props" />
<context:property-placeholder properties-ref="props"/>
<util:properties id="props">
<prop key="durable">true</prop>
</util:properties>
<util:properties id="gemfireProperties">
<prop key="mcast-port">0</prop>
</util:properties>
<gfe:client-cache use-bean-factory-locator="false"
id="client-cache" pool-name="client-pool" />
id="client-cache" pool-name="client-pool"
properties-ref="gemfireProperties"/>
<gfe:pool id="client-pool" subscription-enabled="true">
<gfe:server host="localhost" port="40404" />
<gfe:server host="localhost" port="40404"/>
</gfe:pool>
<gfe:client-region id="test" cache-ref="client-cache"
pool-name="client-pool" data-policy="EMPTY" />
pool-name="client-pool" data-policy="EMPTY"/>
<gfe:cq-listener-container id="queryListenerContainer"
cache="client-cache" />
cache="client-cache"/>
<int-gfe:cq-inbound-channel-adapter id="withDurable"
cq-listener-container="queryListenerContainer" query="select * from /test"
channel="outputChannel1" durable="${durable}" />
cq-listener-container="queryListenerContainer" query="select * from /test"
channel="outputChannel1" durable="${durable}"/>
<int:channel id="outputChannel1">
<int:queue />
<int:queue/>
</int:channel>
<int-gfe:cq-inbound-channel-adapter
cq-listener-container="queryListenerContainer" query="select * from /test"
channel="outputChannel2" expression="newValue" query-events="CREATED" />
cq-listener-container="queryListenerContainer" query="select * from /test"
channel="outputChannel2" expression="newValue" query-events="CREATED"/>
<int:channel id="outputChannel2">
<int:queue />
<int:queue/>
</int:channel>
</beans>

View File

@@ -3,14 +3,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire
http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
http://www.springframework.org/schema/gemfire
http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<gfe:cache id="gemfire-cache-2" use-bean-factory-locator="false"/>
<util:properties id="gemfireProperties">
<prop key="mcast-port">0</prop>
</util:properties>
<gfe:cache id="gemfire-cache-2" use-bean-factory-locator="false" properties-ref="gemfireProperties"/>
<gfe:local-region id="region1" cache-ref="gemfire-cache-2"/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -20,28 +20,30 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.util.Properties;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.GemfireTemplate;
import org.springframework.integration.metadata.ConcurrentMetadataStore;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
/**
* @author Artem Bilan
*
* @since 4.0
*
*/
public class GemfireMetadataStoreTests {
private static Cache cache;
private static CacheFactoryBean cacheFactoryBean;
private static ConcurrentMetadataStore metadataStore;
@@ -49,19 +51,23 @@ public class GemfireMetadataStoreTests {
@BeforeClass
public static void startUp() throws Exception {
cache = new CacheFactory().create();
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
Cache cache = cacheFactoryBean.getObject();
metadataStore = new GemfireMetadataStore(cache);
region = cache.getRegion(GemfireMetadataStore.KEY);
}
@AfterClass
public static void cleanUp() {
public static void cleanUp() throws Exception {
if (region != null) {
region.close();
}
if (cache != null) {
cache.close();
Assert.isTrue(cache.isClosed(), "Cache did not close after close() call");
if (cacheFactoryBean != null) {
cacheFactoryBean.destroy();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.mock;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.junit.AfterClass;
import org.junit.Before;
@@ -46,6 +47,7 @@ import com.gemstone.gemfire.cache.Scope;
* @author Gunnar Hillert
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.1
*/
public class CacheWritingMessageHandlerTests {
@@ -57,6 +59,9 @@ public class CacheWritingMessageHandlerTests {
@BeforeClass
public static void startUp() throws Exception {
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
Cache cache = cacheFactoryBean.getObject();
region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests");

View File

@@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int-gfe="http://www.springframework.org/schema/integration/gemfire"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/gemfire http://www.springframework.org/schema/integration/gemfire/spring-integration-gemfire.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<gfe:cache use-bean-factory-locator="false"/>
<util:properties id="gemfireProperties">
<prop key="mcast-port">0</prop>
</util:properties>
<gfe:cache use-bean-factory-locator="false" properties-ref="gemfireProperties"/>
<gfe:replicated-region id="region1"/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
@@ -47,6 +48,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
/**
* @author Artem Bilan
* @author Gary Russell
*
* @since 3.0
*/
public class DelayerHandlerRescheduleIntegrationTests {
@@ -61,6 +63,9 @@ public class DelayerHandlerRescheduleIntegrationTests {
@BeforeClass
public static void startUp() throws Exception {
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2016 the original author or authors.
* Copyright 2007-2017 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.
@@ -379,6 +379,9 @@ public class GemfireGroupStoreTests {
@BeforeClass
public static void init() throws Exception {
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
Cache cache = cacheFactoryBean.getObject();
region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -48,6 +48,7 @@ import com.gemstone.gemfire.cache.Scope;
* @author David Turanski
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.1
*/
public class GemfireMessageStoreTests {
@@ -133,6 +134,10 @@ public class GemfireMessageStoreTests {
@BeforeClass
public static void init() throws Exception {
cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
Cache cache = cacheFactoryBean.getObject();
region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests");
}