Search in sources :

Example 1 with ConnectionStats

use of org.apache.geode.cache.client.internal.ConnectionStats in project geode by apache.

the class DurableClientSimpleDUnitTest method verifyDurableCqs.

public static void verifyDurableCqs(final List<String> durableCqNames, final String registeredCqName) {
    // Verify the number of durable CQ names is one, and it matches the registered name
    assertEquals(1, durableCqNames.size());
    String returnedCqName = durableCqNames.get(0);
    assertEquals(registeredCqName, returnedCqName);
    // Get client's primary server
    PoolImpl pool = CacheServerTestUtil.getPool();
    ServerLocation primaryServerLocation = pool.getPrimary();
    // Verify the primary server was used and no other server was used
    Map<ServerLocation, ConnectionStats> statistics = pool.getEndpointManager().getAllStats();
    for (Map.Entry<ServerLocation, ConnectionStats> entry : statistics.entrySet()) {
        int expectedGetDurableCqInvocations = entry.getKey().equals(primaryServerLocation) ? 1 : 0;
        assertEquals(expectedGetDurableCqInvocations, entry.getValue().getGetDurableCqs());
    }
}
Also used : ServerLocation(org.apache.geode.distributed.internal.ServerLocation) ConnectionStats(org.apache.geode.cache.client.internal.ConnectionStats) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 ConnectionStats (org.apache.geode.cache.client.internal.ConnectionStats)1 PoolImpl (org.apache.geode.cache.client.internal.PoolImpl)1 ServerLocation (org.apache.geode.distributed.internal.ServerLocation)1