Package org.mule.api.transport

Examples of org.mule.api.transport.MuleMessageFactory


    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(), context);

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


    @Test
    public void testAttachments() throws Exception
    {
        Message payload = createMimeMessageWithAttachment();

        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage muleMessage = factory.create(payload, encoding, muleContext);
        assertEquals(2, muleMessage.getInboundAttachmentNames().size());
    }
View Full Code Here

        payload.setHeader(RecipientType.BCC.toString(), TEST_BCC);
        payload.setFrom(new InternetAddress(TEST_FROM));
        payload.setReplyTo(new InternetAddress[]{new InternetAddress(TEST_REPLY_TO)});
        payload.setSentDate(now);

        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage muleMessage = factory.create(payload, encoding, muleContext);

        assertEquals(TEST_TO, muleMessage.getInboundProperty(MailProperties.TO_ADDRESSES_PROPERTY));
        assertEquals(TEST_CC, muleMessage.getInboundProperty(MailProperties.CC_ADDRESSES_PROPERTY));
        assertEquals(TEST_BCC, muleMessage.getInboundProperty(MailProperties.BCC_ADDRESSES_PROPERTY));
        assertEquals(TEST_FROM, muleMessage.getInboundProperty(MailProperties.FROM_ADDRESS_PROPERTY));
View Full Code Here

        payload.setHeader(MailProperties.SENT_DATE_PROPERTY, invalid);
        payload.setSubject(TEST_SUBJECT);
        payload.setHeader(MailProperties.CONTENT_TYPE_PROPERTY, invalid);
        payload.setHeader(customProperty, customProperty);

        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage muleMessage = factory.create(payload, encoding, muleContext);

        assertEquals(TEST_TO, muleMessage.getInboundProperty(MailProperties.TO_ADDRESSES_PROPERTY));
        assertEquals(TEST_CC, muleMessage.getInboundProperty(MailProperties.CC_ADDRESSES_PROPERTY));
        assertEquals(TEST_BCC, muleMessage.getInboundProperty(MailProperties.BCC_ADDRESSES_PROPERTY));
        assertEquals(TEST_FROM, muleMessage.getInboundProperty(MailProperties.FROM_ADDRESS_PROPERTY));
View Full Code Here

    @Test
    public void testAttachmentsWithSameName() throws Exception
    {
        Message payload = createMimeMessageWithSameAttachmentNames();

        MuleMessageFactory factory = createMuleMessageFactory();
        MuleMessage muleMessage = factory.create(payload, encoding, muleContext);
        assertEquals(3, muleMessage.getInboundAttachmentNames().size());
    }
View Full Code Here

    {
        TestConnector connector = lookupDummyConnector();
        TransportServiceDescriptor serviceDescriptor = connector.getServiceDescriptor();

        // test if the service override for the message factory works
        MuleMessageFactory messageFactory = serviceDescriptor.createMuleMessageFactory();
        assertEquals(MockMuleMessageFactory.class, messageFactory.getClass());
    }
View Full Code Here

    @Test
    public void testConnectorMuleMessageFactory() throws Exception
    {
        Connector connector = getConnectorAndAssert();

        MuleMessageFactory factory = connector.createMuleMessageFactory();
        assertNotNull(factory);
    }
View Full Code Here

       
        MockMessageDispatcher dispatcher =
            (MockMessageDispatcher) connector.getDispatcherFactory().create(endpoint);
        dispatcher.initialise();
       
        MuleMessageFactory factoryFromDispatcher = dispatcher.getMuleMessageFactory();
        assertNotNull(factoryFromDispatcher);
        assertSame(factoryFromConnector, factoryFromDispatcher);
    }
View Full Code Here

       
        CustomMessageDispatcher dispatcher =
            (CustomMessageDispatcher) connector.getDispatcherFactory().create(endpoint);
        dispatcher.initialise();
       
        MuleMessageFactory factoryFromDispatcher = dispatcher.getMuleMessageFactory();
        assertNotNull(factoryFromDispatcher);
        assertNotSame(factoryFromConnector, factoryFromDispatcher);
    }
View Full Code Here

    }

    @Override
    public void testValidPayload() throws Exception
    {
        MuleMessageFactory factory = createMuleMessageFactory();

        MuleMessage message = factory.create(getValidTransportMessage(), encoding, muleContext);
        assertNotNull(message);
        assertPayload(message);
        assertEquals(PORT, message.getInboundProperty(UdpConnector.PORT_PROPERTY));
        assertNotNull(message.getInboundProperty(UdpConnector.ADDRESS_PROPERTY));
    }
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.