use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class ReactivateUnitTest method test.
@Test
public void test() {
try {
AtomicObject obj = new AtomicObject();
Uid objRef = obj.get_uid();
AtomicAction A = new AtomicAction();
A.begin();
obj.set(1234);
A.commit();
AtomicObject recObj = new AtomicObject(objRef);
AtomicAction B = new AtomicAction();
B.begin();
assertEquals(1234, recObj.get());
B.abort();
} catch (Exception ex) {
fail(ex.toString());
}
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class LockConflictUnitTest method testAtomicObject.
@Test
public void testAtomicObject() throws Exception {
HammerThreadedObject.object = new AtomicObject();
HammerThreadedObject object1 = new HammerThreadedObject(2);
HammerThreadedObject object2 = new HammerThreadedObject(-2);
HammerThreadedObject.object.setRetry(2);
object1.start();
object2.start();
try {
object1.join();
object2.join();
} catch (InterruptedException e) {
}
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class ObjectModelTest method testMULTIPLE.
@Test
public void testMULTIPLE() throws IOException, TestException {
AtomicObject obj1 = new AtomicObject(ObjectModel.MULTIPLE);
AtomicObject obj2 = new AtomicObject(obj1.get_uid(), ObjectModel.MULTIPLE);
AtomicAction A = new AtomicAction();
A.begin();
obj1.set(1234);
A.commit();
assertEquals(1234, obj2.get());
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class PerformanceTest2 method persistentTest.
@Test
public void persistentTest() {
long iters = 1000;
AtomicObject foo = new AtomicObject();
AtomicAction A = null;
long t1 = System.currentTimeMillis();
try {
for (int c = 0; c < iters; c++) {
A = new AtomicAction();
A.begin();
foo.set(2);
A.commit();
}
} catch (TestException e) {
if (A != null)
A.abort();
fail("AtomicObject exception raised.");
}
reportThroughput("persistentTest", iters, t1);
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class Hammer method test.
@Test
public void test() {
HammerThreadedObject.object = new AtomicObject();
HammerThreadedObject object1 = new HammerThreadedObject(2);
HammerThreadedObject object2 = new HammerThreadedObject(-2);
object1.start();
object2.start();
try {
object1.join();
object2.join();
} catch (InterruptedException e) {
}
}
Aggregations