Search in sources :

Example 6 with LocalReplicatedMapStats

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

the class ReplicatedMapStatsTest method testPutOperationCount.

@Test
public void testPutOperationCount() throws Exception {
    ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
    int count = 100;
    for (int i = 0; i < count; i++) {
        replicatedMap.put(i, i);
    }
    LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
    assertEquals(count, stats.getPutOperationCount());
}
Also used : LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with LocalReplicatedMapStats

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

the class ReplicatedMapStatsTest method testPutAndHitsGenerated.

@Test
public void testPutAndHitsGenerated() throws Exception {
    ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
    for (int i = 0; i < 100; i++) {
        replicatedMap.put(i, i);
        replicatedMap.get(i);
    }
    LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
    assertEquals(100, stats.getHits());
}
Also used : LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with LocalReplicatedMapStats

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

the class ReplicatedMapStatsTest method testLastAccessTime_updatedConcurrently.

@Test
public void testLastAccessTime_updatedConcurrently() throws InterruptedException {
    final long startTime = Clock.currentTimeMillis();
    final ReplicatedMap<String, String> map = getReplicatedMap();
    final String key = "key";
    map.put(key, "value");
    map.get(key);
    final LocalReplicatedMapStats stats = map.getReplicatedMapStats();
    final long lastAccessTime = stats.getLastAccessTime();
    new Thread(new Runnable() {

        @Override
        public void run() {
            sleepAtLeastMillis(1);
            map.get(key);
            // causes the local stats object to update
            map.getReplicatedMapStats();
        }
    }).start();
    assertTrue(lastAccessTime >= startTime);
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            assertTrue(stats.getLastAccessTime() >= lastAccessTime);
        }
    });
}
Also used : AssertTask(com.hazelcast.test.AssertTask) LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with LocalReplicatedMapStats

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

the class ReplicatedMapStatsTest method testRemoveOperationCount.

@Test
public void testRemoveOperationCount() throws Exception {
    ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
    int count = 100;
    for (int i = 0; i < count; i++) {
        replicatedMap.put(i, i);
        replicatedMap.remove(i);
    }
    LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
    assertEquals(count, stats.getRemoveOperationCount());
}
Also used : LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with LocalReplicatedMapStats

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

the class ReplicatedMapStatsTest method testHitsGenerated.

@Test
public void testHitsGenerated() throws Exception {
    ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
    for (int i = 0; i < 100; i++) {
        replicatedMap.put(i, i);
        replicatedMap.get(i);
    }
    LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
    assertEquals(100, stats.getHits());
}
Also used : LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

LocalReplicatedMapStats (com.hazelcast.monitor.LocalReplicatedMapStats)11 ParallelTest (com.hazelcast.test.annotation.ParallelTest)10 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Test (org.junit.Test)10 AssertTask (com.hazelcast.test.AssertTask)4 JsonArray (com.eclipsesource.json.JsonArray)1 JsonObject (com.eclipsesource.json.JsonObject)1 JsonValue (com.eclipsesource.json.JsonValue)1 ClientEndPointDTO (com.hazelcast.internal.management.dto.ClientEndPointDTO)1 ClusterHotRestartStatusDTO (com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO)1 MXBeansDTO (com.hazelcast.internal.management.dto.MXBeansDTO)1 LocalCacheStats (com.hazelcast.monitor.LocalCacheStats)1 LocalWanStats (com.hazelcast.monitor.LocalWanStats)1 HashMap (java.util.HashMap)1