use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAClientCountEventListener method createServerCache.
public static Integer createServerCache(Boolean isListenerPresent) throws Exception {
new HAConflationDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
if (isListenerPresent.booleanValue() == true) {
CacheListener serverListener = new HAClientCountEventListener();
factory.setCacheListener(serverListener);
}
RegionAttributes attrs = factory.create();
basicGetCache().createRegion(regionName, attrs);
CacheServerImpl server = (CacheServerImpl) basicGetCache().addCacheServer();
assertNotNull(server);
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setPort(port);
server.setNotifyBySubscription(true);
server.start();
return new Integer(server.getPort());
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DurableClientStatsDUnitTest method checkStatistics.
public static void checkStatistics() {
try {
Cache cache = CacheServerTestUtil.getCache();
org.apache.geode.LogWriter logger = cache.getLogger();
CacheServerImpl currentServer = (CacheServerImpl) (new ArrayList(cache.getCacheServers()).get(0));
AcceptorImpl ai = currentServer.getAcceptor();
CacheClientNotifier notifier = ai.getCacheClientNotifier();
CacheClientNotifierStats stats = notifier.getStats();
logger.info("Stats:" + "\nDurableReconnectionCount:" + stats.get_durableReconnectionCount() + "\nQueueDroppedCount" + stats.get_queueDroppedCount() + "\nEventsEnqueuedWhileClientAwayCount" + stats.get_eventEnqueuedWhileClientAwayCount());
} catch (Exception e) {
fail("Exception thrown while executing checkStatistics()", e);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DurableRegistrationDUnitTest method getBridgeServer.
private static CacheServerImpl getBridgeServer() {
CacheServerImpl bridgeServer = (CacheServerImpl) CacheServerTestUtil.getCache().getCacheServers().iterator().next();
assertNotNull(bridgeServer);
return bridgeServer;
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DSObjectLocalOnly method stopServer.
public static void stopServer() {
try {
assertEquals("Expected exactly one CacheServer", 1, cache.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
bs.stop();
} catch (Exception ex) {
fail("while setting stopServer " + ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DSObjectLocalOnly method startServer.
public static void startServer() {
try {
Cache c = CacheFactory.getAnyInstance();
assertEquals("Expected exactly one CacheServer", 1, c.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) c.getCacheServers().iterator().next();
assertNotNull(bs);
bs.start();
} catch (Exception ex) {
fail("while startServer() " + ex);
}
}
Aggregations