use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class Bug51400DUnitTest method createClientCache.
public static void createClientCache(String hostName, Integer[] ports, Integer interval) throws Exception {
Properties props = new Properties();
DistributedSystem ds = new Bug51400DUnitTest().getSystem(props);
ds.disconnect();
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(true);
ccf.setPoolSubscriptionAckInterval(interval);
for (int port : ports) {
ccf.addPoolServer(hostName, port);
}
cache = (GemFireCacheImpl) ccf.create();
ClientRegionFactory<String, String> crf = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
Region<String, String> region = crf.create(REGION_NAME);
region.registerInterest("ALL_KEYS");
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class FixedPartitioningTestBase method createCache.
private void createCache() {
try {
Properties props = new Properties();
cache = null;
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
cache = (InternalCache) CacheFactory.create(ds);
assertNotNull(cache);
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("Failed while creating the cache", e);
}
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class ClientServerMiscDUnitTest method createCacheV.
private Cache createCacheV(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
Cache cache = getCache();
assertNotNull(cache);
return cache;
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class ClientServerMiscDUnitTest method testProxyCreationBeforeCacheCreation.
/**
* Create proxy before cache creation, create cache, create two regions, attach same bridge writer
* to both of the regions Region interests AL_KEYS on both the regions,
* notify-by-subscription=true . The CCP should have both the regions in interest list.
*
* @throws Exception
*/
@Test
public void testProxyCreationBeforeCacheCreation() throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
PORT1 = initServerCache(true);
String host = NetworkUtils.getServerHostName(server1.getHost());
Pool p = PoolManager.createFactory().addServer(host, PORT1).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).create("testProxyCreationBeforeCacheCreationPool");
Cache cache = getCache();
assertNotNull(cache);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setPoolName(p.getName());
RegionAttributes myAttrs = factory.create();
Region region1 = cache.createRegion(REGION_NAME1, myAttrs);
Region region2 = cache.createRegion(REGION_NAME2, myAttrs);
assertNotNull(region1);
assertNotNull(region2);
// region1.registerInterest(CacheClientProxy.ALL_KEYS);
region2.registerInterest("ALL_KEYS");
Wait.pause(6000);
server1.invoke(() -> ClientServerMiscDUnitTest.verifyInterestListOnServer());
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class ClientInterestNotifyDUnitTest method createCache.
private Cache createCache(Properties props) throws Exception {
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
DistributedSystem ds = DistributedSystem.connect(props);
Cache cache = CacheFactory.create(ds);
if (cache == null) {
throw new Exception("CacheFactory.create() returned null ");
}
return cache;
}
Aggregations