Package org.mule.api.transaction

Examples of org.mule.api.transaction.Transaction


     */
    protected boolean isTransactionRollback()
    {
        try
        {
            Transaction tx = TransactionCoordination.getInstance().getTransaction();
            if (tx != null && tx.isRollbackOnly())
            {
                return true;
            }
        }
        catch (TransactionException e)
View Full Code Here


            purge(getOutboundQueueName());
            // TODO DZ: get all of the queue/topic names from the Mule config and just purge those
        }

        client = muleContext.getClient();
        Transaction tx = TransactionCoordination.getInstance().getTransaction();
        if (tx != null)
        {
            TransactionCoordination.getInstance().unbindTransaction(tx);
            log.warn("Transaction was active when this test began");
        }
View Full Code Here

            purge(getOutboundQueueName());
            purgeTopics();
        }

        super.doTearDown();
        Transaction tx = TransactionCoordination.getInstance().getTransaction();
        if (tx != null)
        {
            TransactionCoordination.getInstance().unbindTransaction(tx);
            log.warn("Transaction was active when this test ended");
        }
View Full Code Here

        // may have been started
        ExecutionCallback<List<MuleEvent>> processingCallback = new ExecutionCallback<List<MuleEvent>>()
        {
            public List<MuleEvent> process() throws Exception
            {
                final Transaction tx = TransactionCoordination.getInstance().getTransaction();
                if (tx != null)
                {
                    bindTransaction(tx);
                }
                List<MuleEvent> results = new ArrayList<MuleEvent>(messages.size());
View Full Code Here

    {
        InterceptingMessageProcessor mp = new OutboundTxRollbackMessageProcessor();
        TestListener listener = new TestListener();
        mp.setListener(listener);

        Transaction tx = new TestTransaction(muleContext);
        try
        {
            TransactionCoordination.getInstance().bindTransaction(tx);
            tx.setRollbackOnly();

            MuleEvent event = createTestOutboundEvent();
            MuleEvent result = mp.process(event);

            assertNull(listener.sensedEvent);
View Full Code Here

     * @return An operation resource that can be transacted or not based on transaction configuration
     * @throws MuleException
     */
    final public <T> T getTransactionalResource(ImmutableEndpoint endpoint) throws MuleException
    {
        Transaction currentTx = TransactionCoordination.getInstance().getTransaction();
        if (currentTx != null)
        {
            if (currentTx.hasResource(this.getOperationResourceFactory()))
            {
                return (T) currentTx.getResource(this.getOperationResourceFactory());
            }
            else
            {
                Object connectionResource = this.createOperationResource(endpoint);
                if (currentTx.supports(this.getOperationResourceFactory(),connectionResource))
                {
                    currentTx.bindResource(this.getOperationResourceFactory(), connectionResource);
                }
                else if (endpoint.getTransactionConfig().isTransacted())
                {
                    throw new TransactionException(CoreMessages.createStaticMessage("Endpoint is transactional but transaction does not support it"));
                }
View Full Code Here

        super();
    }

    public Transaction beginTransaction(MuleContext muleContext) throws TransactionException
    {
        Transaction tx = new SpringTransaction(muleContext);
        tx.begin();
        return tx;
    }
View Full Code Here



    public Transaction beginTransaction(MuleContext muleContext) throws TransactionException
    {
        Transaction testTransaction;
        if (mockTransaction != null)
        {
            testTransaction = mockTransaction;
        }
        else
        {
            testTransaction = new TestTransaction(muleContext);
        }

        testTransaction.begin();
        return testTransaction;
    }
View Full Code Here

        when(mockPTM.getTransaction(any(TransactionDefinition.class))).thenReturn(mockTS);

        SpringTransactionFactory factory = new SpringTransactionFactory();
        factory.setManager(mockPTM);

        Transaction tx = factory.beginTransaction(muleContext);
        tx.commit();

        verify(mockPTM).commit(mockTS);
    }
View Full Code Here

        when(mockPTM.getTransaction(any(TransactionDefinition.class))).thenReturn(mockTS);

        SpringTransactionFactory factory = new SpringTransactionFactory();
        factory.setManager(mockPTM);

        Transaction tx = factory.beginTransaction(muleContext);
        tx.rollback();

        verify(mockPTM).rollback(mockTS);
        verify(mockTS).setRollbackOnly();
    }
View Full Code Here

TOP

Related Classes of org.mule.api.transaction.Transaction

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.