use of com.hp.mwtests.ts.txoj.common.exceptions.TestException in project narayana by jbosstm.
the class PerformanceTest1 method persistentTest.
@Test
public void persistentTest() {
long iters = 4;
AtomicObject foo = new AtomicObject();
AtomicAction A = new AtomicAction();
long t1 = System.currentTimeMillis();
A.begin();
try {
for (int c = 0; c < iters; c++) {
foo.set(2);
}
} catch (TestException e) {
fail("AtomicObject exception raised.");
}
A.commit();
reportThroughput("persistentTest", iters, t1);
}
use of com.hp.mwtests.ts.txoj.common.exceptions.TestException in project narayana by jbosstm.
the class AtomicTest method run.
@Test
public void run() {
AtomicObject foo = new AtomicObject();
Uid u = foo.get_uid();
AtomicAction A = new AtomicAction();
try {
A.begin();
foo.set(2);
A.commit();
int finalVal = foo.get();
assertEquals(2, finalVal);
foo = new AtomicObject(u);
A = new AtomicAction();
A.begin();
foo.set(4);
A.commit();
finalVal = foo.get();
assertEquals(4, finalVal);
} catch (TestException e) {
A.abort();
fail("AtomicObject exception raised.");
}
}
Aggregations