Package org.mule.api.processor

Examples of org.mule.api.processor.MessageProcessor


    protected List<MessageProcessor> createMessageProcessorFromSpy(final List<SpyProcess> process)
    {
        List<MessageProcessor> messageProcessors = new ArrayList<MessageProcessor>();

        messageProcessors.add(new MessageProcessor()
        {
            @Override
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                if (process != null)
View Full Code Here


        return beforeMessageProcessors;
    }

    private MessageProcessor createMessageProcessorFromSpy(final List<SpyProcess> beforeCall)
    {
        return new MessageProcessor()
        {
            @Override
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                if (beforeCall != null)
View Full Code Here

        return new MunitSpy(muleContext).spyMessageProcessor(name);
    }

    protected final MuleEvent runFlow(String name, MuleEvent event) throws MuleException
    {
        MessageProcessor flow = (MessageProcessor) muleContext.getRegistry().get(name);
        if (flow == null)
        {
            throw new IllegalArgumentException("Flow " + name + " does not exist");
        }

        initialiseSubFlow(flow);

        return flow.process(event);
    }
View Full Code Here

    }

    public MessageProcessor getObject() throws Exception
    {
        // Create new message processor to decouple lifecycle
        return new MessageProcessor()
        {
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                return ((MessageProcessor) applicationContext.getBean(refName)).process(event);
            }
View Full Code Here

            MessageExchangePattern.REQUEST_RESPONSE, null);
        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());

        try
        {
            result = mpChain.process(requestEvent);
            fail("Filter should have thrown a FilterException");
        }
        catch (FilterUnacceptedException e)
        {
            // expected
View Full Code Here

            MessageExchangePattern.REQUEST_RESPONSE, null);
        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());
        result = mpChain.process(requestEvent);

        assertMessageSentSame(true);
        assertEquals(responseEvent.getMessage(), result.getMessage());

    }
View Full Code Here

            MessageExchangePattern.REQUEST_RESPONSE, null);
        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());
       
        // Required for UnauthorisedException creation
        RequestContext.setEvent(requestEvent);

        try
        {
            result = mpChain.process(requestEvent);
            fail("Exception expected");
        }
        catch (TestSecurityFilter.StaticMessageUnauthorisedException e)
        {
            requestEvent.getFlowConstruct().getExceptionListener().handleException(e, requestEvent);
View Full Code Here

            MessageExchangePattern.REQUEST_RESPONSE, null);
        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());

        try
        {
            result = mpChain.process(requestEvent);
            fail("Filter should have thrown a FilterException");
        }
        catch (FilterUnacceptedException e)
        {
            // expected
View Full Code Here

        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);
        responseEvent.getMessage().setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());
        result = mpChain.process(requestEvent);

        assertMessageSentSame(true);
        assertEquals(responseEvent.getMessage(), result.getMessage());
        final int status = result.getMessage().getOutboundProperty("status", 0);
        assertEquals(500, status);
View Full Code Here

        endpoint.setListener(inboundListener);
        requestEvent = createTestRequestEvent(endpoint);
        responseEvent = createTestResponseEvent(endpoint);
        responseEvent.getMessage().setExceptionPayload(new DefaultExceptionPayload(new RuntimeException()));

        MessageProcessor mpChain = ((AbstractEndpoint) endpoint).getMessageProcessorChain(requestEvent.getFlowConstruct());
       
        // Required for UnauthorisedException creation
        RequestContext.setEvent(requestEvent);

        try
        {
            result = mpChain.process(requestEvent);
            fail("Exception expected");
        }
        catch (TestSecurityFilter.StaticMessageUnauthorisedException e)
        {
            // expected
View Full Code Here

TOP

Related Classes of org.mule.api.processor.MessageProcessor

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.