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