Coverage Report - org.mule.routing.outbound.SplitMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
SplitMessage
0%
0/7
N/A
1.571
SplitMessage$MessagePart
0%
0/16
0%
0/4
1.571
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.routing.outbound;
 8  
 
 9  
 import org.mule.api.endpoint.OutboundEndpoint;
 10  
 import org.mule.config.i18n.CoreMessages;
 11  
 
 12  
 import java.util.ArrayList;
 13  
 import java.util.List;
 14  
 
 15  
 /**
 16  
  * A Split message contains one or more message parts with an endpoint associated with each part.
 17  
  * This class is used by the Message Splitter routers ({@link org.mule.routing.outbound.AbstractRoundRobinMessageSplitter})
 18  
  * to define a mapping between message parts and the endpoint to dispatch on.
 19  
  */
 20  0
 public class SplitMessage
 21  
 {
 22  0
     private List parts = new ArrayList();
 23  
 
 24  
     public void addPart(Object part, OutboundEndpoint endpoint)
 25  
     {
 26  0
         parts.add(new MessagePart(endpoint, part));
 27  0
     }
 28  
 
 29  
     public MessagePart getPart(int i)
 30  
     {
 31  0
         return (MessagePart) parts.get(i);
 32  
     }
 33  
 
 34  
     public int size()
 35  
     {
 36  0
         return parts.size();
 37  
     }
 38  
 
 39  0
     public class MessagePart
 40  
     {
 41  
         private Object part;
 42  
         private OutboundEndpoint endpoint;
 43  
 
 44  
         public MessagePart(OutboundEndpoint endpoint, Object part)
 45  0
         {
 46  0
             if (endpoint == null)
 47  
             {
 48  0
                 throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter endpoint").getMessage());
 49  
             }
 50  
 
 51  0
             if (part == null)
 52  
             {
 53  0
                 throw new IllegalArgumentException(CoreMessages.objectIsNull("splitter messagePart").getMessage());
 54  
             }
 55  0
             this.endpoint = endpoint;
 56  0
             this.part = part;
 57  0
         }
 58  
 
 59  
         public OutboundEndpoint getEndpoint()
 60  
         {
 61  0
             return endpoint;
 62  
         }
 63  
 
 64  
         public Object getPart()
 65  
         {
 66  0
             return part;
 67  
         }
 68  
 
 69  
 
 70  
         public String toString()
 71  
         {
 72  0
             final StringBuffer sb = new StringBuffer();
 73  0
             sb.append("MessagePart");
 74  0
             sb.append("{endpoint=").append(endpoint.getName());
 75  0
             sb.append(", part=").append(part);
 76  0
             sb.append('}');
 77  0
             return sb.toString();
 78  
         }
 79  
     }
 80  
 }