use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.
the class ClientMapTest method testMapSetAsyncStatistics.
@Test
public void testMapSetAsyncStatistics() {
final String name = randomString();
IMap<Integer, Integer> map = client.getMap(name);
final int operationCount = 127;
for (int i = 0; i < operationCount; i++) {
map.setAsync(i, i);
map.remove(i);
}
assertTrueEventually(() -> {
LocalMapStats localMapStats = server.getMap(name).getLocalMapStats();
assertEquals("put count", 0, localMapStats.getPutOperationCount());
assertEquals("set count", operationCount, localMapStats.getSetOperationCount());
assertEquals("get count", 0, localMapStats.getGetOperationCount());
assertEquals("remove count", operationCount, localMapStats.getRemoveOperationCount());
assertTrue("set latency", localMapStats.getTotalSetLatency() > 0);
assertTrue("max set latency", localMapStats.getMaxSetLatency() > 0);
});
}
use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.
the class ClientMapTest method testMapSetAsyncWithTtlAndMaxIdleStatistics.
@Test
public void testMapSetAsyncWithTtlAndMaxIdleStatistics() {
final String name = randomString();
IMap<Integer, Integer> map = client.getMap(name);
final int operationCount = 467;
for (int i = 0; i < operationCount; i++) {
map.setAsync(i, i, 1, TimeUnit.MINUTES, 1, TimeUnit.MINUTES);
map.remove(i);
}
assertTrueEventually(() -> {
LocalMapStats localMapStats = server.getMap(name).getLocalMapStats();
assertEquals("put count", 0, localMapStats.getPutOperationCount());
assertEquals("set count", operationCount, localMapStats.getSetOperationCount());
assertEquals("get count", 0, localMapStats.getGetOperationCount());
assertEquals("remove count", operationCount, localMapStats.getRemoveOperationCount());
assertTrue("set latency", localMapStats.getTotalSetLatency() > 0);
assertTrue("max set latency", localMapStats.getMaxSetLatency() > 0);
});
}
use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.
the class ClientMultiMapStatsTest method testPutAllAndHitsGeneratedTemplateVerify.
@Override
public void testPutAllAndHitsGeneratedTemplateVerify() {
LocalMapStats localMapStats1 = getMultiMapStats();
LocalMapStats localMapStats2 = getMultiMapStats(mapNameSet);
assertEquals(300, localMapStats1.getOwnedEntryCount());
assertEquals(100, localMapStats1.getHits());
assertEquals(100, localMapStats2.getOwnedEntryCount());
assertEquals(100, localMapStats2.getHits());
}
use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.
the class NearCacheTest method testNullValueNearCache.
// issue 1570
@Test
public void testNullValueNearCache() {
int clusterSize = 2;
String mapName = "testNullValueNearCache";
Config config = getConfig();
config.getMapConfig(mapName).setNearCacheConfig(newNearCacheConfig());
HazelcastInstance instance = createHazelcastInstanceFactory(clusterSize).newInstances(config)[0];
IMap<String, String> map = instance.getMap(mapName);
for (int i = 0; i < MAX_CACHE_SIZE; i++) {
assertNull(map.get("key" + i));
}
for (int i = 0; i < MAX_CACHE_SIZE; i++) {
assertNull(map.get("key" + i));
}
LocalMapStats stats = map.getLocalMapStats();
assertTrue(format("Near Cache operation count should be < %d but was %d", MAX_CACHE_SIZE * 2, stats.getGetOperationCount()), stats.getGetOperationCount() < MAX_CACHE_SIZE * 2);
}
use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.
the class MapCreationDelayWithMapStoreTest method testMapCreation__notAffectedByUnresponsiveLoader.
@Test(timeout = 120000)
public void testMapCreation__notAffectedByUnresponsiveLoader() {
final UnresponsiveLoader<Integer, Integer> unresponsiveLoader = new UnresponsiveLoader<Integer, Integer>();
final IMap<Integer, Integer> map = TestMapUsingMapStoreBuilder.<Integer, Integer>create().withMapStore(unresponsiveLoader).withNodeCount(1).withNodeFactory(createHazelcastInstanceFactory(1)).withPartitionCount(1).build();
final LocalMapStats stats = map.getLocalMapStats();
final long ownedEntryCount = stats.getOwnedEntryCount();
assertEquals(0, ownedEntryCount);
}
Aggregations