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);
}
}
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);
}
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));
}
}
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));
}
}
});
}
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");
}
Aggregations