Coverage Report - org.mule.service.processor.ServiceOutboundStatisticsMessageProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceOutboundStatisticsMessageProcessor
0%
0/10
0%
0/10
2.5
 
 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.service.processor;
 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.OutboundRouterCollection;
 13  
 import org.mule.api.service.Service;
 14  
 import org.mule.management.stats.ServiceStatistics;
 15  
 
 16  
 public class ServiceOutboundStatisticsMessageProcessor implements MessageProcessor
 17  
 {
 18  
 
 19  
     protected Service service;
 20  
 
 21  
     public ServiceOutboundStatisticsMessageProcessor(Service service)
 22  0
     {
 23  0
         this.service = service;
 24  0
     }
 25  
 
 26  
     public MuleEvent process(MuleEvent event) throws MuleException
 27  
     {
 28  0
         ServiceStatistics stats = service.getStatistics();
 29  0
         if (stats.isEnabled())
 30  
         {
 31  0
             if (!(service.getOutboundMessageProcessor() instanceof OutboundRouterCollection)
 32  
                 || (service.getOutboundMessageProcessor() instanceof OutboundRouterCollection && ((OutboundRouterCollection) service.getOutboundMessageProcessor()).hasEndpoints()))
 33  
             {
 34  0
                 if (event.getEndpoint().getExchangePattern().hasResponse())
 35  
                 {
 36  0
                     stats.incSentEventSync();
 37  
                 }
 38  
                 else
 39  
                 {
 40  0
                     stats.incSentEventASync();
 41  
                 }
 42  
             }
 43  
         }
 44  
 
 45  0
         return event;
 46  
     }
 47  
 }