use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAInterestTestCase method verifyInterestUNRegistration.
public static void verifyInterestUNRegistration() {
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return cache.getCacheServers().size() == 1;
}
@Override
public String description() {
return "waiting for cache.getCacheServers().size() == 1";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, 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() {
@Override
public boolean done() {
return ccn.getClientProxies().size() > 0;
}
@Override
public String description() {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Iterator iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
final CacheClientProxy ccp = (CacheClientProxy) iter_prox.next();
wc = new WaitCriterion() {
@Override
public boolean done() {
Set keysMap = (Set) ccp.cils[RegisterInterestTracker.interestListIndex].getProfile(Region.SEPARATOR + REGION_NAME).getKeysOfInterestFor(ccp.getProxyID());
return keysMap != null;
}
@Override
public String description() {
return "waiting for keys of interest to not be null";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
Set keysMap = (Set) ccp.cils[RegisterInterestTracker.interestListIndex].getProfile(Region.SEPARATOR + REGION_NAME).getKeysOfInterestFor(ccp.getProxyID());
assertNotNull(keysMap);
assertEquals(1, keysMap.size());
assertFalse(keysMap.contains(k1));
assertTrue(keysMap.contains(k2));
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAInterestTestCase method verifyDispatcherIsAlive.
public static void verifyDispatcherIsAlive() {
assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size());
WaitCriterion wc = new WaitCriterion() {
@Override
public boolean done() {
return cache.getCacheServers().size() == 1;
}
@Override
public String description() {
return "waiting for cache.getCacheServers().size() == 1";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, 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() {
@Override
public boolean done() {
return ccn.getClientProxies().size() > 0;
}
@Override
public String description() {
return "waiting for ccn.getClientProxies().size() > 0";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
wc = new WaitCriterion() {
Iterator iter_prox;
CacheClientProxy proxy;
@Override
public boolean done() {
iter_prox = ccn.getClientProxies().iterator();
if (iter_prox.hasNext()) {
proxy = (CacheClientProxy) iter_prox.next();
return proxy._messageDispatcher.isAlive();
} else {
return false;
}
}
@Override
public String description() {
return "waiting for CacheClientProxy _messageDispatcher to be alive";
}
};
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAInterestTestCase method stopServer.
public static void stopServer() {
assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
bs.stop();
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAInterestTestCase method startServer.
public static void startServer() throws IOException {
Cache c = CacheFactory.getAnyInstance();
assertEquals("More than one BridgeServer", 1, c.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) c.getCacheServers().iterator().next();
assertNotNull(bs);
bs.start();
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class HAStartupAndFailoverDUnitTest method verifyDispatcherIsAlive.
public static void verifyDispatcherIsAlive() {
try {
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
return cache.getCacheServers().size() == 1;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 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, 60 * 1000, 1000, true);
Collection<CacheClientProxy> proxies = ccn.getClientProxies();
Iterator<CacheClientProxy> iter_prox = proxies.iterator();
if (iter_prox.hasNext()) {
final CacheClientProxy proxy = iter_prox.next();
wc = new WaitCriterion() {
String excuse;
public boolean done() {
return proxy._messageDispatcher.isAlive();
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
// assertTrue("Dispatcher on primary should be alive",
// proxy._messageDispatcher.isAlive());
}
} catch (Exception ex) {
fail("while setting verifyDispatcherIsAlive " + ex);
}
}
Aggregations