Coverage Report - org.mule.config.spring.factories.AbstractSelectiveRouterFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractSelectiveRouterFactoryBean
0%
0/12
0%
0/2
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.config.spring.factories;
 8  
 
 9  
 import java.util.Collection;
 10  
 
 11  
 import org.mule.api.processor.MessageProcessor;
 12  
 import org.mule.routing.AbstractSelectiveRouter;
 13  
 import org.mule.routing.MessageProcessorFilterPair;
 14  
 import org.springframework.beans.factory.FactoryBean;
 15  
 
 16  
 public abstract class AbstractSelectiveRouterFactoryBean implements FactoryBean
 17  
 {
 18  
     private MessageProcessor defaultProcessor;
 19  
     private Collection<MessageProcessorFilterPair> conditionalMessageProcessors;
 20  
 
 21  
     public AbstractSelectiveRouterFactoryBean()
 22  
     {
 23  0
         super();
 24  0
     }
 25  
 
 26  
     public void setDefaultRoute(MessageProcessorFilterPair conditionalProcessor)
 27  
     {
 28  0
         defaultProcessor = conditionalProcessor.getMessageProcessor();
 29  0
     }
 30  
 
 31  
     public void setRoutes(Collection<MessageProcessorFilterPair> conditionalMessageProcessors)
 32  
     {
 33  0
         this.conditionalMessageProcessors = conditionalMessageProcessors;
 34  0
     }
 35  
 
 36  
     public Object getObject() throws Exception
 37  
     {
 38  0
         final AbstractSelectiveRouter router = newAbstractSelectiveRouter();
 39  0
         router.setDefaultRoute(defaultProcessor);
 40  
 
 41  0
         for (final MessageProcessorFilterPair mpfp : conditionalMessageProcessors)
 42  
         {
 43  0
             router.addRoute(mpfp.getMessageProcessor(), mpfp.getFilter());
 44  
         }
 45  
 
 46  0
         return router;
 47  
     }
 48  
 
 49  
     protected abstract AbstractSelectiveRouter newAbstractSelectiveRouter();
 50  
 
 51  
     public boolean isSingleton()
 52  
     {
 53  0
         return true;
 54  
     }
 55  
 
 56  
 }