Search in sources :

Example 11 with NearCacheStats

use of com.hazelcast.nearcache.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.nearcache.NearCacheStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 12 with NearCacheStats

use of com.hazelcast.nearcache.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).toCompletableFuture();
        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.nearcache.NearCacheStats) Future(java.util.concurrent.Future) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 13 with NearCacheStats

use of com.hazelcast.nearcache.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.nearcache.NearCacheStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 14 with NearCacheStats

use of com.hazelcast.nearcache.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.nearcache.NearCacheStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 15 with NearCacheStats

use of com.hazelcast.nearcache.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);
    assertEquals(size, stats.getOwnedEntryCount());
    assertEquals(size, stats.getHits());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NearCacheStats(com.hazelcast.nearcache.NearCacheStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Aggregations

NearCacheStats (com.hazelcast.nearcache.NearCacheStats)31 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)22 QuickTest (com.hazelcast.test.annotation.QuickTest)22 Test (org.junit.Test)22 NightlyTest (com.hazelcast.test.annotation.NightlyTest)8 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)8 NearCacheConfig (com.hazelcast.config.NearCacheConfig)5 NearCache (com.hazelcast.internal.nearcache.NearCache)5 TransactionContext (com.hazelcast.transaction.TransactionContext)5 Config (com.hazelcast.config.Config)3 MapConfig (com.hazelcast.config.MapConfig)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 IMap (com.hazelcast.map.IMap)2 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)1 NearCacheStatsImpl (com.hazelcast.internal.monitor.impl.NearCacheStatsImpl)1 DefaultNearCache (com.hazelcast.internal.nearcache.impl.DefaultNearCache)1 NearCacheTestUtils.getRecordFromNearCache (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getRecordFromNearCache)1 NearCacheTestUtils.getValueFromNearCache (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getValueFromNearCache)1 LocalMapStats (com.hazelcast.map.LocalMapStats)1 LocalIndexStats (com.hazelcast.query.LocalIndexStats)1