Package org.mule.construct

Examples of org.mule.construct.Flow


    }

    @Test
    public void messagePropertiesAreMappedToSoapHeaders() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("testFlow");

        MuleEvent event = getTestEvent(ECHO_HEADERS_REQUEST);
        event.getMessage().setProperty(SOAP_HEADER_IN, REQUEST_HEADER_IN, PropertyScope.OUTBOUND);
        event.getMessage().setProperty(SOAP_HEADER_INOUT, REQUEST_HEADER_INOUT, PropertyScope.OUTBOUND);

        event = flow.process(event);

        assertEquals(RESPONSE_HEADER_OUT, event.getMessage().getInboundProperty(SOAP_HEADER_OUT));
        assertEquals(RESPONSE_HEADER_INOUT, event.getMessage().getInboundProperty(SOAP_HEADER_INOUT));

    }
View Full Code Here


    }

    @Test
    public void soapHeadersAreRemovedFromMessage() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("testFlow");

        MuleEvent event = getTestEvent(ECHO_HEADERS_REQUEST);

        event.getMessage().setProperty(SOAP_HEADER_IN, REQUEST_HEADER_IN, PropertyScope.OUTBOUND);
        event.getMessage().setProperty(SOAP_HEADER_INOUT, REQUEST_HEADER_INOUT, PropertyScope.OUTBOUND);
        event.getMessage().setProperty(HTTP_HEADER, TEST_MESSAGE, PropertyScope.OUTBOUND);

        // A test component is used on the server side to check HTTP headers that are received (inbound properties).

        getFunctionalTestComponent("server").setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                errorCollector.checkThat(context.getMessage().getInboundProperty(HTTP_HEADER), notNullValue());
                errorCollector.checkThat(context.getMessage().getInboundProperty(SOAP_HEADER_IN), nullValue());
                errorCollector.checkThat(context.getMessage().getInboundProperty(SOAP_HEADER_INOUT), nullValue());
            }
        });

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


    @Test
    public void invalidXmlInSoapHeaderOutboundProperty() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("testFlow");

        MuleEvent event = getTestEvent(ECHO_HEADERS_REQUEST);
        event.getMessage().setProperty(SOAP_HEADER_IN, "invalid xml", PropertyScope.OUTBOUND);

        try
        {
            flow.process(event);
            fail();
        }
        catch (TransformerMessagingException e)
        {
            assertTrue(e.getMessage().contains(SOAP_HEADER_IN));
View Full Code Here

    }

    @Test
    public void invalidSoapHeaderOutboundPropertyType() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("testFlow");

        MuleEvent event = getTestEvent(ECHO_HEADERS_REQUEST);
        event.getMessage().setProperty(SOAP_HEADER_IN, new Object(), PropertyScope.OUTBOUND);
        try
        {
            flow.process(event);
            fail();
        }
        catch (TransformerMessagingException e)
        {
            assertNull(e.getTransformer());
View Full Code Here

    }

    @Test
    public void payloadIsIgnoredOperationNoParams() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("noParams");
        MuleEvent event = getTestEvent(TEST_MESSAGE);

        event = flow.process(event);

        String expectedResponse = "<ns:noParamsResponse xmlns:ns=\"http://consumer.ws.module.mule.org/\">" +
                                  "<text>TEST</text></ns:noParamsResponse>";
        assertXMLEqual(expectedResponse, event.getMessage().getPayloadAsString());
    }
View Full Code Here

    }

    @Test
    public void payloadIsIgnoredOperationNoParamsWithHeaders() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("noParamsWithHeader");
        MuleEvent event = getTestEvent(TEST_MESSAGE);

        String expectedResponse = "<ns2:noParamsWithHeaderResponse xmlns:ns2=\"http://consumer.ws.module.mule.org/\">" +
                                  "<text>HEADER_VALUE</text></ns2:noParamsWithHeaderResponse>";

        String header = "<header xmlns=\"http://consumer.ws.module.mule.org/\">HEADER_VALUE</header>";
        event.getMessage().setProperty("soap.header", header, PropertyScope.OUTBOUND);

        event = flow.process(event);

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

    }

    @Test
    public void soapFaultThrowsException() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("soapFaultWithoutCatchExceptionStrategy");

        try
        {
            flow.process(getTestEvent(FAIL_REQUEST));
            fail();
        }
        catch (MessagingException e)
        {
            MuleMessage response = e.getEvent().getMessage();
View Full Code Here

    }

    @Test
    public void catchExceptionStrategyHandlesSoapFault() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("soapFaultWithCatchExceptionStrategy");

        ExceptionListener listener = new ExceptionListener(muleContext);
        MuleMessage response = flow.process(getTestEvent(FAIL_REQUEST)).getMessage();

        // Assert that the exception was thrown
        listener.waitUntilAllNotificationsAreReceived();

        assertXMLEqual(EXPECTED_SOAP_FAULT_DETAIL, response.getPayloadAsString());
View Full Code Here

    }
   
    @Test
    public void testTransactional() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("transactional");
        MuleEvent event = getTestEvent("message", flow);
        flow.process(event);
        MuleMessage message1 = muleContext.getClient().request("out1", 1000);
        MuleMessage message2 = muleContext.getClient().request("out2", 1000);
        assertThat(message1, notNullValue());
        assertThat(message2, notNullValue());
    }
View Full Code Here

    }

    @Test
    public void testTransactionalFailInTheMiddle() throws Exception
    {
        Flow flow = (Flow) getFlowConstruct("transactionalFailInTheMiddle");
        MuleEvent event = getTestEvent("message", flow);
        try
        {
            flow.process(event);
        }
        catch (Exception e) {}
        MuleMessage message1 = muleContext.getClient().request("out1", 1000);
        MuleMessage message2 = muleContext.getClient().request("out2", 1000);
        assertThat(message1, nullValue());
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.