use of org.apache.geode.cache.query.internal.QueryObserver in project geode by apache.
the class IndexTrackingQueryObserverDUnitTest method verifyQueryVerboseData.
private AsyncInvocation verifyQueryVerboseData(VM vm, final int results) {
SerializableRunnable testQueryVerbose = new SerializableRunnable("Test Query Verbose Data") {
public void run() {
// Query VERBOSE has to be true for the test
assertTrue(DefaultQuery.QUERY_VERBOSE);
// Get TestHook from observer.
QueryObserver observer = QueryObserverHolder.getInstance();
assertTrue(QueryObserverHolder.hasObserver());
final IndexTrackingTestHook th = (IndexTrackingTestHook) ((IndexTrackingQueryObserver) observer).getTestHook();
Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
if (th.getRegionMap() != null) {
return th.getRegionMap().getResults() != null;
}
return false;
}
public String description() {
return null;
}
}, 60 * 1000, 200, true);
IndexInfo regionMap = th.getRegionMap();
Collection<Integer> rslts = regionMap.getResults().values();
int totalResults = 0;
for (Integer i : rslts) {
totalResults += i.intValue();
}
LogWriterUtils.getLogWriter().fine("Index Info result size is " + totalResults);
assertEquals(results, totalResults);
}
};
AsyncInvocation asyncInv = vm.invokeAsync(testQueryVerbose);
return asyncInv;
}
Aggregations