Package org.mule.api.execution

Examples of org.mule.api.execution.ExecutionTemplate.execute()


        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        config.setFactory(new TestTransactionFactory(mockNewTransaction));
        MuleEvent exceptionListenerResult = configureExceptionListenerCall();
        try
        {
            executionTemplate.execute(getFailureTransactionCallback());
        }
        catch (MessagingException e)
        {
            assertThat(e, is(mockMessagingException));
            assertThat(e.getEvent(), is(exceptionListenerResult));
View Full Code Here


        });
        ExecutionTemplate transactionTemplate = createExecutionTemplate(config);
        MuleEvent exceptionListenerResult = configureExceptionListenerCall();
        try
        {
            transactionTemplate.execute(getFailureTransactionCallback());
        }
        catch (MessagingException e)
        {
            assertThat(e, Is.is(mockMessagingException));
            org.junit.Assert.assertThat(e.getEvent(), Is.is(exceptionListenerResult));
View Full Code Here

        ExecutionTemplate transactionTemplate = createExecutionTemplate(new MuleTransactionConfig());
        configureExceptionListenerCall();
        when(mockMessagingException.causedRollback()).thenReturn(false);
        try
        {
            transactionTemplate.execute(TransactionTemplateTestUtils.getFailureTransactionCallbackStartsTransaction(mockMessagingException, mockTransaction));
        }
        catch (MessagingException e)
        {
            assertThat(e, Is.is(mockMessagingException));
        }
View Full Code Here

        ExecutionTemplate transactionTemplate = TransactionalErrorHandlingExecutionTemplate.createScopeExecutionTemplate(mockMuleContext, new MuleTransactionConfig(), mockMessagingExceptionHandler);
        configureCatchExceptionListenerCall();
        when(mockMessagingException.causedRollback()).thenReturn(false);
        try
        {
            transactionTemplate.execute(TransactionTemplateTestUtils.getFailureTransactionCallbackStartsTransaction(mockMessagingException, mockTransaction));
        }
        catch (MessagingException e)
        {
            assertThat(e, Is.is(mockMessagingException));
        }
View Full Code Here

    @Test
    public void testActionIndifferentConfig() throws Exception
    {
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_INDIFFERENT);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        Object result = executionTemplate.execute(getEmptyTransactionCallback());
        assertThat((MuleEvent) result, is(RETURN_VALUE));
        assertThat(TransactionCoordination.getInstance().getTransaction(), IsNull.<Object>nullValue());
    }

    @Test
View Full Code Here

    @Test
    public void testActionNeverAndNoTx() throws Exception
    {
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NEVER);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        Object result = executionTemplate.execute(getEmptyTransactionCallback());
        assertThat((MuleEvent) result, is(RETURN_VALUE));
    }

    @Test(expected = IllegalTransactionStateException.class)
    public void testActionNeverAndTx() throws Exception
View Full Code Here

    public void testActionNeverAndTx() throws Exception
    {
        TransactionCoordination.getInstance().bindTransaction(mockTransaction);
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NEVER);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        executionTemplate.execute(getEmptyTransactionCallback());
    }

    @Test
    public void testActionNoneAndNoTx() throws Exception
    {
View Full Code Here

    @Test
    public void testActionNoneAndNoTx() throws Exception
    {
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NONE);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        Object result = executionTemplate.execute(getEmptyTransactionCallback());
        assertThat((MuleEvent) result, is(RETURN_VALUE));
    }

    @Test
    public void testActionNoneAndTxForCommit() throws Exception
View Full Code Here

    public void testActionNoneAndTxForCommit() throws Exception
    {
        TransactionCoordination.getInstance().bindTransaction(mockTransaction);
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NONE);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        Object result = executionTemplate.execute(getEmptyTransactionCallback());
        assertThat((MuleEvent) result, is(RETURN_VALUE));
        verify(mockTransaction).commit();
        verify(mockTransaction, VerificationModeFactory.times(0)).rollback();
    }
View Full Code Here

    {
        when(mockTransaction.isRollbackOnly()).thenReturn(true);
        TransactionCoordination.getInstance().bindTransaction(mockTransaction);
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NONE);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        Object result = executionTemplate.execute(getEmptyTransactionCallback());
        assertThat((MuleEvent) result, is(RETURN_VALUE));
        verify(mockTransaction).rollback();
        verify(mockTransaction, VerificationModeFactory.times(0)).commit();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.