Coverage Report - org.mule.routing.outbound.OutboundPassThroughRouter
 
Classes in this File Line Coverage Branch Coverage Complexity
OutboundPassThroughRouter
12%
2/16
0%
0/10
2.8
 
 1  
 /*
 2  
  * $Id: OutboundPassThroughRouter.java 10961 2008-02-22 19:01:02Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.routing.outbound;
 12  
 
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.MuleSession;
 15  
 import org.mule.api.endpoint.OutboundEndpoint;
 16  
 import org.mule.api.routing.RoutingException;
 17  
 import org.mule.api.routing.filter.Filter;
 18  
 
 19  
 import java.util.List;
 20  
 
 21  
 /**
 22  
  * <code>OutboundPassThroughRouter</code> allows outbound routing over a single
 23  
  * endpoint without any filtering. This class is used by Mule when a single outbound
 24  
  * router is set on a UMODescriptor.
 25  
  * 
 26  
  */
 27  
 public class OutboundPassThroughRouter extends FilteringOutboundRouter
 28  
 {
 29  
     public OutboundPassThroughRouter()
 30  
     {
 31  384
         super();
 32  384
     }
 33  
 
 34  
 
 35  
     public void addEndpoint(OutboundEndpoint endpoint)
 36  
     {
 37  0
         if (endpoint == null)
 38  
         {
 39  0
             return;
 40  
         }
 41  0
         if (endpoints.size() == 1)
 42  
         {
 43  0
             throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router");
 44  
         }
 45  0
         super.addEndpoint(endpoint);
 46  0
     }
 47  
 
 48  
     public void setEndpoints(List endpoints)
 49  
     {
 50  0
         if (endpoints.size() > 1)
 51  
         {
 52  0
             throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router");
 53  
         }
 54  0
         super.setEndpoints(endpoints);
 55  0
     }
 56  
 
 57  
     public void setFilter(Filter filter)
 58  
     {
 59  0
         throw new UnsupportedOperationException(
 60  
             "The Pass Through cannot use filters, use the FilteringOutboundRouter instead");
 61  
     }
 62  
 
 63  
     public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous)
 64  
         throws RoutingException
 65  
     {
 66  0
         if (endpoints == null || endpoints.size() == 0)
 67  
         {
 68  0
             return message;
 69  
         }
 70  0
         return super.route(message, session, synchronous);
 71  
     }
 72  
 }