Coverage Report - org.mule.routing.inbound.CorrelationAggregator
 
Classes in this File Line Coverage Branch Coverage Complexity
CorrelationAggregator
0%
0/9
0%
0/6
2.5
 
 1  
 /*
 2  
  * $Id: CorrelationAggregator.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 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.inbound;
 12  
 
 13  
 import org.mule.umo.UMOEvent;
 14  
 
 15  
 /**
 16  
  * <code>CorrelationAggregator</code> uses the CorrelationID and
 17  
  * CorrelationGroupSize properties of the {@link org.mule.umo.UMOMessage} to manage
 18  
  * message groups.
 19  
  */
 20  0
 public abstract class CorrelationAggregator extends AbstractEventAggregator
 21  
 {
 22  
 
 23  
     /**
 24  
      * Creates a new EventGroup that will expect the number of events as returned by
 25  
      * {@link org.mule.umo.provider.UMOMessageAdapter#getCorrelationGroupSize()}.
 26  
      */
 27  
     // @Override
 28  
     protected EventGroup createEventGroup(UMOEvent event, Object groupId)
 29  
     {
 30  0
         return new EventGroup(groupId, event.getMessage().getCorrelationGroupSize());
 31  
     }
 32  
 
 33  
     /**
 34  
      * @see AbstractEventAggregator#shouldAggregateEvents(EventGroup)
 35  
      * @return <code>true</code> if the correlation size is not set or exactly the
 36  
      *         expected size of the event group.
 37  
      */
 38  
     protected boolean shouldAggregateEvents(EventGroup events)
 39  
     {
 40  0
         int size = events.expectedSize();
 41  
 
 42  0
         if (size == -1)
 43  
         {
 44  0
             logger.warn("Correlation Group Size not set, but CorrelationAggregator is being used."
 45  
                             + " Message is being forwarded");
 46  0
             return true;
 47  
         }
 48  
 
 49  0
         if (logger.isDebugEnabled())
 50  
         {
 51  0
             logger.debug("Correlation size is " + size + ". Current event group size is " + events.size()
 52  
                             + " for correlation " + events.getGroupId());
 53  
         }
 54  
 
 55  0
         return size == events.size();
 56  
     }
 57  
 
 58  
 }