Package org.mule

Examples of org.mule.DefaultMuleMessage


    }

    public void testInvoke3() throws MuleException, Exception
    {
        // ensure multiple arguments work
        muleContext.getClient().send("vm://invoke3-in", new DefaultMuleMessage("0", muleContext));
    }
View Full Code Here


    }

    public void testInvoke4() throws MuleException, Exception
    {
        // ensure no arguments work
        muleContext.getClient().send("vm://invoke4-in", new DefaultMuleMessage("0", muleContext));
    }
View Full Code Here

        muleContext.getClient().send("vm://invoke4-in", new DefaultMuleMessage("0", muleContext));
    }
  
    public void testEnrichWithAttributes() throws MuleException, Exception
    {
        MuleMessage message = new DefaultMuleMessage("0", muleContext);
        assertEquals("0Hello", muleContext.getClient().send("vm://enrich-in", message).getProperty(
            "helloHeader", PropertyScope.INBOUND));
    }
View Full Code Here

            "helloHeader", PropertyScope.INBOUND));
    }

    public void testEnrichWithElements() throws MuleException, Exception
    {
        MuleMessage message = new DefaultMuleMessage("0", muleContext);
        MuleMessage result = muleContext.getClient().send("vm://enrich2-in", message);

        assertEquals("0Hello", result.getProperty("helloHeader", PropertyScope.INBOUND));
        assertEquals("0Hello", result.getProperty("helloHeader2", PropertyScope.INBOUND));
    }
View Full Code Here

        assertEquals("0Hello", result.getProperty("helloHeader2", PropertyScope.INBOUND));
    }
   
    public void testLoggerMessage() throws MuleException, Exception
    {
        MuleMessage message = new DefaultMuleMessage("0", muleContext);
        muleContext.getClient().send("vm://loggermessage-in", message);
    }
View Full Code Here

        muleContext.getClient().send("vm://loggermessage-in", message);
    }
   
    public void testLoggerHeader() throws MuleException, Exception
    {
        MuleMessage message = new DefaultMuleMessage("0", muleContext);
        message.setOutboundProperty("toLog", "valueToLog");
        muleContext.getClient().send("vm://loggerheader-in", message);
    }
View Full Code Here

        }
    }

    public void testCustomMessageRouter() throws MuleException, Exception
    {
        MuleMessage message = new DefaultMuleMessage("", muleContext);
        MuleMessage result = muleContext.getClient().send("vm://customRouter-in", message);
        assertEquals("abc", result.getPayloadAsString());
    }
View Full Code Here

        assertTrue(mapping instanceof ExpressionMessageInfoMapping);

        Map props = new HashMap();
        props.put("id", "myID123");
        props.put("correlation", "myCorrelationID456");
        MuleMessage msg = new DefaultMuleMessage("foo", props, muleContext);
        assertEquals("myID123",mapping.getMessageId(msg));
        assertEquals("myCorrelationID456",mapping.getCorrelationId(msg));
    }
View Full Code Here

    public void testEventMetaDataPropagation() throws MuleException
    {
        Service service = muleContext.getRegistry().lookupService("component1");
        MuleSession session = new DefaultMuleSession(service, muleContext);
        MuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage("Test MuleEvent", muleContext),
            ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoints().get(0), session);
        service.sendEvent(event);
    }
View Full Code Here

                props.put("objectParam", new Apple());
                props.put("doubleParam", 12345.6);
                props.put("integerParam", 12345);
                props.put("longParam", (long) 123456789);
                props.put("booleanParam", Boolean.TRUE);
                MuleMessage msg = new DefaultMuleMessage(context.getMessageAsString(), props, muleContext);
                msg.addAttachment("test1", new DataHandler(new DataSource()
                {
                    public InputStream getInputStream() throws IOException
                    {
                        return null;
                    }

                    public OutputStream getOutputStream() throws IOException
                    {
                        return null;
                    }

                    public String getContentType()
                    {
                        return "text/plain";
                    }

                    public String getName()
                    {
                        return "test1";
                    }
                }));
                return msg;
            }
            else
            {
                MuleMessage msg = context.getMessage();
                assertEquals("param1", msg.getInboundProperty("stringParam"));
                final Object o = msg.getInboundProperty("objectParam");
                assertTrue(o instanceof Apple);
                assertEquals(12345.6, 12345.6, msg.<Double>getInboundProperty("doubleParam", 0d));
                assertEquals(12345, msg.<Integer>getInboundProperty("integerParam", 0).intValue());
                assertEquals(123456789, msg.<Long>getInboundProperty("longParam", 0L).longValue());
                assertEquals(Boolean.TRUE, msg.getInboundProperty("booleanParam", Boolean.FALSE));
                assertNotNull(msg.getInboundAttachment("test1"));
            }
            return null;
        }
View Full Code Here

TOP

Related Classes of org.mule.DefaultMuleMessage

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.