use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class FailoverDUnitTest method waitForPrimaryAndBackups.
public void waitForPrimaryAndBackups(final int numBackups) {
final PoolImpl pool = (PoolImpl) PoolManager.find("FailoverPool");
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
if (pool.getPrimary() == null) {
return false;
}
if (pool.getRedundants().size() < numBackups) {
return false;
}
return true;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 20 * 1000, 200, true);
assertNotNull(pool.getPrimary());
assertTrue("backups=" + pool.getRedundants() + " expected=" + numBackups, pool.getRedundants().size() >= numBackups);
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class PRDeltaPropagationDUnitTest method createClientCache.
public static void createClientCache(Integer port1, Integer port2) throws Exception {
PRDeltaPropagationDUnitTest test = new PRDeltaPropagationDUnitTest();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
test.createCache(props);
lastKeyReceived = false;
PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer("localhost", port1).addServer("localhost", port2).setSubscriptionEnabled(true).setSubscriptionRedundancy(1).setThreadLocalConnections(true).setMinConnections(6).setReadTimeout(20000).setPingInterval(10000).setRetryAttempts(5).create("PRDeltaPropagationDUnitTestPool");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setPoolName(p.getName());
factory.setCloningEnabled(false);
factory.setConcurrencyChecksEnabled(true);
factory.addCacheListener(new CacheListenerAdapter() {
@Override
public void afterCreate(EntryEvent event) {
if (LAST_KEY.equals(event.getKey())) {
lastKeyReceived = true;
}
}
});
RegionAttributes attrs = factory.create();
deltaPR = cache.createRegion(REGION_NAME, attrs);
// deltaPR.create(DELTA_KEY, new PRDeltaTestImpl());
deltaPR.registerInterest("ALL_KEYS");
pool = p;
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class WANTestBase method verifyPool.
public static void verifyPool(String senderId, boolean poolShouldExist, int expectedPoolLocatorsSize) {
AbstractGatewaySender sender = (AbstractGatewaySender) cache.getGatewaySender(senderId);
PoolImpl pool = sender.getProxy();
if (poolShouldExist) {
assertNotNull(pool);
assertEquals(expectedPoolLocatorsSize, pool.getLocators().size());
} else {
assertNull(pool);
}
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class DurableClientReconnectDUnitTest method createCacheClient.
private void createCacheClient(int redundancyLevel, final int durableClientTimeout, boolean queueEnabled) {
try {
final String durableClientId = "DurableClientReconnectDUnitTest_client";
Properties props = getClientDistributedSystemProperties(durableClientId, durableClientTimeout);
instance = new DurableClientReconnectDUnitTest();
instance.createCache(props);
// Host host = Host.getHost(0);
PoolImpl p = (PoolImpl) getPoolFactory().setSubscriptionEnabled(queueEnabled).setReadTimeout(10000).setSubscriptionRedundancy(redundancyLevel).create("DurableClientReconnectDUnitTestPool");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setPoolName(p.getName());
RegionAttributes attrs = factory.create();
Region r = cache.createRegion(REGION_NAME, attrs);
assertNotNull(r);
pool = p;
conn = pool.acquireConnection();
assertNotNull(conn);
cache.readyForEvents();
} catch (Exception e) {
Assert.fail("test failed due to ", e);
}
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class TestSubscriptionsDUnitTest method createClientCache.
private Cache createClientCache(String host, int port1) throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
Cache cache = createCache(props);
PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port1).setSubscriptionEnabled(true).setThreadLocalConnections(true).setMinConnections(1).setReadTimeout(20000).setPingInterval(10000).setRetryAttempts(1).setSubscriptionEnabled(true).setStatisticInterval(1000).create("TestSubscriptionsDUnitTest");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setPoolName(p.getName());
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
return cache;
}
Aggregations