use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class CacheServerTestUtil method createCacheClient.
public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception {
new CacheServerTestUtil().createCache(dsProperties);
IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
Enumeration e = javaSystemProperties.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
System.setProperty(key, javaSystemProperties.getProperty(key));
}
}
PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
pf.init(poolAttr);
PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setPoolName(p.getName());
if (addControlListener.booleanValue()) {
factory.addCacheListener(new ControlListener());
}
RegionAttributes attrs = factory.create();
cache.createRegion(regionName, attrs);
pool = p;
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class CacheServerTransactionsDUnitTest method createClientCache.
public static void createClientCache(String host, Integer port) throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
new CacheServerTransactionsDUnitTest().createCache(props);
PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port.intValue()).setSubscriptionEnabled(true).create("CacheServerTransctionDUnitTestPool2");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setPoolName(p.getName());
factory.setCacheListener(new CacheListenerAdapter() {
public void afterDestroy(EntryEvent event) {
synchronized (CacheServerTransactionsDUnitTest.class) {
destroyed = true;
CacheServerTransactionsDUnitTest.class.notify();
}
}
public void afterInvalidate(EntryEvent event) {
synchronized (CacheServerTransactionsDUnitTest.class) {
invalidated = true;
CacheServerTransactionsDUnitTest.class.notifyAll();
}
}
});
Region region1 = cache.createRegion(REGION_NAME, factory.create());
assertNotNull(region1);
pool = p;
registerKeys();
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class ClearPropagationDUnitTest method acquireConnectionsAndClear.
public static void acquireConnectionsAndClear(String host) {
try {
Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r1);
String poolName = r1.getAttributes().getPoolName();
assertNotNull(poolName);
PoolImpl pool = (PoolImpl) PoolManager.find(poolName);
assertNotNull(pool);
Connection conn1 = pool.acquireConnection(new ServerLocation(host, PORT2));
assertNotNull(conn1);
assertEquals(PORT2, conn1.getServer().getPort());
ServerRegionProxy srp = new ServerRegionProxy(Region.SEPARATOR + REGION_NAME, pool);
srp.clearOnForTestsOnly(conn1, new EventID(new byte[] { 1 }, 1, 1), null);
} catch (Exception ex) {
ex.printStackTrace();
fail("while setting acquireConnections " + ex);
}
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class BackwardCompatibilityHigherVersionClientDUnitTest method createClientCache.
public static void createClientCache(String host, Integer port1) throws Exception {
new BackwardCompatibilityHigherVersionClientDUnitTest();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
new BackwardCompatibilityHigherVersionClientDUnitTest().createCache(props);
PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, port1.intValue()).setSubscriptionEnabled(true).setSubscriptionRedundancy(1).setThreadLocalConnections(true).setMinConnections(1).setFreeConnectionTimeout(200000).setReadTimeout(200000).setPingInterval(10000).setRetryAttempts(1).setSubscriptionAckInterval(CLIENT_ACK_INTERVAL).create("BackwardCompatibilityHigherVersionClientDUnitTest");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setPoolName(p.getName());
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
}
use of org.apache.geode.cache.client.internal.PoolImpl in project geode by apache.
the class Bug36269DUnitTest method createClientCache.
public static void createClientCache() throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
new Bug36269DUnitTest().createCache(props);
CacheServerTestUtil.disableShufflingOfEndpoints();
PoolImpl p;
String host = NetworkUtils.getServerHostName(Host.getHost(0));
try {
p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1).addServer(host, PORT2).setSubscriptionEnabled(true).setReadTimeout(2000).setSocketBufferSize(1000).setMinConnections(4).create("Bug36269DUnitTestPool");
} finally {
CacheServerTestUtil.enableShufflingOfEndpoints();
}
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setPoolName(p.getName());
pool = p;
assertNotNull(pool);
cache.createRegion(REGION_NAME, factory.create());
}
Aggregations