Search in sources :

Example 1 with IndexInfo

use of org.apache.geode.cache.query.internal.IndexTrackingQueryObserver.IndexInfo 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;
}
Also used : IndexTrackingQueryObserver(org.apache.geode.cache.query.internal.IndexTrackingQueryObserver) QueryObserver(org.apache.geode.cache.query.internal.QueryObserver) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) IndexInfo(org.apache.geode.cache.query.internal.IndexTrackingQueryObserver.IndexInfo) AsyncInvocation(org.apache.geode.test.dunit.AsyncInvocation)

Aggregations

IndexTrackingQueryObserver (org.apache.geode.cache.query.internal.IndexTrackingQueryObserver)1 IndexInfo (org.apache.geode.cache.query.internal.IndexTrackingQueryObserver.IndexInfo)1 QueryObserver (org.apache.geode.cache.query.internal.QueryObserver)1 AsyncInvocation (org.apache.geode.test.dunit.AsyncInvocation)1 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)1 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)1