use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.
the class ListenerICacheTest method globalVerify.
@Verify
public void globalVerify() {
ThreadState totalCounter = new ThreadState();
for (ThreadState counter : results) {
totalCounter.add(counter);
}
logger.info(name + " " + totalCounter + " from " + results.size() + " Worker threads");
ICacheEntryListener totalEvents = new ICacheEntryListener();
for (ICacheEntryListener entryListener : listeners) {
totalEvents.add(entryListener);
}
logger.info(name + " totalEvents: " + totalEvents);
assertEquals(name + " unexpected events found", 0, totalEvents.getUnexpected());
}
use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.
the class ReadWriteICacheTest method globalVerify.
@Verify(global = true)
public void globalVerify() {
ICacheReadWriteCounter total = new ICacheReadWriteCounter();
for (ICacheReadWriteCounter counter : counters) {
total.add(counter);
}
logger.info(name + ": " + total + " from " + counters.size() + " worker threads");
}
use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.
the class LeaseLockTest method verify.
@Verify
public void verify() {
for (int i = 0; i < lockCount; i++) {
ILock lock = targetInstance.getLock(name + i);
boolean isLocked = lock.isLocked();
long remainingLeaseTime = lock.getRemainingLeaseTime();
if (isLocked) {
String message = format("%s is locked with remainingLeaseTime: %d ms", lock, remainingLeaseTime);
if (allowZeroMillisRemainingLeaseLockTime && remainingLeaseTime == 0) {
logger.warn(message);
} else {
fail(message);
}
}
if (remainingLeaseTime > 0) {
fail(format("%s has remainingLeaseTime: %d ms", lock, remainingLeaseTime));
}
}
}
use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.
the class AsyncAtomicLongTest method verify.
@Verify
public void verify() {
if (isClient(targetInstance)) {
return;
}
final String serviceName = totalCounter.getServiceName();
final long expected = totalCounter.get();
// since the operations are asynchronous, we have no idea when they complete
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
// hack to prevent overloading the system with get calls, else it is done many times a second
sleepSeconds(10);
long actual = 0;
for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) {
String key = distributedObject.getName();
if (serviceName.equals(distributedObject.getServiceName()) && key.startsWith(name)) {
actual += targetInstance.getAtomicLong(key).get();
}
}
assertEquals(expected, actual);
}
}, assertEventuallySeconds);
}
use of com.hazelcast.simulator.test.annotations.Verify in project hazelcast-simulator by hazelcast.
the class LockTest method verify.
@Verify
public void verify() {
long actual = 0;
for (long i = 0; i < lockCounter.get(); i++) {
ILock lock = targetInstance.getLock(getLockId(i));
assertFalse("Lock should be unlocked", lock.isLocked());
long accountAmount = targetInstance.getAtomicLong(getAccountId(i)).get();
assertTrue("Amount on account can't be smaller than 0", accountAmount >= 0);
actual += accountAmount;
}
long expected = initialAmount * lockCounter.get();
assertEquals(format("%s: Money was lost or created (%d)", name, expected - actual), expected, actual);
}
Aggregations