View Javadoc

1   /*
2    * $Id: JmsAtomFeedConsumeTestCase.java 20320 2010-11-24 15:03:31Z dfeist $
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.FunctionalTestCase;
15  
16  public class JmsAtomFeedConsumeTestCase extends FunctionalTestCase
17  {
18      @Override
19      protected String getConfigResources()
20      {
21          return "jms-atom-consume.xml";
22      }
23  
24      public void testConsumeFeed() throws Exception
25      {
26          LocalMuleClient client = muleContext.getClient();
27          FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
28          component.getReceivedEntries().set(0);
29          String feed = loadResourceAsString("sample-feed.atom");
30          client.dispatch("jms://feed.in", feed, null);
31          Thread.sleep(2000);
32          assertEquals(25, component.getCount());
33      }
34  
35      public void testConsumeSplitFeed() throws Exception
36      {
37          LocalMuleClient client = muleContext.getClient();
38          FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
39          component.getReceivedEntries().set(0); //reset since the build reports that it's getting incremented someplace else
40          String feed = loadResourceAsString("sample-feed.atom");
41          client.dispatch("jms://feed.split.in", feed, null);
42          Thread.sleep(5000);                
43          assertEquals(25, component.getCount());
44      }
45  }