use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class HAExpiryDUnitTest method createCache.
private void createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
cache = (InternalCache) CacheFactory.create(ds);
assertNotNull(cache);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class Bug36853EventsExpiryDUnitTest method createCache.
/**
* Creates the cache
*
* @param props - distributed system props
* @throws Exception - thrown in any problem occurs in creating cache
*/
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 Bug48571DUnitTest method createClientCache.
public static void createClientCache(Host host, Integer port) throws Exception {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
props.setProperty(DURABLE_CLIENT_ID, "durable-48571");
props.setProperty(DURABLE_CLIENT_TIMEOUT, "300000");
props.setProperty(LOG_FILE, "client_" + OSProcess.getId() + ".log");
props.setProperty(LOG_LEVEL, "info");
props.setProperty(STATISTIC_ARCHIVE_FILE, "client_" + OSProcess.getId() + ".gfs");
props.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(true);
ccf.setPoolSubscriptionAckInterval(50);
ccf.setPoolSubscriptionRedundancy(0);
ccf.addPoolServer(host.getHostName(), port);
DistributedSystem ds = new Bug48571DUnitTest().getSystem(props);
ds.disconnect();
cache = (GemFireCacheImpl) ccf.create();
ClientRegionFactory<String, String> crf = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
crf.setConcurrencyChecksEnabled(false);
crf.addCacheListener(new CacheListenerAdapter<String, String>() {
public void afterInvalidate(EntryEvent<String, String> event) {
cache.getLoggerI18n().fine("Invalidate Event: " + event.getKey() + ", " + event.getNewValue());
numOfInvalidates++;
}
public void afterCreate(EntryEvent<String, String> event) {
if (((String) event.getKey()).equals("last_key")) {
lastKeyReceived = true;
}
cache.getLoggerI18n().fine("Create Event: " + event.getKey() + ", " + event.getNewValue());
numOfCreates++;
}
public void afterUpdate(EntryEvent<String, String> event) {
cache.getLoggerI18n().fine("Update Event: " + event.getKey() + ", " + event.getNewValue());
numOfUpdates++;
}
});
Region<String, String> r = crf.create(region);
r.registerInterest("ALL_KEYS", true);
cache.readyForEvents();
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class Bug48879DUnitTest method createClientCache.
@SuppressWarnings("deprecation")
public static void createClientCache(Host host, Integer[] ports, Boolean doRI) throws Exception {
Properties props = new Properties();
props.setProperty(STATISTIC_ARCHIVE_FILE, "client_" + OSProcess.getId() + ".gfs");
props.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
DistributedSystem ds = new Bug48879DUnitTest().getSystem(props);
ds.disconnect();
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(doRI);
ccf.setPoolSubscriptionAckInterval(50);
ccf.setPoolSubscriptionRedundancy(1);
for (int port : ports) {
ccf.addPoolServer(host.getHostName(), port);
}
cache = (GemFireCacheImpl) ccf.create();
ClientRegionFactory<String, String> crf = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
Region<String, String> region = crf.create(REGION_NAME);
if (doRI) {
region.registerInterest("ALL_KEYS");
}
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class PartitionedRegionLoaderWriterDUnitTest method createCache.
private void createCache(Properties props) {
try {
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
} catch (Exception e) {
Assert.fail("Failed while creating the cache", e);
}
}
Aggregations