Package org.mule.tck.testmodels.mule

Examples of org.mule.tck.testmodels.mule.TestTransaction


    @Test
    public void testCommitCurrentTransaction() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        tc.commitCurrentTransaction();
        TestTransaction testTransaction = spy(new TestTransaction(muleContext));

        tc.bindTransaction(testTransaction);
        tc.commitCurrentTransaction();
        assertThat(tc.getTransaction(),IsNull.<Object>nullValue());
        verify(testTransaction, times(1)).commit();
View Full Code Here


    @Test
    public void testCommitCurrentTransactionWithSuspendedTransaction() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        TestTransaction xaTx = spy(new TestTransaction(muleContext));
        xaTx.setXA(true);
        Transaction tx = spy(new TestTransaction(muleContext));

        tc.bindTransaction(xaTx);
        tc.suspendCurrentTransaction();
        tc.bindTransaction(tx);
        tc.commitCurrentTransaction();
View Full Code Here

    @Test
    public void testRollbackCurrentTransaction() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        tc.commitCurrentTransaction();
        TestTransaction testTransaction = spy(new TestTransaction(muleContext));

        tc.bindTransaction(testTransaction);
        tc.rollbackCurrentTransaction();
        assertThat(tc.getTransaction(),IsNull.<Object>nullValue());
        verify(testTransaction, times(1)).rollback();
View Full Code Here

    @Test
    public void testRollbackCurrentTransactionWithSuspendedTransaction() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        TestTransaction xaTx = spy(new TestTransaction(muleContext));
        xaTx.setXA(true);
        Transaction tx = spy(new TestTransaction(muleContext));

        tc.bindTransaction(xaTx);
        tc.suspendCurrentTransaction();
        tc.bindTransaction(tx);
        tc.rollbackCurrentTransaction();
View Full Code Here

    public void testResumeXaTransactionIfAvailableWithNoTx() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        tc.resumeXaTransactionIfAvailable();

        Transaction tx = spy(new TestTransaction(muleContext));
        tc.bindTransaction(tx);
        tc.resumeXaTransactionIfAvailable();
        verify(tx, times(0)).resume();
    }
View Full Code Here

    public void testResumeXaTransactionIfAvailableWithTx() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>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();
View Full Code Here

    @Test(expected = IllegalTransactionStateException.class)
    public void testResumeXaTransactionTwice() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        TestTransaction tx = spy(new TestTransaction(muleContext));
        tx.setXA(true);
        tc.bindTransaction(tx);
        tc.resumeSuspendedTransaction();
        tc.resumeSuspendedTransaction();
    }
View Full Code Here

    @Test
    public void testResolveTransactionForRollback() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        TestTransaction tx = spy(new TestTransaction(muleContext));
        tx.setXA(true);
        tc.bindTransaction(tx);
        tx.setRollbackOnly();
        tc.resolveTransaction();
        assertThat(tc.getTransaction(),IsNull.<Object>nullValue());
        verify(tx,times(1)).rollback();
    }
View Full Code Here

    @Test
    public void testResolveTransactionForCommit() throws Exception
    {
        assertThat(tc.getTransaction(), IsNull.<Object>nullValue());
        TestTransaction tx = spy(new TestTransaction(muleContext));
        tx.setXA(true);
        tc.bindTransaction(tx);
        tc.resolveTransaction();
        assertThat(tc.getTransaction(),IsNull.<Object>nullValue());
        verify(tx,times(1)).commit();
    }
View Full Code Here

    @Test
    public void testProcessRequestResponseWithTx() throws Exception
    {
        MuleEvent event = getTestEvent(TEST_MESSAGE,
                                       getTestTransactedInboundEndpoint(MessageExchangePattern.REQUEST_RESPONSE));
        Transaction transaction = new TestTransaction(muleContext);
        TransactionCoordination.getInstance().bindTransaction(transaction);

        try
        {
            assertAsync(messageProcessor, event);
View Full Code Here

TOP

Related Classes of org.mule.tck.testmodels.mule.TestTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.