Coverage Report - org.mule.tck.functional.CounterCallback
 
Classes in this File Line Coverage Branch Coverage Complexity
CounterCallback
0%
0/10
N/A
1
 
 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.tck.functional;
 8  
 
 9  
 import org.mule.api.MuleEventContext;
 10  
 
 11  
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
 12  
 
 13  
 /**
 14  
  * A test callback that counts the number of messages received.
 15  
  */
 16  
 public class CounterCallback implements EventCallback
 17  
 {
 18  
     private AtomicInteger callbackCount;
 19  
 
 20  
     public CounterCallback()
 21  0
     {
 22  0
         callbackCount = new AtomicInteger(0);
 23  0
     }
 24  
 
 25  
     public CounterCallback(AtomicInteger callbackCount)
 26  0
     {
 27  0
         this.callbackCount = callbackCount;
 28  0
     }
 29  
 
 30  
     public void eventReceived(MuleEventContext context, Object Component) throws Exception
 31  
     {
 32  0
         incCallbackCount();
 33  0
     }
 34  
 
 35  
     /**
 36  
      * Increment callback count.
 37  
      * @return current count after increment
 38  
      */
 39  
     protected int incCallbackCount()
 40  
     {
 41  0
         return callbackCount.incrementAndGet();
 42  
     }
 43  
 
 44  
     public int getCallbackCount()
 45  
     {
 46  0
         return callbackCount.intValue();
 47  
     }
 48  
 }