use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class HeuristicNotificationUnitTest method test.
@Test
public void test() throws Exception {
AtomicAction A = new AtomicAction();
DummyHeuristic dh = new DummyHeuristic();
A.begin();
A.add(new BasicRecord());
A.add(new BasicRecord());
A.add(new HeuristicRecord());
A.addSynchronization(dh);
A.commit(false);
assertEquals(TwoPhaseOutcome.HEURISTIC_MIXED, dh.getStatus());
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class AtomicActionUnitTest method testNested.
@Test
public void testNested() throws Exception {
AtomicAction A = new AtomicAction();
AtomicAction B = new AtomicAction();
A.begin();
B.begin();
assertTrue(A.childTransactions().length == 1);
B.commit();
A.abort();
assertEquals(A.deactivate(), true);
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class AtomicActionUnitTest method testBasic.
@Test
public void testBasic() throws Exception {
AtomicAction A = new AtomicAction();
A.begin();
assertEquals(A.hierarchyDepth(), 1);
assertEquals(A.topLevelActionUid(), A.get_uid());
A.end(true);
assertEquals(A.status(), ActionStatus.COMMITTED);
assertEquals(A.getTimeout(), AtomicAction.NO_TIMEOUT);
assertTrue(BasicAction.Current() != null);
ThreadActionData.purgeActions();
assertEquals(BasicAction.Current(), null);
assertTrue(A.type() != null);
assertTrue(BasicAction.maintainHeuristics());
assertTrue(A.destroy());
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class AtomicActionUnitTest method testCanCommitSuspendedTransaction.
@Test
public void testCanCommitSuspendedTransaction() throws Exception {
AtomicAction aa = new AtomicAction();
aa.begin();
assertTrue(aa.Current() != null);
aa.suspend();
assertTrue(aa.Current() == null);
SimpleAbstractRecord simpleAbstractRecord = new SimpleAbstractRecord();
aa.add(simpleAbstractRecord);
aa.commit();
assertTrue(simpleAbstractRecord.wasCommitted());
}
use of com.arjuna.ats.arjuna.AtomicAction in project narayana by jbosstm.
the class AtomicActionUnitTest method testThreading.
@Test
public void testThreading() throws Exception {
AtomicAction A = new AtomicAction();
A.begin();
assertEquals(A.status(), ActionStatus.RUNNING);
assertTrue(A.addChildThread());
A.addThread();
A.addThread(new Thread());
assertEquals(A.activeThreads(), 1);
A.removeChildThread();
assertEquals(A.activeThreads(), 0);
A.commit(true);
assertEquals(A.status(), ActionStatus.COMMITTED);
ThreadActionData.purgeActions();
}
Aggregations