View Javadoc

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