Package org.mule.transaction

Examples of org.mule.transaction.MuleTransactionConfig


        ((AbstractService) service).setExceptionListener(new DefaultMessagingExceptionStrategy(muleContext, true));
        service.setName("testComponent");
        service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(JdbcFunctionalTestComponent.class)));

        TransactionFactory tf = getTransactionFactory();
        TransactionConfig txConfig = new MuleTransactionConfig();
        txConfig.setFactory(tf);
        txConfig.setAction(txBeginAction);
       
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(getInDest(), muleContext);
        endpointBuilder.setName("testIn");
        endpointBuilder.setConnector(connector);
        endpointBuilder.setTransactionConfig(txConfig);
View Full Code Here


                    tt = new TransactionTemplate<Void>(endpoint.getTransactionConfig(), muleContext);
                }
                else
                {
                    // a simple inline endpoint
                    tt = new TransactionTemplate<Void>(new MuleTransactionConfig(), muleContext);
                }
            }
            else
            {
                tt = new TransactionTemplate<Void>(endpoint.getTransactionConfig(), muleContext);
View Full Code Here

        tm = context.getTransactionManager();
    }

    protected <T> TransactionTemplate<T> createTransactionTemplate(byte action, boolean considerExternal)
    {
        TransactionConfig tc = new MuleTransactionConfig();
        tc.setAction(action);
        tc.setFactory(new XaTransactionFactory());
        tc.setInteractWithExternal(considerExternal);
        TransactionTemplate<T> tt = new TransactionTemplate<T>(tc, context);
        return tt;
    }
View Full Code Here

public class MuleTransactionConfigTestCase extends AbstractMuleTestCase
{
    public void testActionAndStringConversion()
    {
        MuleTransactionConfig c = new MuleTransactionConfig();
        c.setMuleContext(muleContext);

        c.setAction(MuleTransactionConfig.ACTION_ALWAYS_BEGIN);
        assertEquals(MuleTransactionConfig.ACTION_ALWAYS_BEGIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_ALWAYS_JOIN);
        assertEquals(MuleTransactionConfig.ACTION_ALWAYS_JOIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN);
        assertEquals(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE);
        assertEquals(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_NONE);
        assertEquals(MuleTransactionConfig.ACTION_NONE_STRING, c.getActionAsString());
    }
View Full Code Here

        c.setAction(MuleTransactionConfig.ACTION_NONE);
        assertEquals(MuleTransactionConfig.ACTION_NONE_STRING, c.getActionAsString());
    }

    public void testDefaults() throws Exception {
        MuleTransactionConfig c = new MuleTransactionConfig();
        c.setMuleContext(muleContext);
        assertEquals("Wrong default TX timeout", 30000, c.getTimeout());
    }
View Full Code Here

        assertEquals("Wrong default TX timeout", 30000, c.getTimeout());
    }

    public void testTransactionJoinIfPossible() throws TransactionException
    {     
        MuleTransactionConfig txConfig = new MuleTransactionConfig();
        txConfig.setMuleContext(muleContext);
        txConfig.setAction(TransactionConfig.ACTION_JOIN_IF_POSSIBLE);
        txConfig.setFactory(new TestTransactionFactory());
        assertFalse(txConfig.isTransacted());
    }
View Full Code Here

        assertFalse(txConfig.isTransacted());
    }

    public void testFailNoFactory()
    {
        MuleTransactionConfig txConfig = new MuleTransactionConfig();
        txConfig.setMuleContext(muleContext);
        txConfig.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN);
        // note how we don't set a factory here so the default in MTC is null
       
        try
        {
            txConfig.isTransacted();
            fail("isTransacted() must fail if no factory is set");
        }
        catch (RuntimeException re)
        {
            // this was expected
View Full Code Here

    private static class NullInboundEndpoint extends DefaultInboundEndpoint
    {
        public NullInboundEndpoint(MessageExchangePattern mep, MuleContext muleContext)
        {
            super(null, new MuleEndpointURI("dynamic://null", null, null, null, null, null,
                URI.create("dynamic://null"), muleContext), null, new HashMap(), new MuleTransactionConfig(),
                false, mep, 0, null, null, null, muleContext, null, null, null, null, false, null);
        }
View Full Code Here

    @Override
    protected void doConfigureInboundEndpointBuilder(MuleContext muleContext, EndpointBuilder endpointBuilder)
    {
        if (transacted)
        {
            MuleTransactionConfig transactionConfig = new MuleTransactionConfig();
            transactionConfig.setMuleContext(muleContext);
            transactionConfig.setAction(TransactionConfig.ACTION_BEGIN_OR_JOIN);
            endpointBuilder.setTransactionConfig(transactionConfig);
        }
    }
View Full Code Here

    @Override
    protected void doConfigureOutboundEndpointBuilder(MuleContext muleContext, EndpointBuilder endpointBuilder)
    {
        if (transacted)
        {
            MuleTransactionConfig transactionConfig = new MuleTransactionConfig();
            transactionConfig.setMuleContext(muleContext);
            transactionConfig.setAction(TransactionConfig.ACTION_ALWAYS_JOIN);
            endpointBuilder.setTransactionConfig(transactionConfig);
        }
    }
View Full Code Here

TOP

Related Classes of org.mule.transaction.MuleTransactionConfig

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.