Package org.mule

Examples of org.mule.DefaultMessageCollection


        MuleMessageCollection col;
        synchronized (events)
        {
            if (events.isEmpty())
            {
                col = new DefaultMessageCollection(null);
            }
            col = new DefaultMessageCollection(events.get(0).getMuleContext());
            for (MuleEvent event : events)
            {
                col.addMessage(event.getMessage());
            }
        }
View Full Code Here


            MuleEvent event = results.get(0);
            aggregate = event == null ? null : event.getMessage();
        }
        else
        {
            MuleMessageCollection coll = new DefaultMessageCollection(muleContext);
            for (MuleEvent event : results)
            {
                MuleMessage muleMessage = event == null ? null : event.getMessage();
                if(muleMessage!=null)
                {
                    coll.addMessage(muleMessage);
                }
            }
            aggregate = coll;
        }
View Full Code Here

    public void testMuleMessageCollectionMerge() throws Exception
    {  
        MuleEvent event = getTestEvent("hello");
       
        DefaultMessageCollection collection = new DefaultMessageCollection(muleContext);
        collection.addMessage(new DefaultMuleMessage(Arrays.asList("1", "2", "3"), muleContext));
        collection.addMessage(new DefaultMuleMessage("4", muleContext));
        collection.addMessage(new DefaultMuleMessage(Arrays.asList("5", "6", "7"), muleContext));
       
        event = new DefaultMuleEvent(collection, event);
       
        MuleEvent response = merger.process(event);
       
View Full Code Here

        HttpRequest request = new HttpRequest(new RequestLine(method, url, HttpVersion.HTTP_1_1), null, "UTF-8");
       
        endpoint = muleContext.getEndpointFactory().getInboundEndpoint(url);
       
        MuleEvent event = getTestEvent(request, endpoint);
        MuleMessageCollection message = new DefaultMessageCollection(muleContext);
        message.setOutboundProperty(HttpConnector.HTTP_METHOD_PROPERTY, method);
        message.setOutboundProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, url);
        RequestContext.setEvent(event);
       
        return message;
    }   
View Full Code Here

    @Test
    public void testMuleMessageCollectionMerge() throws Exception
    {  
        MuleEvent event = getTestEvent("hello");
       
        DefaultMessageCollection collection = new DefaultMessageCollection(muleContext);
        collection.addMessage(new DefaultMuleMessage(Arrays.asList("1", "2", "3"), muleContext));
        collection.addMessage(new DefaultMuleMessage("4", muleContext));
        collection.addMessage(new DefaultMuleMessage(Arrays.asList("5", "6", "7"), muleContext));
       
        event = new DefaultMuleEvent(collection, event);
       
        MuleEvent response = merger.process(event);
       
View Full Code Here

    }

    @Test
    public void testMuleMessageCollectionPayload() throws Exception
    {
        MuleMessageCollection msgCollection = new DefaultMessageCollection(muleContext);
        MuleMessage msg = new DefaultMuleMessage("bar", muleContext);
        msgCollection.addMessage(msg);
        msg = new DefaultMuleMessage("zip", muleContext);
        msgCollection.addMessage(msg);
        simpleForeach.process(getTestEvent(msgCollection));

        assertSimpleProcessedMessages();
    }
View Full Code Here

    }

    @Test
    public void testNestedMuleMessageCollectionPayload() throws Exception
    {
        MuleMessageCollection parentCollection = new DefaultMessageCollection(muleContext);
        MuleMessageCollection childCollection1 = new DefaultMessageCollection(muleContext);
        MuleMessageCollection childCollection2 = new DefaultMessageCollection(muleContext);
        MuleMessage msg;
        msg = new DefaultMuleMessage("a1", muleContext);
        childCollection1.addMessage(msg);
        msg = new DefaultMuleMessage("a2", muleContext);
        childCollection1.addMessage(msg);
        msg = new DefaultMuleMessage("a3", muleContext);
        childCollection1.addMessage(msg);

        msg = new DefaultMuleMessage("b1", muleContext);
        childCollection2.addMessage(msg);
        msg = new DefaultMuleMessage("b2", muleContext);
        childCollection2.addMessage(msg);
        msg = new DefaultMuleMessage("c1", muleContext);
        childCollection2.addMessage(msg);

        parentCollection.addMessage(childCollection1);
        parentCollection.addMessage(childCollection2);

        nestedForeach.process(getTestEvent(parentCollection));
View Full Code Here

        MuleMessage message1 = new DefaultMuleMessage("test event A", muleContext);
        MuleMessage message2 = new DefaultMuleMessage("test event B", muleContext);
        MuleMessage message3 = new DefaultMuleMessage("test event C", muleContext);
        MuleMessage message4 = new DefaultMuleMessage("test event D", muleContext);
        MuleMessageCollection messageCollection1 = new DefaultMessageCollection(muleContext);
        MuleMessageCollection messageCollection2 = new DefaultMessageCollection(muleContext);
        messageCollection1.addMessage(message1);
        messageCollection1.addMessage(message2);
        messageCollection2.addMessage(message3);
        messageCollection2.addMessage(message4);

        messageCollection1.setCorrelationGroupSize(2);
        messageCollection1.setCorrelationId(messageCollection1.getUniqueId());
        messageCollection2.setCorrelationGroupSize(2);
        messageCollection2.setCorrelationId(messageCollection1.getUniqueId());

        InboundEndpoint endpoint = MuleTestUtils.getTestInboundEndpoint(MessageExchangePattern.ONE_WAY,
            muleContext);
        MuleEvent event1 = new DefaultMuleEvent(messageCollection1, endpoint, testService);
        MuleEvent event2 = new DefaultMuleEvent(messageCollection2, endpoint, testService);
View Full Code Here

        MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, flow);

        MuleMessage message2 = new DefaultMuleMessage("test event B", muleContext);
        MuleMessage message3 = new DefaultMuleMessage("test event C", muleContext);

        MuleMessageCollection messageCollection = new DefaultMessageCollection(
            mock(MuleContext.class));
        messageCollection.setInvocationProperty("key2", "value2");
        messageCollection.addMessage(message2);
        messageCollection.addMessage(message3);
        MuleEvent event2 = new DefaultMuleEvent(messageCollection, endpoint, flow);

        MuleEvent result = resultsHandler.aggregateResults(Collections.<MuleEvent> singletonList(event2),
            event1, mock(MuleContext.class));
        assertSame(event2, result);
View Full Code Here

        MuleMessage message2 = new DefaultMuleMessage("test event B", muleContext);
        MuleMessage message3 = new DefaultMuleMessage("test event C", muleContext);
        MuleMessage message4 = new DefaultMuleMessage("test event D", muleContext);
        MuleMessage message5 = new DefaultMuleMessage("test event E", muleContext);

        MuleMessageCollection messageCollection = new DefaultMessageCollection(
            mock(MuleContext.class));
        messageCollection.setInvocationProperty("key2", "value2");
        messageCollection.addMessage(message2);
        messageCollection.addMessage(message3);
        MuleEvent event2 = new DefaultMuleEvent(messageCollection, endpoint, flow);

        MuleMessageCollection messageCollection2 = new DefaultMessageCollection(
            mock(MuleContext.class));
        messageCollection.setInvocationProperty("key3", "value3");
        messageCollection.addMessage(message4);
        messageCollection.addMessage(message5);
        MuleEvent event3 = new DefaultMuleEvent(messageCollection2, endpoint, flow);
View Full Code Here

TOP

Related Classes of org.mule.DefaultMessageCollection

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.