Package org.mule.api

Examples of org.mule.api.MuleMessage


    @Override
    public Object call(Object[] params, ExpressionLanguageContext context)
    {
        if (params != null && params.length > 0)
        {
            MuleMessage messageFrom = getMuleMessageFrom(context);

            if (messageFrom == null)
            {
                throw new RuntimeException("Could not get message;");
            }
View Full Code Here


    @Processor
    public Object call(String path, @Optional Map<String, Object> parameters, @Optional Object payload,
                       @Optional List<NestedProcessor> responseProcessing) throws Exception
    {

        MuleMessage response = muleContext.getClient().send(path, payload, parameters);

        Object processedResponse = response;
        if (responseProcessing != null)
        {
            for (NestedProcessor processor : responseProcessing)
View Full Code Here

     */
    @Processor
    public Object request(String url, Long timeout, @Optional List<NestedProcessor> responseProcessing) throws Exception
    {

        MuleMessage response = muleContext.getClient().request(url, timeout);

        Object processedResponse = response;
        if (responseProcessing != null)
        {
            for (NestedProcessor processor : responseProcessing)
View Full Code Here

    public Object send(String url, Object payload, @Optional Long timeout,
                       @Optional Map<String, Object> messageProperties,
                       @Optional List<NestedProcessor> responseProcessing) throws Exception
    {

        MuleMessage response = muleContext.getClient().send(url, payload, messageProperties, timeout);

        Object processedResponse = response;
        if (responseProcessing != null)
        {
            for (NestedProcessor processor : responseProcessing)
View Full Code Here

            }
        };
        spyMessageProcessor("create-issue").ofNamespace("jira").withAttributes(a).before(spyBefore).after(spyAfter);


        MuleMessage message = muleMessageWithPayload("Mocked Jira");
        whenMessageProcessor("create-issue").ofNamespace("jira").withAttributes(a).thenReturn(message);


        runFlow("jira-mock-exampleFlow", testEvent(""));
        System.out.println("Test done");
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

    @Test
    public void happyPath() throws Exception
    {

        MuleMessage muleMessage = mock(MuleMessage.class);
        when(muleMessage.getPayload()).thenReturn("");
        Set<String> invocationProperties = new HashSet<String>();
        invocationProperties.add("aVariableName");
        when(muleMessage.getInvocationPropertyNames()).thenReturn(invocationProperties);
        when(muleMessage.getInvocationProperty("aVariableName")).thenReturn(new Object());
        when(inMuleEvent.getMessage()).thenReturn(muleMessage);
        when(nestedProcessor.process(eq(""),anyMap())).thenReturn(outMuleEvent);

        assertEquals(inMuleEvent, mp().process(inMuleEvent));
View Full Code Here

    public void interceptWithValueToReturn() throws Throwable
    {
        MunitMessageProcessorInterceptor interceptor = interceptor();
        interceptor.setAttributes(new HashMap<String, String>());

        MuleMessage expectedMessage = muleMessage();

        when(manager.getBetterMatchingBehavior(any(MessageProcessorCall.class))).thenReturn(returnValueBehavior());
        when(event.getMessage()).thenReturn(expectedMessage);

        MuleEvent processed = (MuleEvent) interceptor.process(new Object(), new Object[] {event}, proxy);
View Full Code Here

    public void interceptWithSpyBeforeAssertion() throws Throwable
    {
        MunitMessageProcessorInterceptor interceptor = interceptor();
        interceptor.setAttributes(new HashMap<String, String>());

        MuleMessage expectedMessage = muleMessage();

        when(manager.getBetterMatchingBeforeSpyAssertion(any(MessageProcessorCall.class))).thenReturn(spyAssertion(createAssertions(beforeAssertionMp)));
        when(manager.getBetterMatchingAfterSpyAssertion(any(MessageProcessorCall.class))).thenReturn(spyAssertion(createAssertions(afterAssertionMp)));
        when(manager.getBetterMatchingBehavior(any(MessageProcessorCall.class))).thenReturn(returnValueBehavior());
        when(event.getMessage()).thenReturn(expectedMessage);
View Full Code Here

    {
        MockMunitMessageProcessorInterceptor interceptor = interceptor();
        interceptor.setAttributes(getAttributes());
        interceptor.setContext(muleContext);

        MuleMessage expectedMessage = muleMessage();


        when(muleContext.getExpressionManager()).thenReturn(expressionManager);
        when(expressionManager.isExpression(ATTR_VALUE)).thenReturn(true);
        when(expressionManager.parse(ATTR_VALUE, event)).thenReturn("any");
View Full Code Here

TOP

Related Classes of org.mule.api.MuleMessage

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.