use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class MyFunctionException method disconnect.
public static void disconnect() {
long startTime = System.currentTimeMillis();
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
return false;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 2000, 200, false);
long endTime = System.currentTimeMillis();
region.getCache().getLogger().fine("Time wait for Disconnecting = " + (endTime - startTime));
cache.getDistributedSystem().disconnect();
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class RoutingObject method verifyColocation.
private static void verifyColocation() {
// TODO does having this WaitCriterion help?
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
return tryVerifyColocation();
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 2 * 60 * 1000, 1000, true);
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest method verifyDeadAndLiveServers.
public static void verifyDeadAndLiveServers(final Integer expectedDeadServers, final Integer expectedLiveServers) {
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
int sz = pool.getConnectedServerCount();
LogWriterUtils.getLogWriter().info("Checking for the Live Servers : Expected : " + expectedLiveServers + " Available :" + sz);
if (sz == expectedLiveServers.intValue()) {
return true;
}
excuse = "Expected " + expectedLiveServers.intValue() + " but found " + sz;
return false;
}
public String description() {
return excuse;
}
};
Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class HAClientCountEventListener method checkNoEvents.
private CacheSerializableRunnable checkNoEvents(final int expectedEvents) {
CacheSerializableRunnable checkEvents = new CacheSerializableRunnable("checkEvents") {
// millis
final int interval = 200;
public void run2() throws CacheException {
WaitCriterion w = new WaitCriterion() {
public boolean done() {
synchronized (HAConflationDUnitTest.LOCK) {
if (!lastKeyArrived) {
try {
LOCK.wait(interval);
} catch (InterruptedException e) {
fail("interrupted");
}
}
}
return lastKeyArrived;
}
public String description() {
return "expected " + expectedEvents + " events but received " + actualNoEvents;
}
};
Wait.waitForCriterion(w, 3 * 60 * 1000, interval, true);
}
};
return checkEvents;
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class Bug48571DUnitTest method verifyProxyHasBeenPaused.
private static void verifyProxyHasBeenPaused() {
WaitCriterion criterion = new WaitCriterion() {
@Override
public boolean done() {
CacheClientNotifier ccn = CacheClientNotifier.getInstance();
Collection<CacheClientProxy> ccProxies = ccn.getClientProxies();
Iterator<CacheClientProxy> itr = ccProxies.iterator();
while (itr.hasNext()) {
CacheClientProxy ccp = itr.next();
System.out.println("proxy status " + ccp.getState());
if (ccp.isPaused())
return true;
}
return false;
}
@Override
public String description() {
return "Proxy has not paused yet";
}
};
Wait.waitForCriterion(criterion, 15 * 1000, 200, true);
}
Aggregations