use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class LauncherLifecycleCommandsDUnitTest method waitForGemFireProcessToStop.
protected Status waitForGemFireProcessToStop(final ServiceState serviceState, final String workingDirectory) {
if (!Status.STOPPED.equals(serviceState.getStatus())) {
try {
final Integer pid = readPid(new File(workingDirectory));
if (pid != null) {
WaitCriterion waitCriteria = new WaitCriterion() {
private LauncherLifecycleCommands launcherLifecycleCommands = new LauncherLifecycleCommands();
@Override
public boolean done() {
return !ProcessUtils.isProcessAlive(pid);
}
@Override
public String description() {
return String.format("Waiting for GemFire Process with PID (%1$d) to stop.", pid);
}
};
waitForCriterion(waitCriteria, TimeUnit.SECONDS.toMillis(15), TimeUnit.SECONDS.toMillis(5), false);
if (!waitCriteria.done()) {
processIds.offer(pid);
}
}
} catch (IOException ignore) {
}
}
return serviceState.getStatus();
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class ConnectionPoolDUnitTest method waitForEntry.
/**
* A handy method to poll for arrival of non-null/non-invalid entries
*
* @param r the Region to poll
* @param key the key of the Entry to poll for
*/
public static void waitForEntry(final Region r, final Object key) {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return r.containsValueForKey(key);
}
public String description() {
return "Waiting for entry " + key + " on region " + r;
}
};
Wait.waitForCriterion(ev, 10 * 1000, 200, true);
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class CqTimeTestListener method waitForUpdated.
public boolean waitForUpdated(final Object key) {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return CqTimeTestListener.this.updates.contains(key);
}
public String description() {
return "never got update event for CQ " + CqTimeTestListener.this.cqName;
}
};
Wait.waitForCriterion(ev, MAX_TIME, 200, true);
return true;
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class AsynchIndexMaintenanceJUnitTest method testIndexMaintenanceBasedOnThreshhold.
@Test
public void testIndexMaintenanceBasedOnThreshhold() throws Exception {
System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceThreshold", "50");
System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceInterval", "0");
final Index ri = qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "p.getID", "/portfolio p");
for (int i = 0; i < 49; ++i) {
region.put("" + (i + 1), new Portfolio(i + 1));
idSet.add((i + 1) + "");
}
// assertIndexDetailsEquals(0, getIndexSize(ri));
region.put("50", new Portfolio(50));
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return (getIndexSize(ri) == 50);
}
public String description() {
return "valueToEntriesMap never became 50";
}
};
Wait.waitForCriterion(ev, 3000, 200, true);
}
use of org.apache.geode.test.dunit.WaitCriterion in project geode by apache.
the class AsynchIndexMaintenanceJUnitTest method testIndexMaintenanceBasedOnThresholdAsZero.
@Test
public void testIndexMaintenanceBasedOnThresholdAsZero() throws Exception {
System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceThreshold", "0");
System.getProperties().put(DistributionConfig.GEMFIRE_PREFIX + "AsynchIndexMaintenanceInterval", "60000");
final Index ri = (Index) qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "p.getID", "/portfolio p");
for (int i = 0; i < 3; ++i) {
region.put("" + (i + 1), new Portfolio(i + 1));
idSet.add((i + 1) + "");
}
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return (getIndexSize(ri) == 3);
}
public String description() {
return "valueToEntries map never became size 3";
}
};
Wait.waitForCriterion(ev, 10 * 1000, 200, true);
}
Aggregations