use of com.hazelcast.simulator.tests.map.helpers.MapStoreWithCounter in project hazelcast-simulator by hazelcast.
the class MapStoreTest method verify.
@Verify(global = false)
public void verify() {
if (isClient(targetInstance)) {
return;
}
MapStoreConfig mapStoreConfig = targetInstance.getConfig().getMapConfig(name).getMapStoreConfig();
int writeDelayMs = (int) TimeUnit.SECONDS.toMillis(mapStoreConfig.getWriteDelaySeconds());
int sleepMs = mapStoreMaxDelayMs * 2 + maxTTLExpiryMs * 2 + (writeDelayMs * 2);
logger.info("Sleeping for " + TimeUnit.MILLISECONDS.toSeconds(sleepMs) + " seconds to wait for delay and TTL values.");
sleepMillis(sleepMs);
final MapStoreWithCounter mapStore = (MapStoreWithCounter) mapStoreConfig.getImplementation();
logger.info(name + ": map size = " + map.size());
logger.info(name + ": map store = " + mapStore);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
for (Integer key : map.localKeySet()) {
assertEquals(map.get(key), mapStore.get(key));
}
assertEquals("Map entrySets should be equal", map.getAll(map.localKeySet()).entrySet(), mapStore.entrySet());
for (int key = putTTlKeyDomain; key < putTTlKeyDomain + putTTlKeyRange; key++) {
assertNull(name + ": TTL key should not be in the map", map.get(key));
}
}
});
}
Aggregations