Examples of MessageProcessorChain


Examples of org.mule.api.processor.MessageProcessorChain

        processors = endpoint.getResponseMessageProcessors();
        assertNotNull(processors);
        assertEquals(1, processors.size());
        assertTrue(processors.get(0) instanceof MessageProcessorChain);
        MessageProcessorChain chain = (MessageProcessorChain) processors.get(0);
        assertEquals(2, chain.getMessageProcessors().size());
        assertEquals("C", ((TestMessageProcessor) chain.getMessageProcessors().get(0)).getLabel());
        assertEquals("D", ((TestMessageProcessor) chain.getMessageProcessors().get(1)).getLabel());

        MessageProcessor mp;

        if (variant.equals(ConfigVariant.FLOW))
        {           
            mp = ((Flow) muleContext.getRegistry().lookupObject("localEndpoints")).getMessageProcessors()
                .get(0);
        }
        else
        {
            mp = ((OutboundPassThroughRouter) ((OutboundRouterCollection) muleContext.getRegistry()
                .lookupService("localEndpoints")
                .getOutboundMessageProcessor()).getRoutes().get(0)).getRoute("ep4");
        }
       
        endpoint = (ImmutableEndpoint) mp;
        processors = endpoint.getMessageProcessors();
        assertNotNull(processors);
        assertEquals(2, processors.size());
        assertEquals("E", ((TestMessageProcessor) processors.get(0)).getLabel());
        assertEquals("F", ((TestMessageProcessor) processors.get(1)).getLabel());

        processors = endpoint.getResponseMessageProcessors();
        assertNotNull(processors);
        assertEquals(1, processors.size());
        assertTrue(processors.get(0) instanceof MessageProcessorChain);
        chain = (MessageProcessorChain) processors.get(0);
        assertEquals(2, chain.getMessageProcessors().size());
        assertEquals("G", ((TestMessageProcessor) chain.getMessageProcessors().get(0)).getLabel());
        assertEquals("H", ((TestMessageProcessor) chain.getMessageProcessors().get(1)).getLabel());
    }
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

    @Test
    public void testIsXmlFilter() throws Exception
    {
        Object flow = muleContext.getRegistry().lookupObject("test for xml");
        MessageProcessorChain notXmlSubFlow;
        List<MessageProcessor> outEndpoints = new ArrayList<MessageProcessor>(2);

        outEndpoints.add(((Flow) flow).getMessageProcessors().get(0));
        notXmlSubFlow = muleContext.getRegistry().lookupObject("notXml");
        outEndpoints.add((notXmlSubFlow.getMessageProcessors().get(0)));

        assertEquals(2, outEndpoints.size());
        assertTrue(outEndpoints.get(0).getClass().getName(), outEndpoints.get(0) instanceof MessageFilter);
        assertTrue(((MessageFilter) outEndpoints.get(0)).getFilter() instanceof IsXmlFilter);
        assertTrue(outEndpoints.get(1).getClass().getName(), outEndpoints.get(1) instanceof MessageFilter);
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

    }

    private void assertMessageChainIsOutboundEndpoint(MessageProcessor processor, String expectedAddress)
    {
        assertTrue(processor instanceof MessageProcessorChain);
        MessageProcessorChain chain = (MessageProcessorChain) processor;

        MessageProcessor firstInChain = chain.getMessageProcessors().get(0);
        assertTrue(firstInChain instanceof OutboundEndpoint);
        OutboundEndpoint endpoint = (OutboundEndpoint) firstInChain;

        String address = endpoint.getAddress();
        assertEquals(expectedAddress, address);
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

        }
        else if (serviceFlow instanceof Flow)
        {
            Field f;
            MessageProcessorChain notXmlSubFlow;
            List<MessageProcessor> outEndpoints = new ArrayList<MessageProcessor>(2);

            outEndpoints.add(((Flow) serviceFlow).getMessageProcessors().get(0));
            notXmlSubFlow = muleContext.getRegistry().lookupObject("notXml");
            outEndpoints.add((notXmlSubFlow.getMessageProcessors().get(0)));

            assertEquals(2, outEndpoints.size());
            assertTrue(outEndpoints.get(0).getClass().getName(), outEndpoints.get(0) instanceof MessageFilter);
            assertTrue(((MessageFilter) outEndpoints.get(0)).getFilter() instanceof IsXmlFilter);
            assertTrue(outEndpoints.get(1).getClass().getName(), outEndpoints.get(1) instanceof MessageFilter);
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

    }

    @Test
    public void testMixStaticFactoryt() throws Exception
    {
        MessageProcessorChain chain = DefaultMessageProcessorChain.from(new TestIntercepting(),
            new TestNonIntercepting(), new TestNonIntercepting(), new TestIntercepting(),
            new TestNonIntercepting(), new TestNonIntercepting());
        MuleEvent restul = chain.process(getTestEventUsingFlow(""));
        assertEquals(
            "InterceptingMessageProcessorMessageProcessorMessageProcessorInterceptingMessageProcessorMessageProcessorMessageProcessor",
            restul.getMessage().getPayload());
    }
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

    }

    @Test
    public void testMix2StaticFactory() throws Exception
    {
        MessageProcessorChain chain = DefaultMessageProcessorChain.from(new TestNonIntercepting(),
            new TestIntercepting(), new TestNonIntercepting(), new TestNonIntercepting(),
            new TestNonIntercepting(), new TestIntercepting());
        MuleEvent restul = chain.process(getTestEventUsingFlow(""));
        assertEquals(
            "MessageProcessorInterceptingMessageProcessorMessageProcessorMessageProcessorMessageProcessorInterceptingMessageProcessor",
            restul.getMessage().getPayload());
    }
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

        MessageProcessor mp = mock(MessageProcessor.class,
            withSettings().extraInterfaces(OutboundEndpoint.class));
        OutboundEndpoint outboundEndpoint = (OutboundEndpoint) mp;
        when(outboundEndpoint.getExchangePattern()).thenReturn(MessageExchangePattern.ONE_WAY);

        MessageProcessorChain chain = new DefaultMessageProcessorChainBuilder().chain(mp).build();
        MuleEvent response = chain.process(event);
        assertNull(response);
    }
View Full Code Here

Examples of org.mule.api.processor.MessageProcessorChain

            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.