Coverage Report - org.mule.routing.outbound.OutboundPassThroughRouter
 
Classes in this File Line Coverage Branch Coverage Complexity
OutboundPassThroughRouter
0%
0/16
0%
0/10
0
 
 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.MuleEvent;
 10  
 import org.mule.api.MuleException;
 11  
 import org.mule.api.processor.MessageProcessor;
 12  
 import org.mule.api.routing.RoutingException;
 13  
 import org.mule.api.routing.filter.Filter;
 14  
 
 15  
 import java.util.List;
 16  
 
 17  
 /**
 18  
  * <code>OutboundPassThroughRouter</code> allows outbound routing over a single
 19  
  * endpoint without any filtering. This class is used by Mule when a single outbound
 20  
  * router is set on a Service.
 21  
  */
 22  
 public class OutboundPassThroughRouter extends FilteringOutboundRouter
 23  
 {
 24  
     public OutboundPassThroughRouter()
 25  
     {
 26  0
         super();
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public void addRoute(MessageProcessor target) throws MuleException
 31  
     {
 32  0
         if (target == null)
 33  
         {
 34  0
             return;
 35  
         }
 36  0
         if (routes.size() == 1)
 37  
         {
 38  0
             throw new IllegalArgumentException("Only one target can be set on the PassThrough router");
 39  
         }
 40  0
         super.addRoute(target);
 41  0
     }
 42  
 
 43  
     @Override
 44  
     public void setRoutes(List<MessageProcessor> endpoints) throws MuleException
 45  
     {
 46  0
         if (endpoints.size() > 1)
 47  
         {
 48  0
             throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router");
 49  
         }
 50  0
         super.setRoutes(endpoints);
 51  0
     }
 52  
 
 53  
     @Override
 54  
     public void setFilter(Filter filter)
 55  
     {
 56  0
         throw new UnsupportedOperationException(
 57  
             "The Pass Through cannot use filters, use the FilteringOutboundRouter instead");
 58  
     }
 59  
 
 60  
     @Override
 61  
     public MuleEvent route(MuleEvent event) throws RoutingException
 62  
     {
 63  0
         if (routes == null || routes.size() == 0)
 64  
         {
 65  0
             return event;
 66  
         }
 67  0
         return super.route(event);
 68  
     }
 69  
 }