Search in sources :

Example 1 with NearCacheStats

use of com.hazelcast.monitor.NearCacheStats in project hazelcast by hazelcast.

the class ClientMapNearCacheTest method testGetAsync.

@Test
public void testGetAsync() throws Exception {
    IMap<Integer, Integer> map = getNearCachedMapFromClient(newNoInvalidationNearCacheConfig());
    int size = 1009;
    populateMap(map, size);
    populateNearCache(map, size);
    // generate Near Cache hits with async call
    for (int i = 0; i < size; i++) {
        Future future = map.getAsync(i);
        future.get();
    }
    NearCacheStats stats = getNearCacheStats(map);
    assertEquals(size, stats.getOwnedEntryCount());
    assertEquals(size, stats.getHits());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.monitor.NearCacheStats) Future(java.util.concurrent.Future) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with NearCacheStats

use of com.hazelcast.monitor.NearCacheStats in project hazelcast by hazelcast.

the class ClientMapNearCacheTest method testGetNearCacheStatsBeforePopulation.

@Test
public void testGetNearCacheStatsBeforePopulation() {
    IMap<Integer, Integer> map = getNearCachedMapFromClient(newNoInvalidationNearCacheConfig());
    int size = 101;
    for (int i = 0; i < size; i++) {
        map.put(i, i);
    }
    NearCacheStats stats = getNearCacheStats(map);
    assertNotNull(stats);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.monitor.NearCacheStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 3 with NearCacheStats

use of com.hazelcast.monitor.NearCacheStats in project hazelcast by hazelcast.

the class ClientMapNearCacheTest method testNearCachePopulatedAndHitsGenerated_withInterleavedCacheHitGeneration.

@Test
public void testNearCachePopulatedAndHitsGenerated_withInterleavedCacheHitGeneration() {
    IMap<Integer, Integer> map = getNearCachedMapFromClient(newNoInvalidationNearCacheConfig());
    int size = 1278;
    for (int i = 0; i < size; i++) {
        map.put(i, i);
        // populate Near Cache
        map.get(i);
        // generate Near Cache hits
        map.get(i);
    }
    NearCacheStats stats = getNearCacheStats(map);
    System.out.println("stats = " + stats);
    assertEquals(size, stats.getOwnedEntryCount());
    assertEquals(size, stats.getHits());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.monitor.NearCacheStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 4 with NearCacheStats

use of com.hazelcast.monitor.NearCacheStats in project hazelcast by hazelcast.

the class ClientMapNearCacheTest method testIssue2009.

@Test
public void testIssue2009() {
    IMap<Integer, Integer> map = getNearCachedMapFromClient(newInvalidationEnabledNearCacheConfig());
    NearCacheStats stats = getNearCacheStats(map);
    assertNotNull(stats);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.monitor.NearCacheStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 5 with NearCacheStats

use of com.hazelcast.monitor.NearCacheStats in project hazelcast by hazelcast.

the class ClientMapNearCacheTest method testMapRemove_WithNearCache.

@Test
public void testMapRemove_WithNearCache() {
    IMap<Integer, Integer> map = getNearCachedMapFromClient(newInvalidationEnabledNearCacheConfig());
    int size = 1113;
    populateMap(map, size);
    populateNearCache(map, size);
    for (int i = 0; i < size; i++) {
        map.remove(i);
    }
    NearCacheStats stats = getNearCacheStats(map);
    assertEquals(0, stats.getOwnedEntryCount());
    assertEquals(size, stats.getMisses());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.monitor.NearCacheStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

NearCacheStats (com.hazelcast.monitor.NearCacheStats)22 ParallelTest (com.hazelcast.test.annotation.ParallelTest)11 QuickTest (com.hazelcast.test.annotation.QuickTest)11 Test (org.junit.Test)11 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)9 NearCacheConfig (com.hazelcast.config.NearCacheConfig)4 NearCache (com.hazelcast.internal.nearcache.NearCache)3 AssertTask (com.hazelcast.test.AssertTask)3 Config (com.hazelcast.config.Config)2 EvictionConfig (com.hazelcast.config.EvictionConfig)2 MapConfig (com.hazelcast.config.MapConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 MapContainer (com.hazelcast.map.impl.MapContainer)1 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)1 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)1 NearCachedMapProxyImpl (com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl)1 LocalMapStats (com.hazelcast.monitor.LocalMapStats)1 LocalMapStatsImpl (com.hazelcast.monitor.impl.LocalMapStatsImpl)1 SerializationServiceSupport (com.hazelcast.spi.impl.SerializationServiceSupport)1 SerializationService (com.hazelcast.spi.serialization.SerializationService)1