public void registerInterestListCQ(VM vm, final String regionName, final int keySize,
      final boolean all) {
    vm.invoke(new CacheSerializableRunnable("Register InterestList and CQ") {
      @Override
      public void run2() throws CacheException {

        // Get CQ Service.
        Region region = null;
        try {
          region = getRootRegion().getSubregion(regionName);
          region.getAttributesMutator()
              .addCacheListener(new CertifiableTestCacheListener());
        } catch (Exception cqe) {
          fail("Failed to get Region.", cqe);
        }

        try {
          if (all) {
            region.registerInterest("ALL_KEYS");
          } else {
            List list = new ArrayList();
            for (int i = 1; i <= keySize; i++) {
              list.add(KEY + i);
            }
            region.registerInterest(list);
          }
        } catch (Exception ex) {
          fail("Failed to Register InterestList", ex);
        }
      }
    });
  }
Execute/register CQ as running.

@param initialResults true if initialResults are requested
@param expectedResultsSize if >= 0, validate results against this size
@param expectedErr if not null, an error we expect
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java