Search in sources :

Example 1 with Synchronization

use of com.hp.mwtests.ts.jta.jts.common.Synchronization in project narayana by jbosstm.

the class TransactionImpleUnitTest method testSynchronization.

@Test
public void testSynchronization() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    TransactionImple tx = new TransactionImple();
    tx.registerSynchronization(new Synchronization());
    assertTrue(tx.getSynchronizations().size() == 1);
    tx.setRollbackOnly();
    try {
        tx.registerSynchronization(new Synchronization());
        fail();
    } catch (final RollbackException ex) {
    }
    tx.rollback();
}
Also used : TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) Synchronization(com.hp.mwtests.ts.jta.jts.common.Synchronization) RollbackException(javax.transaction.RollbackException) Test(org.junit.Test)

Aggregations

TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)1 Synchronization (com.hp.mwtests.ts.jta.jts.common.Synchronization)1 RollbackException (javax.transaction.RollbackException)1 Test (org.junit.Test)1