View Javadoc
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.test.filters;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.api.routing.filter.Filter;
11  
12  import java.util.concurrent.atomic.AtomicInteger;
13  
14  public class FilterCounter implements Filter
15  {
16      public static AtomicInteger counter = new AtomicInteger();
17      
18      /**
19       * Increments the counter if it passes the filter 
20       */
21      public boolean accept(MuleMessage message)
22      {
23          if ("true".equals(message.getInboundProperty("pass")))
24          {
25              counter.incrementAndGet();
26              return true;
27          }
28          return false;
29      }
30  
31      public boolean test(int arg0)
32      {
33          // TODO Auto-generated method stub
34          return false;
35      }
36  
37  }
38  
39