Search in sources :

Example 1 with Verify

use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.

the class MapEntryListenerTest method globalVerify.

@Verify
public void globalVerify() {
    for (int i = 0; i < listeners.size() - 1; i++) {
        EntryListenerImpl a = listeners.get(i);
        EntryListenerImpl b = listeners.get(i + 1);
        assertEquals(name + ": not same amount of event in all listeners", a, b);
    }
}
Also used : EntryListenerImpl(com.hazelcast.simulator.tests.map.helpers.EntryListenerImpl) Verify(com.hazelcast.simulator.test.annotations.Verify)

Example 2 with Verify

use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.

the class MapEntryListenerTest method verify.

@Verify(global = false)
public void verify() {
    EventCount total = new EventCount();
    for (EventCount eventCount : eventCounts) {
        total.add(eventCount);
    }
    total.waitWhileListenerEventsIncrease(listener, 10);
    logger.info(format("Event counter for %s (actual / expected)" + "%n add: %d / %d" + "%n update: %d / %d" + "%n remove: %d / %d" + "%n evict: %d / %d" + "%n mapSize: %d / %d", name, listener.addCount.get(), total.addCount.get(), listener.updateCount.get(), total.updateCount.get(), listener.removeCount.get(), total.removeCount.get(), listener.evictCount.get(), total.evictCount.get(), total.calculateMapSize(listener), total.calculateMapSize()));
    total.assertEventsEquals(listener);
}
Also used : EventCount(com.hazelcast.simulator.tests.map.helpers.EventCount) Verify(com.hazelcast.simulator.test.annotations.Verify)

Example 3 with Verify

use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.

the class MapEvictAndStoreTest method verify.

@Verify(global = false)
public void verify() {
    if (isClient(targetInstance)) {
        return;
    }
    MapConfig mapConfig = targetInstance.getConfig().getMapConfig(name);
    logger.info(name + ": MapConfig: " + mapConfig);
    MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    logger.info(name + ": MapStoreConfig: " + mapStoreConfig);
    int sleepSeconds = mapConfig.getTimeToLiveSeconds() * 2 + mapStoreConfig.getWriteDelaySeconds() * 2;
    logger.info("Sleeping for " + sleepSeconds + " seconds to wait for delay and TTL values.");
    sleepSeconds(sleepSeconds);
    MapStoreWithCounterPerKey mapStore = (MapStoreWithCounterPerKey) mapStoreConfig.getImplementation();
    logger.info(name + ": map size = " + map.size());
    logger.info(name + ": map store = " + mapStore);
    logger.info(name + ": Checking if some keys where stored more than once");
    for (Object key : mapStore.keySet()) {
        assertEquals("There were multiple calls to MapStore.store", 1, mapStore.valueOf(key));
    }
}
Also used : MapStoreWithCounterPerKey(com.hazelcast.simulator.tests.map.helpers.MapStoreWithCounterPerKey) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Verify(com.hazelcast.simulator.test.annotations.Verify)

Example 4 with Verify

use of com.hazelcast.simulator.test.annotations.Verify 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)

Example 5 with Verify

use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.

the class MapStoreTest method globalVerify.

@Verify
public void globalVerify() {
    MapOperationCounter total = new MapOperationCounter();
    for (MapOperationCounter operationCounter : operationCounterList) {
        total.add(operationCounter);
    }
    logger.info(name + ": " + total + " from " + operationCounterList.size() + " worker threads");
}
Also used : MapOperationCounter(com.hazelcast.simulator.tests.map.helpers.MapOperationCounter) Verify(com.hazelcast.simulator.test.annotations.Verify)

Aggregations

Verify (com.hazelcast.simulator.test.annotations.Verify)31 AssertTask (com.hazelcast.simulator.utils.AssertTask)7 ILock (com.hazelcast.core.ILock)4 MapOperationCounter (com.hazelcast.simulator.tests.map.helpers.MapOperationCounter)4 TxnCounter (com.hazelcast.simulator.tests.helpers.TxnCounter)3 MapStoreConfig (com.hazelcast.config.MapStoreConfig)2 DistributedObject (com.hazelcast.core.DistributedObject)2 DistributedObjectDestroyedException (com.hazelcast.spi.exception.DistributedObjectDestroyedException)2 CardinalityEstimator (com.hazelcast.cardinality.CardinalityEstimator)1 MapConfig (com.hazelcast.config.MapConfig)1 IAtomicLong (com.hazelcast.core.IAtomicLong)1 IQueue (com.hazelcast.core.IQueue)1 BaseThreadState (com.hazelcast.simulator.test.BaseThreadState)1 StopException (com.hazelcast.simulator.test.StopException)1 TestException (com.hazelcast.simulator.test.TestException)1 ICacheCreateDestroyCounter (com.hazelcast.simulator.tests.icache.helpers.ICacheCreateDestroyCounter)1 ICacheEntryListener (com.hazelcast.simulator.tests.icache.helpers.ICacheEntryListener)1 ICacheListenerOperationCounter (com.hazelcast.simulator.tests.icache.helpers.ICacheListenerOperationCounter)1 ICacheOperationCounter (com.hazelcast.simulator.tests.icache.helpers.ICacheOperationCounter)1 ICacheReadWriteCounter (com.hazelcast.simulator.tests.icache.helpers.ICacheReadWriteCounter)1