use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DurableClientReconnectDUnitTest method getBridgeServer.
private static CacheServerImpl getBridgeServer() {
CacheServerImpl bridgeServer = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bridgeServer);
return bridgeServer;
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DurableClientStatsDUnitTest method checkStatisticsWithExpectedValues.
public static void checkStatisticsWithExpectedValues(int reconnectionCount, int queueDropCount, int enqueueCount) {
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());
assertEquals(reconnectionCount, stats.get_durableReconnectionCount());
assertEquals(queueDropCount, stats.get_queueDroppedCount());
assertEquals(enqueueCount, stats.get_eventEnqueuedWhileClientAwayCount());
} catch (Exception e) {
fail("Exception thrown while executing checkStatisticsWithExpectedValues()", e);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class RedundancyLevelTestBase method verifyInterestRegistration.
public static void verifyInterestRegistration() {
try {
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
return cache.getCacheServers().size() == 1;
}
public String description() {
return "Number of bridge servers (" + cache.getCacheServers().size() + ") never became 1";
}
};
Wait.waitForCriterion(wc, 180 * 1000, 2000, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
assertNotNull(bs.getAcceptor());
assertNotNull(bs.getAcceptor().getCacheClientNotifier());
final CacheClientNotifier ccn = bs.getAcceptor().getCacheClientNotifier();
wc = new WaitCriterion() {
public boolean done() {
return ccn.getClientProxies().size() > 0;
}
public String description() {
return "Notifier's proxies is empty";
}
};
Wait.waitForCriterion(wc, 180 * 1000, 2000, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
final CacheClientProxy ccp = (CacheClientProxy) iter_prox.next();
wc = new WaitCriterion() {
String excuse;
public boolean done() {
Set keysMap = (Set) ccp.cils[RegisterInterestTracker.interestListIndex].getProfile(Region.SEPARATOR + REGION_NAME).getKeysOfInterestFor(ccp.getProxyID());
if (keysMap == null) {
excuse = "keys of interest is null";
return false;
}
if (keysMap.size() != 2) {
excuse = "keys of interest size (" + keysMap.size() + ") not 2";
return false;
}
return true;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 180 * 1000, 2 * 1000, true);
Set keysMap = ccp.cils[RegisterInterestTracker.interestListIndex].getProfile(Region.SEPARATOR + REGION_NAME).getKeysOfInterestFor(ccp.getProxyID());
assertTrue(keysMap.contains(k1));
assertTrue(keysMap.contains(k2));
} else {
fail("A CCP was expected . Wasn't it?");
}
} catch (Exception ex) {
fail("while setting verifyInterestRegistration", ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class RedundancyLevelTestBase method verifyDispatcherIsNotAlive.
public static void verifyDispatcherIsNotAlive() {
try {
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
return cache.getCacheServers().size() == 1;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
assertNotNull(bs.getAcceptor());
assertNotNull(bs.getAcceptor().getCacheClientNotifier());
final CacheClientNotifier ccn = bs.getAcceptor().getCacheClientNotifier();
wc = new WaitCriterion() {
String excuse;
public boolean done() {
return ccn.getClientProxies().size() > 0;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
CacheClientProxy proxy = (CacheClientProxy) iter_prox.next();
assertFalse("Dispatcher on secondary should not be alive", proxy._messageDispatcher.isAlive());
}
} catch (Exception ex) {
Assert.fail("while setting verifyDispatcherIsNotAlive ", ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class RegionCloseDUnitTest method VerifyClientProxyOnServerAfterClose.
public static void VerifyClientProxyOnServerAfterClose() {
final Cache c = CacheFactory.getAnyInstance();
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return c.getCacheServers().size() == 1;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 40 * 1000, 200, true);
final CacheServerImpl bs = (CacheServerImpl) c.getCacheServers().iterator().next();
ev = new WaitCriterion() {
public boolean done() {
return c.getRegion("/" + clientMembershipId) == null;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 40 * 1000, 200, true);
ev = new WaitCriterion() {
public boolean done() {
return bs.getAcceptor().getCacheClientNotifier().getClientProxies().size() != 1;
}
public String description() {
return null;
}
};
Wait.waitForCriterion(ev, 40 * 1000, 200, true);
// assertNull(c.getRegion("/"+clientMembershipId));
assertEquals(0, bs.getAcceptor().getCacheClientNotifier().getClientProxies().size());
}
Aggregations