Package org.mule.api.processor

Examples of org.mule.api.processor.MessageProcessor.process()


    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(new TestMessageProcessor("1"), new TestMessageProcessor("2"), new TestMessageProcessor("3"));
        MessageProcessor mpChain = builder.build();
       
        result = mpChain.process(requestEvent);
        assertEquals(TEST_MESSAGE + ":1:2:3", result.getMessage().getPayload());
    }

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


    public void testNoProcessors() throws Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        MessageProcessor mpChain = builder.build();
       
        result = mpChain.process(requestEvent);
        assertEquals(TEST_MESSAGE, result.getMessage().getPayload());
    }

    protected MuleMessage createTestRequestMessage()
    {
View Full Code Here

        OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null, null, null,
            MessageExchangePattern.ONE_WAY, null);
        MessageProcessor mp = new OutboundNotificationMessageProcessor(endpoint);
        MuleEvent event = createTestOutboundEvent();
        mp.process(event);

        assertTrue(listener.latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        assertEquals(EndpointMessageNotification.MESSAGE_DISPATCH_END, listener.messageNotification.getAction());
        assertEquals(endpoint.getEndpointURI().getUri().toString(),
            listener.messageNotification.getEndpoint());
View Full Code Here

        OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null, null, null,
            MessageExchangePattern.REQUEST_RESPONSE, null);
        MessageProcessor mp = new OutboundNotificationMessageProcessor(endpoint);
        MuleEvent event = createTestOutboundEvent();
        mp.process(event);

        assertTrue(listener.latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        assertEquals(EndpointMessageNotification.MESSAGE_SEND_END, listener.messageNotification.getAction());
        assertEquals(endpoint.getEndpointURI().getUri().toString(),
            listener.messageNotification.getEndpoint());
View Full Code Here

    public void testProcess() throws Exception
    {
        OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null);
        MessageProcessor mp = new OutboundEndpointPropertyMessageProcessor(endpoint);

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

        assertEquals(endpoint.getEndpointURI().getUri().toString(),
                     event.getMessage().getOutboundProperty(MuleProperties.MULE_ENDPOINT_PROPERTY));
        assertSame(event, RequestContext.getEvent());
    }
View Full Code Here

        MuleEvent responseEvent = Mockito.mock(MuleEvent.class);
        Mockito.when(responseEvent.getSession()).thenReturn(muleSession);

        MessageProcessor listener = Mockito.mock(MessageProcessor.class);
        Mockito.when(listener.process(Mockito.any(MuleEvent.class))).thenAnswer(new Answer<MuleEvent>()
        {
            @Override
            public MuleEvent answer(InvocationOnMock invocation) throws Throwable
            {
                return (MuleEvent) invocation.getArguments()[0];
View Full Code Here

        }
       
        MessageProcessor mp = routes.get(modulo);
        try
        {
            return mp.process(event);
        }
        catch (MuleException ex)
        {
            throw new RoutingException(event, this, ex);
        }
View Full Code Here

            new AppendingMP("b"), new ReturnNullMP()).build();
        builder.chain(new AppendingMP("1"), new MessageProcessor()
        {
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                return nested.process(event);
            }
        }, new AppendingMP("2"));
        assertNull("012", builder.build().process(getTestEventUsingFlow("0")));
    }
View Full Code Here

            new AppendingMP("b"), new ReturnVoidMP()).build();
        builder.chain(new AppendingMP("1"), new MessageProcessor()
        {
            public MuleEvent process(MuleEvent event) throws MuleException
            {
                return nested.process(event);
            }
        }, new AppendingMP("2"));
        assertEquals("01ab2", builder.build().process(getTestEventUsingFlow("0")).getMessage().getPayload());
    }
View Full Code Here

        MessageProcessor mp = mock(MessageProcessor.class,
            withSettings().extraInterfaces(OutboundEndpoint.class));
        OutboundEndpoint outboundEndpoint = (OutboundEndpoint) mp;
        when(outboundEndpoint.getExchangePattern()).thenReturn(MessageExchangePattern.ONE_WAY);
        when(mp.process(Mockito.any(MuleEvent.class))).thenReturn(VoidMuleEvent.getInstance());

        MessageProcessorChain chain = new DefaultMessageProcessorChainBuilder().chain(mp).build();
        MuleEvent response = chain.process(event);
        assertSame(event, response);
    }
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.