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.rss;
8   
9   import org.mule.api.client.LocalMuleClient;
10  import org.mule.tck.junit4.FunctionalTestCase;
11  
12  import org.junit.Test;
13  
14  import static org.junit.Assert.assertEquals;
15  
16  public class JmsRssFeedConsumeTestCase extends FunctionalTestCase
17  {
18  
19      @Override
20      protected String getConfigResources()
21      {
22          return "jms-rss-consume.xml";
23      }
24  
25      @Test
26      public void testConsumeFeed() throws Exception
27      {
28          LocalMuleClient client = muleContext.getClient();
29          String feed = SampleFeed.feedAsString();
30          client.dispatch("jms://feed.in", feed, null);
31          Thread.sleep(3000);
32          FeedReceiver component = (FeedReceiver) getComponent("feedConsumer");
33          assertEquals(25, component.getCount());
34      }
35  
36      @Test
37      public void testConsumeSplitFeed() throws Exception
38      {
39          LocalMuleClient client = muleContext.getClient();
40          String feed = SampleFeed.feedAsString();
41          client.dispatch("jms://feed.split.in", feed, null);
42          Thread.sleep(3000);
43          EntryReceiver component = (EntryReceiver) getComponent("feedSplitterConsumer");
44          assertEquals(25, component.getCount());
45      }
46  }