Package org.mule.construct

Examples of org.mule.construct.Flow


    }

    @Test
    public void consumerWorksWithOperationInvocationPropertyDefined() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("echo");
        MuleEvent event = getTestEvent(ECHO_REQUEST);

        event.getMessage().setInvocationProperty(CxfConstants.OPERATION, OPERATION_VALUE);
        event = flow.process(event);

        assertXMLEqual(EXPECTED_ECHO_RESPONSE, event.getMessage().getPayloadAsString());
        assertEquals(OPERATION_VALUE, event.getMessage().getInvocationProperty(CxfConstants.OPERATION));
    }
View Full Code Here



    @Test
    public void consumerWorksWithNoOperationInvocationPropertyDefined() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("echo");
        MuleEvent event = getTestEvent(ECHO_REQUEST);

        event = flow.process(event);
        assertXMLEqual(EXPECTED_ECHO_RESPONSE, event.getMessage().getPayloadAsString());

        assertNull(event.getMessage().getInvocationProperty(CxfConstants.OPERATION));
    }
View Full Code Here

    @Override
    @Test
    public void testEndpointConfiguration()
    {
        Flow flow = muleContext.getRegistry().lookupObject("echo");
        assertNotNull(flow);

        ImmutableEndpoint endpoint = (ImmutableEndpoint) flow.getMessageSource();
        assertNotNull(endpoint.getSecurityFilter());
        assertEquals(HttpBasicAuthenticationFilter.class, endpoint.getSecurityFilter().getClass());
    }
View Full Code Here


    private void assertSoapAction(String flowName, final String expectedSoapActionHeader,
                                  final String expectedActionInContentType) throws Exception
    {
        Flow flow = (Flow) getFlowConstruct(flowName);
        MuleEvent event = getTestEvent("<test/>");

        getFunctionalTestComponent("server").setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                String soapAction = context.getMessage().getInboundProperty("SOAPAction");
                String contentType = context.getMessage().getInboundProperty("Content-Type");

                String actionInContentType = extractAction(contentType);

                assertMatchesQuoted(expectedSoapActionHeader, soapAction);
                assertMatchesQuoted(expectedActionInContentType, actionInContentType);
            }
        });

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

     *
     * @return The IMAP message receiver.
     */
    private RetrieveMessageReceiver getReceiver()
    {
        Flow flow = (Flow) muleContext.getRegistry().lookupFlowConstruct("emailPollingFlow");
        InboundEndpoint inboundEndpoint = (InboundEndpoint) flow.getMessageSource();
        ImapConnector connector = (ImapConnector) inboundEndpoint.getConnector();
        return (RetrieveMessageReceiver) connector.getReceiver(flow, inboundEndpoint);
    }
View Full Code Here

    }

    @Test
    public void testFlowConfig() throws Exception
    {
        Flow flowConstruct = muleContext.getRegistry().lookupObject("flowTest");
        assertNotNull(flowConstruct);
        assertTrue(flowConstruct.getMessageSource() instanceof InboundEndpoint);
        InboundEndpoint ep = ((InboundEndpoint)flowConstruct.getMessageSource());
        assertEquals(2, ep.getMessageProcessors().size());
        MessageProcessor mp = ep.getMessageProcessors().get(0);
        assertTrue(mp instanceof FeedSplitter);
        mp = ep.getMessageProcessors().get(1);
        assertTrue(mp instanceof MessageFilter);
View Full Code Here

    protected void runScenario(String flowName) throws Exception
    {
        MuleMessage message = new DefaultMuleMessage("TEST", muleContext);
        DefaultMuleEvent event = new DefaultMuleEvent(message, getTestInboundEndpoint(""), getTestService());
        Flow flow = (Flow) getFlowConstruct(flowName);
        flow.process(event);
        FlowAssert.verify(flowName);
    }
View Full Code Here

        String request = String.format("<ns:uploadAttachment xmlns:ns=\"http://consumer.ws.module.mule.org/\">" +
                                       "<fileName>%s</fileName><attachment>" +
                                       "<xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\" href=\"cid:testAttachmentId\"/>" +
                                       "</attachment></ns:uploadAttachment>", TEST_FILE_ATTACHMENT);

        Flow flow = (Flow) getFlowConstruct("clientUploadAttachment");
        MuleEvent event = getTestEvent(request);

        addAttachment(event.getMessage(), TEST_FILE_ATTACHMENT, "testAttachmentId");

        event = flow.process(event);

        String expected = "<ns2:uploadAttachmentResponse xmlns:ns2=\"http://consumer.ws.module.mule.org/\">" +
                          "<result>OK</result></ns2:uploadAttachmentResponse>";

        assertXMLEqual(expected, event.getMessage().getPayloadAsString());
View Full Code Here

    public void downloadAttachmentTest() throws Exception
    {
        String request = String.format("<ns:downloadAttachment xmlns:ns=\"http://consumer.ws.module.mule.org/\">" +
                                       "<fileName>%s</fileName></ns:downloadAttachment>", TEST_FILE_ATTACHMENT);

        Flow flow = (Flow) getFlowConstruct("clientDownloadAttachment");
        MuleEvent event = getTestEvent(request);

        event = flow.process(event);

        assertAttachmentInResponse(event.getMessage(), TEST_FILE_ATTACHMENT);
    }
View Full Code Here

    {
        String request = "<ns:echoAttachment xmlns:ns=\"http://consumer.ws.module.mule.org/\"><attachment>" +
                         "<xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\" href=\"cid:testAttachmentId\"/>" +
                         "</attachment></ns:echoAttachment>";

        Flow flow = (Flow) getFlowConstruct("clientEchoAttachment");
        MuleEvent event = getTestEvent(request);

        addAttachment(event.getMessage(), TEST_FILE_ATTACHMENT, "testAttachmentId");
        event = flow.process(event);

        assertAttachmentInResponse(event.getMessage(), TEST_FILE_ATTACHMENT);
    }
View Full Code Here

TOP

Related Classes of org.mule.construct.Flow

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.