SGF-57
+ fix some initilization problem with the container that triggered eager registration of cqs + added more integration tests
This commit is contained in:
@@ -64,6 +64,11 @@ public class ListenerContainerTests {
|
||||
ccf.setPoolSubscriptionEnabled(true);
|
||||
cache = ccf.create();
|
||||
|
||||
// not really used but here just for future tests :)
|
||||
// PoolFactory pf = PoolManager.createFactory();
|
||||
// pf.addServer("localhost", 40404);
|
||||
// pf.setSubscriptionEnabled(true);
|
||||
// Pool pool = pf.create("client");
|
||||
}
|
||||
|
||||
|
||||
@@ -89,12 +94,12 @@ public class ListenerContainerTests {
|
||||
|
||||
container = new ContinousQueryListenerContainer();
|
||||
container.setCache(cache);
|
||||
//container.setPoolName("client");
|
||||
container.setBeanName("container");
|
||||
container.addListener(new ContinousQueryDefinition("test", query, adapter));
|
||||
container.afterPropertiesSet();
|
||||
container.addListener(new ContinousQueryDefinition("test", query, adapter));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testContainer() throws Exception {
|
||||
ForkUtil.sendSignal();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.data.gemfire.listener.adapter;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
@@ -26,8 +27,7 @@ import org.springframework.data.gemfire.ForkUtil;
|
||||
import org.springframework.data.gemfire.listener.ContinousQueryListenerContainer;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.client.PoolFactory;
|
||||
import com.gemstone.gemfire.cache.client.PoolManager;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
import com.gemstone.gemfire.cache.query.CqQuery;
|
||||
|
||||
/**
|
||||
@@ -54,12 +54,15 @@ public class ContainerXmlSetupTest {
|
||||
ContinousQueryListenerContainer container = ctx.getBean(ContinousQueryListenerContainer.class);
|
||||
assertTrue(container.isRunning());
|
||||
|
||||
ForkUtil.sendSignal();
|
||||
Thread.sleep(3000);
|
||||
Cache cache = ctx.getBean("gemfire-cache", Cache.class);
|
||||
Pool pool = ctx.getBean("client", Pool.class);
|
||||
|
||||
CqQuery[] cqs = cache.getQueryService().getCqs();
|
||||
System.out.println("Cqs " + cqs.length);
|
||||
CqQuery[] pcqs = pool.getQueryService().getCqs();
|
||||
assertTrue(pool.getQueryService().getCq("test-bean-1") != null);
|
||||
assertEquals(3, cqs.length);
|
||||
assertEquals(3, pcqs.length);
|
||||
ForkUtil.sendSignal();
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user