Search in sources :

Example 1 with ServerControlWrapper

use of com.arjuna.ats.internal.jts.interposition.ServerControlWrapper in project narayana by jbosstm.

the class ServerControlWrapperUnitTest method testNested.

@Test
public void testNested() throws Exception {
    TransactionFactoryImple imple = new TransactionFactoryImple("test");
    ControlImple tx = imple.createLocal(1000);
    ServerControlWrapper wrap = new ServerControlWrapper(tx);
    ControlWrapper sub = wrap.create_subtransaction();
    assertTrue(sub != null);
    assertEquals(sub.cancel(), ActionStatus.ABORTED);
}
Also used : ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) ControlWrapper(com.arjuna.ats.internal.jts.ControlWrapper) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Example 2 with ServerControlWrapper

use of com.arjuna.ats.internal.jts.interposition.ServerControlWrapper in project narayana by jbosstm.

the class TransactionImpleUnitTest method test.

@Test
public void test() throws Exception {
    OTSImpleManager.current().begin();
    TransactionImple tx = new TransactionImple(new SubordinateAtomicTransaction(new ServerControlWrapper(OTSImpleManager.current().get_control())));
    assertFalse(tx.equals(null));
    assertTrue(tx.equals(tx));
    assertFalse(tx.equals(new TransactionImple(new AtomicTransaction())));
    assertFalse(tx.equals(new Object()));
    assertTrue(tx.toString() != null);
    try {
        tx.commit();
        fail();
    } catch (final InvalidTerminationStateException ex) {
    }
    try {
        tx.rollback();
        fail();
    } catch (final InvalidTerminationStateException ex) {
    }
    tx.doBeforeCompletion();
    tx.doPrepare();
    try {
        tx.doCommit();
        fail();
    } catch (final Throwable ex) {
    }
    try {
        tx.doRollback();
        fail();
    } catch (final Throwable ex) {
    }
    try {
        tx.doOnePhaseCommit();
        fail();
    } catch (final Throwable ex) {
    }
    tx.doForget();
    OTSImpleManager.current().rollback();
    DummyTransactionImple dummy = new DummyTransactionImple(new AtomicTransaction());
    try {
        dummy.commitAndDisassociate();
    } catch (final InactiveTransactionException ex) {
    }
    try {
        dummy.rollbackAndDisassociate();
    } catch (final InactiveTransactionException ex) {
    }
}
Also used : ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) SubordinateAtomicTransaction(com.arjuna.ats.internal.jta.transaction.jts.subordinate.SubordinateAtomicTransaction) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.subordinate.TransactionImple) SubordinateAtomicTransaction(com.arjuna.ats.internal.jta.transaction.jts.subordinate.SubordinateAtomicTransaction) AtomicTransaction(com.arjuna.ats.internal.jta.transaction.jts.AtomicTransaction) InvalidTerminationStateException(com.arjuna.ats.jta.exceptions.InvalidTerminationStateException) InactiveTransactionException(com.arjuna.ats.jta.exceptions.InactiveTransactionException) Test(org.junit.Test)

Example 3 with ServerControlWrapper

use of com.arjuna.ats.internal.jts.interposition.ServerControlWrapper in project narayana by jbosstm.

the class ServerControlWrapperUnitTest method testEquality.

@Test
public void testEquality() throws Exception {
    TransactionFactoryImple imple = new TransactionFactoryImple("test");
    ControlImple tx = imple.createLocal(1000);
    ServerControlWrapper wrap1 = new ServerControlWrapper(tx);
    ServerControlWrapper wrap2 = new ServerControlWrapper(tx.getControl());
    assertTrue(wrap1.get_uid().equals(wrap2.get_uid()));
    wrap1 = new ServerControlWrapper(tx.getControl(), tx);
    wrap2 = new ServerControlWrapper(tx.getControl(), tx.get_uid());
    assertTrue(wrap1.get_uid().equals(wrap2.get_uid()));
}
Also used : ServerControlWrapper(com.arjuna.ats.internal.jts.interposition.ServerControlWrapper) TransactionFactoryImple(com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple) ControlImple(com.arjuna.ats.internal.jts.orbspecific.ControlImple) Test(org.junit.Test)

Aggregations

ServerControlWrapper (com.arjuna.ats.internal.jts.interposition.ServerControlWrapper)3 Test (org.junit.Test)3 ControlImple (com.arjuna.ats.internal.jts.orbspecific.ControlImple)2 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)2 AtomicTransaction (com.arjuna.ats.internal.jta.transaction.jts.AtomicTransaction)1 SubordinateAtomicTransaction (com.arjuna.ats.internal.jta.transaction.jts.subordinate.SubordinateAtomicTransaction)1 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.subordinate.TransactionImple)1 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)1 InactiveTransactionException (com.arjuna.ats.jta.exceptions.InactiveTransactionException)1 InvalidTerminationStateException (com.arjuna.ats.jta.exceptions.InvalidTerminationStateException)1