use of org.mule.tck.testmodels.mule.TestTransaction in project mule by mulesoft.
the class TransactionCoordinationTestCase method testRollbackCurrentTransaction.
@Test
public void testRollbackCurrentTransaction() throws Exception {
assertThat(tc.getTransaction(), nullValue());
tc.commitCurrentTransaction();
TestTransaction testTransaction = spy(new TestTransaction(muleContext));
tc.bindTransaction(testTransaction);
tc.rollbackCurrentTransaction();
assertThat(tc.getTransaction(), nullValue());
verify(testTransaction, times(1)).rollback();
}
use of org.mule.tck.testmodels.mule.TestTransaction in project mule by mulesoft.
the class TransactionCoordinationTestCase method testResumeXaTransactionTwice.
@Test(expected = IllegalTransactionStateException.class)
public void testResumeXaTransactionTwice() throws Exception {
assertThat(tc.getTransaction(), nullValue());
TestTransaction tx = spy(new TestTransaction(muleContext));
tx.setXA(true);
tc.bindTransaction(tx);
tc.resumeSuspendedTransaction();
tc.resumeSuspendedTransaction();
}
use of org.mule.tck.testmodels.mule.TestTransaction in project mule by mulesoft.
the class TransactionCoordinationTestCase method testResumeXaTransactionIfAvailableWithTx.
@Test
public void testResumeXaTransactionIfAvailableWithTx() throws Exception {
assertThat(tc.getTransaction(), nullValue());
tc.resumeXaTransactionIfAvailable();
TestTransaction tx = spy(new TestTransaction(muleContext));
tx.setXA(true);
tc.bindTransaction(tx);
tc.suspendCurrentTransaction();
tc.resumeXaTransactionIfAvailable();
verify(tx, times(1)).suspend();
verify(tx, times(1)).resume();
}
use of org.mule.tck.testmodels.mule.TestTransaction in project mule by mulesoft.
the class TransactionCoordinationTestCase method testCommitCurrentTransaction.
@Test
public void testCommitCurrentTransaction() throws Exception {
assertThat(tc.getTransaction(), nullValue());
tc.commitCurrentTransaction();
TestTransaction testTransaction = spy(new TestTransaction(muleContext));
tc.bindTransaction(testTransaction);
tc.commitCurrentTransaction();
assertThat(tc.getTransaction(), nullValue());
verify(testTransaction, times(1)).commit();
}
use of org.mule.tck.testmodels.mule.TestTransaction in project mule by mulesoft.
the class TransactionCoordinationTestCase method testResolveTransactionForRollback.
@Test
public void testResolveTransactionForRollback() throws Exception {
assertThat(tc.getTransaction(), nullValue());
TestTransaction tx = spy(new TestTransaction(muleContext));
tx.setXA(true);
tc.bindTransaction(tx);
tx.setRollbackOnly();
tc.resolveTransaction();
assertThat(tc.getTransaction(), nullValue());
verify(tx, times(1)).rollback();
}
Aggregations