use of com.hazelcast.simulator.tests.helpers.TxnCounter in project hazelcast-simulator by hazelcast.
the class MapTransactionGetForUpdateTest method verify.
@Verify(global = false)
public void verify() {
IList<TxnCounter> counts = targetInstance.getList(name + "report");
TxnCounter total = new TxnCounter();
for (TxnCounter c : counts) {
total.add(c);
}
logger.info(name + ": " + total + " from " + counts.size() + " workers");
IList<long[]> allIncrements = targetInstance.getList(name + "res");
long[] expected = new long[keyCount];
for (long[] incs : allIncrements) {
for (int i = 0; i < incs.length; i++) {
expected[i] += incs[i];
}
}
IMap<Integer, Long> map = targetInstance.getMap(name);
int failures = 0;
for (int i = 0; i < keyCount; i++) {
if (expected[i] != map.get(i)) {
failures++;
logger.info(name + ": key=" + i + " expected " + expected[i] + " != " + "actual " + map.get(i));
}
}
assertEquals(name + ": " + failures + " key=>values have been incremented unExpected", 0, failures);
}
use of com.hazelcast.simulator.tests.helpers.TxnCounter in project hazelcast-simulator by hazelcast.
the class MapTransactionContextConflictTest method verify.
@Verify(global = false)
public void verify() {
IList<TxnCounter> counts = targetInstance.getList(name + "count");
TxnCounter total = new TxnCounter();
for (TxnCounter c : counts) {
total.add(c);
}
logger.info(name + ": " + total + " from " + counts.size() + " worker threads");
IList<long[]> allIncrements = targetInstance.getList(name + "inc");
long[] expected = new long[keyCount];
for (long[] incs : allIncrements) {
for (int i = 0; i < incs.length; i++) {
expected[i] += incs[i];
}
}
IMap<Integer, Long> map = targetInstance.getMap(name);
int failures = 0;
for (int i = 0; i < keyCount; i++) {
if (expected[i] != map.get(i)) {
failures++;
logger.info(name + ": key=" + i + " expected " + expected[i] + " != " + "actual " + map.get(i));
}
}
assertEquals(name + ": " + failures + " key=>values have been incremented unExpected", 0, failures);
}
use of com.hazelcast.simulator.tests.helpers.TxnCounter in project hazelcast-simulator by hazelcast.
the class TxnQueueWithLockTest method globalVerify.
@Verify
public void globalVerify() {
IQueue queue = targetInstance.getQueue(name + 'q');
IList<TxnCounter> results = targetInstance.getList(name + "results");
TxnCounter total = new TxnCounter();
for (TxnCounter counter : results) {
total.add(counter);
}
logger.info(name + ": " + total + " from " + results.size() + " worker Threads Queue size=" + queue.size());
assertFalse(name + ": firstLock.isLocked()", firstLock.isLocked());
assertFalse(name + ": secondLock.isLocked()", secondLock.isLocked());
// TODO: check if this assert can be re-enabled: assertEquals(total.committed - total.rolled, queue.size())
}
Aggregations