use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class ClientServerMiscDUnitTest method verifyInterestListOnServer.
public static void verifyInterestListOnServer() {
try {
Cache cache = new ClientServerMiscDUnitTest().getCache();
assertEquals("More than one BridgeServer", 1, cache.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
assertNotNull(bs.getAcceptor());
assertNotNull(bs.getAcceptor().getCacheClientNotifier());
Iterator iter_prox = bs.getAcceptor().getCacheClientNotifier().getClientProxies().iterator();
while (iter_prox.hasNext()) {
CacheClientProxy ccp = (CacheClientProxy) iter_prox.next();
// CCP should not contain region1
Set akr = ccp.cils[RegisterInterestTracker.interestListIndex].regions;
assertNotNull(akr);
assertTrue(!akr.contains(Region.SEPARATOR + REGION_NAME1));
// CCP should contain region2
assertTrue(akr.contains(Region.SEPARATOR + REGION_NAME2));
assertEquals(1, akr.size());
}
} catch (Exception ex) {
ex.printStackTrace();
fail("while setting verifyInterestListOnServer " + ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class InterestListEndpointDUnitTest method verifyIfNotInterestListEndpointAndThenPut.
public static void verifyIfNotInterestListEndpointAndThenPut() {
try {
Cache c = CacheFactory.getAnyInstance();
assertEquals("More than one CacheServer", 1, c.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) c.getCacheServers().iterator().next();
assertNotNull(bs);
assertNotNull(bs.getAcceptor());
assertNotNull(bs.getAcceptor().getCacheClientNotifier());
Iterator iter = bs.getAcceptor().getCacheClientNotifier().getClientProxies().iterator();
// only one server thats why if and not while
if (iter.hasNext()) {
CacheClientProxy proxy = (CacheClientProxy) iter.next();
// if (proxy._interestList._keysOfInterest.get("/"+ REGION_NAME) == null) {
if (!proxy.isPrimary()) {
Region r = cache.getRegion("/" + REGION_NAME);
r.put(k1, server_k1);
r.put(k2, server_k2);
}
}
} catch (Exception ex) {
org.apache.geode.test.dunit.Assert.fail("failed while verifyIfNotInterestListEndpointAndThenPut()", ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class InterestListDUnitTest method flushQueues.
/** wait for queues to drain in the server */
private static void flushQueues() throws Exception {
CacheServerImpl impl = (CacheServerImpl) server;
for (CacheClientProxy proxy : (Set<CacheClientProxy>) impl.getAllClientSessions()) {
final CacheClientProxy fproxy = proxy;
WaitCriterion ev = new WaitCriterion() {
@Override
public boolean done() {
return fproxy.getHARegionQueue().size() == 0;
}
@Override
public String description() {
return "waiting for queues to drain for " + fproxy.getProxyID();
}
};
Wait.waitForCriterion(ev, 5 * 10 * 1000, 200, true);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class TestObject20 method startServer.
public static void startServer() {
try {
Cache c = CacheFactory.getAnyInstance();
assertEquals("Expected exactly one BridgeServer", 1, c.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) c.getCacheServers().iterator().next();
assertNotNull(bs);
bs.start();
} catch (Exception ex) {
fail("while startServer() " + ex);
}
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class TestObject20 method stopServer.
public static void stopServer() {
try {
assertEquals("Expected exactly one BridgeServer", 1, cache.getCacheServers().size());
CacheServerImpl bs = (CacheServerImpl) cache.getCacheServers().iterator().next();
assertNotNull(bs);
bs.stop();
} catch (Exception ex) {
fail("while setting stopServer " + ex);
}
}
Aggregations