use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class DurableClientQueueSizeDUnitTest method createClientCache.
@SuppressWarnings("deprecation")
public static void createClientCache(Host host, Integer[] ports, String timeoutSeconds, Boolean durable, Boolean multiPool, CacheListener cacheListener) throws Exception {
if (multiPool) {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "SPECIAL_DURABLE", "true");
}
Properties props = new Properties();
if (durable) {
props.setProperty(DURABLE_CLIENT_ID, MY_DURABLE_CLIENT);
props.setProperty(DURABLE_CLIENT_TIMEOUT, timeoutSeconds);
}
DistributedSystem ds = new DurableClientQueueSizeDUnitTest().getSystem(props);
ds.disconnect();
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(true);
ccf.setPoolSubscriptionAckInterval(50);
ccf.setPoolSubscriptionRedundancy(1);
ccf.setPoolMaxConnections(1);
for (int port : ports) {
ccf.addPoolServer(host.getHostName(), port);
}
cache = (GemFireCacheImpl) ccf.create();
ClientRegionFactory<String, String> crf = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
if (cacheListener != null) {
crf.addCacheListener(cacheListener);
}
crf.setPoolName(cache.getDefaultPool().getName());
crf.create(REGION_NAME);
if (multiPool) {
String poolName = POOL_NAME;
PoolFactory pf = PoolManager.createFactory();
for (int port : ports) {
pf.addServer(host.getHostName(), port);
}
pf.setSubscriptionEnabled(true);
pf.create(poolName);
crf.setPoolName(poolName);
crf.create(NEW_REGION);
}
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class DestroyEntryPropagationDUnitTest method createCache.
private void createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class DSObjectLocalOnly method createCache.
private void createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
ds.disconnect();
ds = getSystem(props);
assertNotNull(ds);
cache = CacheFactory.create(ds);
assertNotNull(cache);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class RegionCloseDUnitTest method createCache.
private void createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class UnregisterInterestDUnitTest method createCacheAndStartServer.
public static Integer createCacheAndStartServer() throws Exception {
DistributedSystem ds = new UnregisterInterestDUnitTest().getSystem();
ds.disconnect();
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
CacheFactory cf = new CacheFactory(props);
cache = cf.create();
RegionFactory rf = ((GemFireCacheImpl) cache).createRegionFactory(RegionShortcut.REPLICATE);
rf.create(regionname);
CacheServer server = ((GemFireCacheImpl) cache).addCacheServer();
server.setPort(AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
server.start();
return server.getPort();
}
Aggregations