@Test
  public void testCQLeakWithPartitionedRegion() throws Exception {
    // creating servers.
    final Host host = Host.getHost(0);
    VM server1 = host.getVM(0);
    VM server2 = host.getVM(1);
    VM client = host.getVM(2);

    createServer(server1);
    createServer(server2);

    // create client

    final int port = server1.invoke(PartitionedRegionCqQueryDUnitTest::getCacheServerPort);
    final String host0 = NetworkUtils.getServerHostName(server1.getHost());

    createClient(client, port, host0);

    // register cq.
    createCQ(client, "testCQEvents_0", cqs[0]);
    cqHelper.executeCQ(client, "testCQEvents_0", false, null);
    Wait.pause(2 * 1000);

    // create values
    int size = 40;
    createValues(server1, regions[0], size);

    // wait for last creates...

    cqHelper.waitForCreated(client, "testCQEvents_0", KEY + size);

    // validate cq..
    cqHelper.validateCQ(client, "testCQEvents_0", /* resultSize: */ CqQueryDUnitTest.noTest,
        /* creates: */ size, /* updates: */ 0, /* deletes; */ 0, /* queryInserts: */ size,
        /* queryUpdates: */ 0, /* queryDeletes: */ 0, /* totalEvents: */ size);

    int cc1 = server1.invoke(PartitionedRegionCqQueryDUnitTest::getCqCountFromRegionProfile);
    int cc2 = server2.invoke(PartitionedRegionCqQueryDUnitTest::getCqCountFromRegionProfile);
    assertEquals("Should have one", 1, cc1);
    assertEquals("Should have one", 1, cc2);

    server1.bounce();

    cqHelper.closeClient(client);
    Wait.pause(10 * 1000);
    cc2 = server2.invoke(PartitionedRegionCqQueryDUnitTest::getCqCountFromRegionProfile);

    // assertIndexDetailsEquals("Should have one", 0, cc1);
    assertEquals("Should have one", 0, cc2);

    cqHelper.closeServer(server2);
    // cqHelper.closeServer(server1);
  }
Test class for Partitioned Region and CQs

@since GemFire 5.5
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java