Package org.mule.api.transport

Examples of org.mule.api.transport.MuleMessageFactory


        }
    }

    protected MuleMessageFactory createMuleMessageFactory()
    {
        MuleMessageFactory factory = doCreateMuleMessageFactory();
        assertNotNull(factory);
        return factory;
    }
View Full Code Here


    }

    @Override
    public void testValidPayload() throws Exception
    {
        MuleMessageFactory factory = createMuleMessageFactory();
       
        MuleMessage message = factory.create(getValidTransportMessage(), encoding);
        assertNotNull(message);
        assertPayload(message);
        assertEquals(PORT, message.getOutboundProperty(UdpConnector.PORT_PROPERTY));
        assertNotNull(message.getOutboundProperty(UdpConnector.ADDRESS_PROPERTY));
    }
View Full Code Here

    }
   
    public void testJsonStringPayloadWithoutData() throws Exception
    {
        String payload = "{\"value1\" : \"foo\", \"value2\" : \"bar\"}";
        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage message = factory.create(payload, encoding);
        assertNotNull(message);
        assertEquals(payload, message.getPayload());
        assertTrue(message.getPayload() instanceof String);
    }
View Full Code Here

    {
        String data = JSON_STRING;
        String payload = String.format("{ \"data\" : %1s, \"%2s\" : \"/replyEndpoint\"}",
            data, AjaxConnector.REPLYTO_PARAM);
       
        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage message = factory.create(payload, encoding);
        assertNotNull(message);
        assertEquals(data, message.getPayload());
        assertEquals("/replyEndpoint", message.getReplyTo());
    }
View Full Code Here

    }
   
    public void testNonMapNonJsonPayload() throws Exception
    {
        FruitBowl payload = new FruitBowl(new Apple(), new Banana());
        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage message = factory.create(payload, encoding);
        assertNotNull(message);
        assertEquals(payload, message.getPayload());
    }
View Full Code Here

    }

    @Override
    public void testValidPayload() throws Exception
    {
        MuleMessageFactory factory = createMuleMessageFactory();
       
        Object payload = getValidTransportMessage();
        MuleMessage message = factory.create(payload, encoding);
        assertNotNull(message);
        assertPayload(message);
    }
View Full Code Here

        assertPayload(message);
    }
   
    public void testPayloadFromInputStream() throws Exception
    {
        MuleMessageFactory factory = createMuleMessageFactory();
       
        InputStream stream = null;
        try
        {
            stream = new ReceiverFileInputStream(tempFile, false, null);
            MuleMessage message = factory.create(stream, encoding);
            assertNotNull(message);
           
            // delete the file before accessing the payload to make sure it was properly converted
            // to byte[] by the message factory
            assertTrue(tempFile.delete());
View Full Code Here

                                         InboundEndpoint endpoint,
                                         MuleContext context) throws Exception
    {
        final MuleSession session = getTestSession(flowConstruct, context);

        final MuleMessageFactory factory = endpoint.getConnector().createMuleMessageFactory();
        final MuleMessage message = factory.create(data, endpoint.getEncoding());

        return new DefaultMuleEvent(message, endpoint, session);
    }
View Full Code Here

    public static MuleEvent getTestEvent(Object data, MuleSession session, MuleContext context)
        throws Exception
    {
        final InboundEndpoint endpoint = getTestInboundEndpoint("test1",
            MessageExchangePattern.REQUEST_RESPONSE, context, null);
        final MuleMessageFactory factory = endpoint.getConnector().createMuleMessageFactory();
        final MuleMessage message = factory.create(data, endpoint.getEncoding());

        return new DefaultMuleEvent(message, endpoint, session);
    }
View Full Code Here

    }

    @Test
    public void testSoapHeaders() throws Exception
    {
        MuleMessageFactory factory = createMuleMessageFactory();
        Object payload = getValidTransportMessage();
        MuleMessage message = factory.create(payload, encoding, muleContext);
        assertEquals(payload, message.getPayload());
        assertEquals("replyTo", message.getReplyTo());
        assertEquals(42, message.getCorrelationGroupSize());
        assertEquals(-42, message.getCorrelationSequence());
        assertEquals("004a1cf9-3e7e-44b3-9b7f-778fae4fa0d2", message.getCorrelationId());
View Full Code Here

TOP

Related Classes of org.mule.api.transport.MuleMessageFactory

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.