use of com.hazelcast.simulator.utils.AssertTask in project hazelcast-simulator by hazelcast.
the class PerformanceMonitorTest method test_whenTestRunning_thenSendPerformanceStats.
@Test
public void test_whenTestRunning_thenSendPerformanceStats() {
performanceMonitor.start();
sleepMillis(300);
DummyTest test = new DummyTest();
TestContext testContext = addTest(test);
Thread runTestThread = new RunTestThread();
runTestThread.start();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertPerfStatsSend();
}
});
testContext.stop();
joinThread(runTestThread);
performanceMonitor.close();
}
use of com.hazelcast.simulator.utils.AssertTask 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.utils.AssertTask in project hazelcast-simulator by hazelcast.
the class MapTTLTest method globalVerify.
@Verify
public void globalVerify() {
MapOperationCounter total = new MapOperationCounter();
for (MapOperationCounter counter : results) {
total.add(counter);
}
logger.info(name + ": " + total + " total of " + results.size());
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(name + ": Map should be empty, some TTL events are not processed", 0, map.size());
}
});
}
use of com.hazelcast.simulator.utils.AssertTask in project hazelcast-simulator by hazelcast.
the class ReplicatedTTL method localVerify.
@Verify(global = false)
public void localVerify() {
MapOperationCounter total = new MapOperationCounter();
for (MapOperationCounter counter : results) {
total.add(counter);
}
logger.info(name + ": " + total + " total of " + results.size());
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
logger.info(name + ": " + "assert map Size = " + map.size());
assertEquals(name + ": Replicated Map should be empty, some TTL events are not processed", 0, map.size());
}
});
}
use of com.hazelcast.simulator.utils.AssertTask in project hazelcast-simulator by hazelcast.
the class ReliableTopicTest method verify.
@Verify(global = true)
public void verify() {
final long expectedCount = listenersPerTopic * totalMessagesSend.get();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
long actualCount = 0;
for (MessageListenerImpl topicListener : listeners) {
actualCount += topicListener.received.get();
}
assertEquals("published messages don't match received messages", expectedCount, actualCount);
}
});
assertEquals("Failures found", 0, failures.get());
}
Aggregations