INT-4266: Disable multicast for Gemfire tests

JIRA: https://jira.spring.io/browse/INT-4266

https://build.spring.io/browse/INT-B41-634

Conflicts:
	spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireGroupStoreTests.java
	spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/GemfireMessageStoreTests.java
This commit is contained in:
Artem Bilan
2017-06-04 19:07:20 -04:00
parent 57814938ad
commit 7d16ab5f06
10 changed files with 103 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 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.
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.file.filters;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
@@ -31,6 +33,7 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.integration.gemfire.metadata.GemfireMetadataStore;
@@ -39,7 +42,7 @@ import org.springframework.integration.redis.metadata.RedisMetadataStore;
import org.springframework.integration.redis.rules.RedisAvailable;
import org.springframework.integration.redis.rules.RedisAvailableTests;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Cache;
/**
* @author Gary Russell
@@ -69,7 +72,14 @@ public class PersistentAcceptOnceFileListFilterExternalStoreTests extends RedisA
@Test
public void testFileSystemWithGemfireMetadataStore() throws Exception {
this.testFileSystem(new GemfireMetadataStore(new CacheFactory().create()));
CacheFactoryBean cacheFactoryBean = new CacheFactoryBean();
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("mcast-port", "0");
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.afterPropertiesSet();
Cache cache = cacheFactoryBean.getObject();
testFileSystem(new GemfireMetadataStore(cache));
cacheFactoryBean.destroy();
}
private void testFileSystem(ConcurrentMetadataStore store) throws Exception {

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;
@@ -38,6 +40,7 @@ import com.gemstone.gemfire.cache.Region;
* @author Mark Fisher
* @author Gary Russell
* @author Artem Bilan
*
* @since 2.1
*/
@SuppressWarnings("deprecation")
@@ -53,6 +56,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.
@@ -19,28 +19,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;
@@ -48,19 +50,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. You may obtain a copy of the License at
@@ -19,6 +19,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;
@@ -48,6 +49,7 @@ import com.gemstone.gemfire.cache.Scope;
/**
* @author Artem Bilan
* @author Gary Russell
*
* @since 3.0
*/
public class DelayerHandlerRescheduleIntegrationTests {
@@ -64,6 +66,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();
Cache cache = cacheFactoryBean.getObject();
region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2015 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.
@@ -377,6 +377,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-2015 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");
}