use of com.arjuna.ats.jts.extensions.TopLevelTransaction in project narayana by jbosstm.
the class TopLevelTransactionUnitTest method testSuspendResume.
@Test
public void testSuspendResume() throws Exception {
TopLevelTransaction A = new TopLevelTransaction();
A.begin();
assertTrue(A.control() != null);
A.suspend();
assertEquals(OTSImpleManager.current().get_control(), null);
A.resume();
assertTrue(OTSImpleManager.current() != null);
A.rollback();
}
use of com.arjuna.ats.jts.extensions.TopLevelTransaction in project narayana by jbosstm.
the class TopLevelTransactionUnitTest method test.
@Test
public void test() throws Exception {
TopLevelTransaction A = new TopLevelTransaction();
A.begin();
assertTrue(A.get_transaction_name() != null);
A.set_timeout(10);
assertEquals(A.get_timeout(), 10);
assertTrue(A.getTimeout() != -1);
assertTrue(A.get_txcontext() != null);
assertTrue(A.get_uid().notEquals(Uid.nullUid()));
assertTrue(A.control() != null);
assertFalse(A.equals(null));
assertTrue(A.equals(A));
assertFalse(A.equals(new TopLevelTransaction()));
A.rollback();
}
use of com.arjuna.ats.jts.extensions.TopLevelTransaction in project narayana by jbosstm.
the class TopLevelTransactionUnitTest method testRollback.
@Test
public void testRollback() throws Exception {
AtomicTransaction A = new AtomicTransaction();
A.begin();
assertTrue(A.get_txcontext() != null);
A.registerResource(new DemoResource().getResource());
TopLevelTransaction B = new TopLevelTransaction();
DemoResource d = new DemoResource();
B.begin();
B.registerResource(d.getResource());
B.commit(true);
A.rollback();
assertEquals(d.getResourceTrace().getTrace(), ResourceTrace.ResourceTraceCommitOnePhase);
}
use of com.arjuna.ats.jts.extensions.TopLevelTransaction in project narayana by jbosstm.
the class TopLevelTransactionUnitTest method testCommit.
@Test
public void testCommit() throws Exception {
AtomicTransaction A = new AtomicTransaction();
A.begin();
assertTrue(A.get_txcontext() != null);
A.registerResource(new DemoResource().getResource());
TopLevelTransaction B = new TopLevelTransaction();
DemoResource d = new DemoResource();
B.begin();
B.registerResource(d.getResource());
B.commit(true);
A.commit(true);
assertEquals(d.getResourceTrace().getTrace(), ResourceTrace.ResourceTraceCommitOnePhase);
}
Aggregations