@Override
      public void run2() throws CacheException {
        // 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[] cqListener = cqAttr.getCqListeners();
        CqQueryTestListener listener = (CqQueryTestListener) cqListener[0];

        switch (event) {
          case CREATE:
            listener.waitForCreated(key);
            break;

          case UPDATE:
            listener.waitForUpdated(key);
            break;

          case DESTROY:
            listener.waitForDestroyed(key);
            break;

          case INVALIDATE:
            listener.waitForInvalidated(key);
            break;

          case CLOSE:
            listener.waitForClose();
            break;

          case REGION_CLEAR:
            listener.waitForRegionClear();
            break;

          case REGION_INVALIDATE:
            listener.waitForRegionInvalidate();
            break;
        }
      }
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