View Javadoc

1   /*
2    * $Id$
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.test.filters;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.api.routing.filter.Filter;
15  
16  import java.util.concurrent.atomic.AtomicInteger;
17  
18  public class FilterCounter implements Filter
19  {
20      public static AtomicInteger counter = new AtomicInteger();
21      
22      /**
23       * Increments the counter if it passes the filter 
24       */
25      public boolean accept(MuleMessage message)
26      {
27          if ("true".equals(message.getInboundProperty("pass")))
28          {
29              counter.incrementAndGet();
30              return true;
31          }
32          return false;
33      }
34  
35      public boolean test(int arg0)
36      {
37          // TODO Auto-generated method stub
38          return false;
39      }
40  
41  }
42  
43