Search in sources :

Example 1 with MapStoreWithCounter

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));
            }
        }
    });
}
Also used : AssertTask(com.hazelcast.simulator.utils.AssertTask) MapStoreConfig(com.hazelcast.config.MapStoreConfig) MapStoreWithCounter(com.hazelcast.simulator.tests.map.helpers.MapStoreWithCounter) Verify(com.hazelcast.simulator.test.annotations.Verify)

Aggregations

MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 Verify (com.hazelcast.simulator.test.annotations.Verify)1 MapStoreWithCounter (com.hazelcast.simulator.tests.map.helpers.MapStoreWithCounter)1 AssertTask (com.hazelcast.simulator.utils.AssertTask)1