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.api.client.LocalMuleClient;
10  import org.mule.module.atom.event.FeedReceiver;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertEquals;
16  
17  public class JmsAtomFeedConsumeTestCase extends FunctionalTestCase
18  {
19  
20      @Override
21      protected String getConfigResources()
22      {
23          return "jms-atom-consume.xml";
24      }
25  
26      @Test
27      public void testConsumeFeed() throws Exception
28      {
29          LocalMuleClient client = muleContext.getClient();
30          FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
31          component.getReceivedEntries().set(0);
32          String feed = loadResourceAsString("sample-feed.atom");
33          client.dispatch("jms://feed.in", feed, null);
34          Thread.sleep(2000);
35          assertEquals(25, component.getCount());
36      }
37  
38      @Test
39      public void testConsumeSplitFeed() throws Exception
40      {
41          LocalMuleClient client = muleContext.getClient();
42          FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
43          component.getReceivedEntries().set(0); //reset since the build reports that it's getting incremented someplace else
44          String feed = loadResourceAsString("sample-feed.atom");
45          client.dispatch("jms://feed.split.in", feed, null);
46          Thread.sleep(5000);                
47          assertEquals(25, component.getCount());
48      }
49  
50  }