Package org.mule

Examples of org.mule.DefaultMuleMessage



    @Override
    protected void doProcess(MuleMessage mulemessage, AssertModule module)
    {
        DefaultMuleMessage defaultMuleMessage = (DefaultMuleMessage) mulemessage;

        setProperties(defaultMuleMessage, inboundProperties, PropertyScope.INBOUND);
        setProperties(defaultMuleMessage, invocationProperties, PropertyScope.INVOCATION);
        setProperties(defaultMuleMessage, outboundProperties, PropertyScope.OUTBOUND);
        setProperties(defaultMuleMessage, sessionProperties, PropertyScope.SESSION);
        defaultMuleMessage.setPayload(evaluate(mulemessage, payload));
    }
View Full Code Here


        validateMessageProcessorName();

        MockedMessageProcessorManager manager = getManager();
        MessageProcessorCall messageProcessorCall = new MessageProcessorCall(new MessageProcessorId(messageProcessorName, messageProcessorNamespace));
        messageProcessorCall.setAttributes(messageProcessorAttributes);
        manager.addBehavior(new MessageProcessorBehavior(messageProcessorCall, new CopyMessageTransformer(new DefaultMuleMessage(NotDefinedPayload.getInstance(), muleContext))));
    }
View Full Code Here

        SetMessageProcessor mp = (SetMessageProcessor) buildMp();
        mp.setPayload(EXP);
        mp.setInboundProperties(properties(INBOUND_KEY, INBOUND_VALUE));
        mp.setOutboundProperties(properties(OUTBOUND_KEY, OUTBOUND_VALUE));
        mp.setInvocationProperties(properties(INVOCATION_KEY, INVOCATION_VALUE));
        MuleMessage mm = new DefaultMuleMessage("aMessage", muleContext);

        when(expressionManager.evaluate(EXP, mm)).thenReturn(PAYLOAD);
        when(expressionManager.parse(OUTBOUND_VALUE, mm)).thenReturn(OUTBOUND_VALUE);
        when(expressionManager.parse(INBOUND_VALUE, mm)).thenReturn(INBOUND_VALUE);
        when(expressionManager.parse(INVOCATION_VALUE, mm)).thenReturn(INVOCATION_VALUE);

        mp.doProcess(mm, module);

        assertEquals(PAYLOAD, mm.getPayload());

        assertEquals(INBOUND_VALUE, mm.getInboundProperty(INBOUND_KEY));
        assertEquals(INVOCATION_VALUE, mm.getInvocationProperty(INVOCATION_KEY));
        assertEquals(OUTBOUND_VALUE, mm.getOutboundProperty(OUTBOUND_KEY));
    }
View Full Code Here

        Object definedPayload = payload;
        if (payload == null)
        {
            definedPayload = NotDefinedPayload.getInstance();
        }
        DefaultMuleMessage message = new DefaultMuleMessage(definedPayload, muleContext);

        if (inboundProperties != null)
        {
            for (String property : inboundProperties.keySet())
            {
                message.setInboundProperty(property, inboundProperties.get(property));
            }
        }

        if (outboundProperties != null)
        {
            for (String property : outboundProperties.keySet())
            {
                message.setOutboundProperty(property, outboundProperties.get(property));
            }
        }

        if (invocationProperties != null)
        {
            for (String property : invocationProperties.keySet())
            {
                message.setInvocationProperty(property, invocationProperties.get(property));
            }
        }

        // TODO: how we can set the session properties?
        //        if ( sessionProperties != null ){
View Full Code Here

     *         A mule message without properties and with the specified payload
     *         </p>
     */
    protected final MuleMessage muleMessageWithPayload(Object payload)
    {
        return new DefaultMuleMessage(payload, muleContext);
    }
View Full Code Here

        return new MessageProcessorBehavior(MESSAGE_PROCESSOR_CALL, new CopyMessageTransformer((DefaultMuleMessage) muleMessage()));
    }

    private MuleMessage muleMessage()
    {
        return new DefaultMuleMessage(PAYLOAD, muleContext);
    }
View Full Code Here

    @Test
    public void testCopyMessageWithNoValues()
    {

        DefaultMuleMessage originalMessage = new DefaultMuleMessage(ORIGINAL_PAYLOAD, muleContext);
        DefaultMuleMessage copyToMessage = new DefaultMuleMessage(A_PAYLOAD, muleContext);
        MunitUtils.copyMessage(originalMessage, copyToMessage);

        assertEquals(ORIGINAL_PAYLOAD, copyToMessage.getPayload());
    }
View Full Code Here

    @Test
    public void testCopyMessageWithInbound()
    {

        DefaultMuleMessage originalMessage = new DefaultMuleMessage(ORIGINAL_PAYLOAD, muleContext);
        originalMessage.setInboundProperty(PROPERTY, PROPERTY_VALUE);
        DefaultMuleMessage copyToMessage = new DefaultMuleMessage(A_PAYLOAD, muleContext);
        MunitUtils.copyMessage(originalMessage, copyToMessage);

        assertEquals(ORIGINAL_PAYLOAD, copyToMessage.getPayload());
        assertEquals(PROPERTY_VALUE, copyToMessage.getInboundProperty(PROPERTY));
    }
View Full Code Here

    @Test
    public void testCopyMessageWithInvocation()
    {

        DefaultMuleMessage originalMessage = new DefaultMuleMessage(ORIGINAL_PAYLOAD, muleContext);
        originalMessage.setInvocationProperty(PROPERTY, PROPERTY_VALUE);
        DefaultMuleMessage copyToMessage = new DefaultMuleMessage(A_PAYLOAD, muleContext);
        MunitUtils.copyMessage(originalMessage, copyToMessage);

        assertEquals(ORIGINAL_PAYLOAD, copyToMessage.getPayload());
        assertEquals(PROPERTY_VALUE, copyToMessage.getInvocationProperty(PROPERTY));
    }
View Full Code Here

    @Test
    public void testCopyMessageWithOutbound()
    {

        DefaultMuleMessage originalMessage = new DefaultMuleMessage(ORIGINAL_PAYLOAD, muleContext);
        originalMessage.setOutboundProperty(PROPERTY, PROPERTY_VALUE);
        DefaultMuleMessage copyToMessage = new DefaultMuleMessage(A_PAYLOAD, muleContext);
        MunitUtils.copyMessage(originalMessage, copyToMessage);

        assertEquals(ORIGINAL_PAYLOAD, copyToMessage.getPayload());
        assertEquals(PROPERTY_VALUE, copyToMessage.getOutboundProperty(PROPERTY));
    }
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.