View Javadoc

1   /*
2    * $Id: FeedConsumeAndSplitExplicitTestCase.java 22450 2011-07-19 08:20:41Z dirk.olmes $
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  package org.mule.module.atom;
11  
12  import org.mule.tck.junit4.FunctionalTestCase;
13  import org.mule.tck.functional.CounterCallback;
14  import org.mule.tck.functional.FunctionalTestComponent;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertTrue;
20  
21  public class FeedConsumeAndSplitExplicitTestCase extends FunctionalTestCase
22  {
23  
24      private final CounterCallback counter = new CounterCallback();
25  
26      @Override
27      protected String getConfigResources()
28      {
29          return "atom-consume-and-explicit-split.xml";
30      }
31  
32      @Override
33      protected void doSetUp() throws Exception
34      {
35          FunctionalTestComponent comp = (FunctionalTestComponent)getComponent("feedConsumer");
36          comp.setEventCallback(counter);
37      }
38  
39      @Test
40      public void testConsume() throws Exception {
41          // add more time for build server
42          Thread.sleep(5000);
43          int count = counter.getCallbackCount();
44          assertTrue(count > 0);
45          Thread.sleep(5000);
46          //We should only receive entries once
47          assertEquals(count, counter.getCallbackCount());
48  
49      }
50  }