View Javadoc

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