use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class LockManagerUnitTest method test.
@Test
public void test() throws Throwable {
AtomicObject obj = new AtomicObject();
obj = new AtomicObject();
assertTrue(obj.releaselock(new Uid()));
assertEquals(obj.setlock(null), LockResult.REFUSED);
obj.print(new PrintWriter(new ByteArrayOutputStream()));
obj.printState(new PrintWriter(new ByteArrayOutputStream()));
assertEquals(new DummyLockManager().type(), "StateManager/LockManager");
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class DestroyTest method test.
@Test
public void test() throws TestException {
AtomicObject atomicObject = new AtomicObject();
Uid u = atomicObject.get_uid();
AtomicAction a = new AtomicAction();
a.begin();
atomicObject.set(10);
assertTrue(atomicObject.destroy());
a.commit();
atomicObject = new AtomicObject(u);
int val;
try {
val = atomicObject.get();
} catch (final TestException ex) {
// activate should fail so setlock should fail
// differentiate between -1
val = -2;
}
assertEquals(-2, val);
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class SharedHammer method main.
public static void main(String[] args) {
boolean creator = true;
Uid id = null;
for (int i = 0; i < args.length; i++) {
if ("-object".equals(args[i])) {
creator = false;
id = new Uid(args[i + 1]);
}
}
if (creator) {
HammerThreadedObject.object = new AtomicObject();
System.out.println("Object created with id: " + HammerThreadedObject.object);
} else
HammerThreadedObject.object = new AtomicObject(id);
HammerThreadedObject object1 = new HammerThreadedObject(1);
object1.start();
try {
object1.join();
} catch (InterruptedException e) {
}
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class ObjectModelTest method testSINGLE.
@Test
public void testSINGLE() throws IOException, TestException {
AtomicObject obj = new AtomicObject(ObjectModel.SINGLE);
AtomicAction A = new AtomicAction();
A.begin();
obj.set(1234);
A.commit();
assertEquals(1234, obj.get());
}
use of com.hp.mwtests.ts.txoj.common.resources.AtomicObject in project narayana by jbosstm.
the class RecoveryModuleUnitTest method test.
@Test
public void test() throws Exception {
DummyTOModule trm = new DummyTOModule();
AtomicAction A = new AtomicAction();
trm.intialise();
A.begin();
AtomicObject obj = new AtomicObject();
OutputObjectState os = new OutputObjectState();
Uid u = new Uid();
assertTrue(obj.save_state(os, ObjectType.ANDPERSISTENT));
assertTrue(StoreManager.getParticipantStore().write_uncommitted(u, obj.type(), os));
A.abort();
trm.periodicWorkFirstPass();
trm.periodicWorkSecondPass();
}
Aggregations