/** * Hydra task to verify queries on the region after all ops. This MUST be called as a batched * task, and will throw StopSchedulingTaskOnClientOrder when completed. It is necessary to * reinitialize the verify state variables if this is called a second time in this VM, however an * error is thrown if a second attempt it made without resetting the state variables. */ public static void HydraTask_verifyQueries() { if (CQsOn) { // the region contents verify task comes first, so if we got to this // task, then we know the the region is a perfect snapshot of what // we expect; the CQTestInstance relies on a snapshot if (verifyQueryIterator == null) { testInstance.CQTestInstance.regionSnapshot = new HashMap(testInstance.aRegion); verifyQueryIterator = testInstance.queryMap.keySet().iterator(); } if (verifyQueryIterator.hasNext()) { verifyQueryCount++; String cqName = (String) (verifyQueryIterator.next()); Log.getLogWriter() .info( "Verifying query " + verifyQueryCount + " out of " + testInstance.queryMap.size() + " with name " + cqName); testInstance.CQTestInstance.verifyQuery(cqName); } else { String aStr = "Done verifying " + verifyQueryCount + " queries"; Log.getLogWriter().info(aStr); // set for next time; if this is an init task, then we will be set for the close task verifyQueryIterator = null; verifyQueryCount = 0; throw new StopSchedulingTaskOnClientOrder(aStr); } } else { String aStr = "Skipping verification of queries because CQUtilPrms.CQsOn is " + CQsOn; Log.getLogWriter().info(aStr); throw new StopSchedulingTaskOnClientOrder(aStr); } }
/** * Verify all queries by combining the results of executeWithInitialResults and subsequent * cqEvents. */ private void verifyQueriesCombine() { if (CQsOn) { // the region contents verify task comes first, so if we got to this // task, then we know the the region is a perfect snapshot of what // we expect; the CQTestInstance relies on a snapshot testInstance.CQTestInstance.regionSnapshot = new HashMap(testInstance.aRegion); verifyQueryResultsCombine(); } else { Log.getLogWriter() .info("Skipping verification of queries because CQUtilPrms.CQsOn is " + CQsOn); } }