@Override
      public void run2() throws CacheException {
        LogWriterUtils.getLogWriter().info("### Validating CQ. ### " + cqName);
        // Get CQ Service.
        QueryService cqService = null;
        try {
          cqService = getCache().getQueryService();
        } catch (Exception cqe) {
          Assert.fail("Failed to getCQService.", cqe);
        }

        CqQuery cQuery = cqService.getCq(cqName);
        if (cQuery == null) {
          fail("Failed to get CqQuery for CQ : " + cqName);
        }

        CqAttributes cqAttr = cQuery.getCqAttributes();
        CqListener[] cqListeners = cqAttr.getCqListeners();
        CqQueryTestListener listener = (CqQueryTestListener) cqListeners[0];
        listener.printInfo(false);

        // Wait for expected events to arrive at Listener.
        listener.waitForEvents(creates, updates, deletes, queryInserts, queryUpdates, queryDeletes,
            totalEvents);

        // Check for totalEvents count.
        if (totalEvents != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Total Event Count mismatch", totalEvents, listener.getTotalEventCount());
        }

        if (resultSize != noTest) {
          // SelectResults results = cQuery.getCqResults();
          // getLogWriter().info("### CQ Result Size is :" + results.size());
          // Result size validation.
          // Since ResultSet is not maintained for this release.
          // Instead of resultSize its been validated with total number of events.
          fail("test for event counts instead of results size");
        }

        // Check for create count.
        if (creates != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Create Event mismatch", creates, listener.getCreateEventCount());
        }

        // Check for update count.
        if (updates != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Update Event mismatch", updates, listener.getUpdateEventCount());
        }

        // Check for delete count.
        if (deletes != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Delete Event mismatch", deletes, listener.getDeleteEventCount());
        }

        // Check for queryInsert count.
        if (queryInserts != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Query Insert Event mismatch", queryInserts,
              listener.getQueryInsertEventCount());
        }

        // Check for queryUpdate count.
        if (queryUpdates != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Query Update Event mismatch", queryUpdates,
              listener.getQueryUpdateEventCount());
        }

        // Check for queryDelete count.
        if (queryDeletes != noTest) {
          // Result size validation.
          // listener.printInfo(true);
          assertEquals("Query Delete Event mismatch", queryDeletes,
              listener.getQueryDeleteEventCount());
        }
      }
Throws AssertionError if the CQ can be found or if any other error occurs
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java