View Javadoc

1   /*
2    * $Id:  $
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.EntryReceiver;
14  import org.mule.module.atom.event.FeedReceiver;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.tck.functional.CounterCallback;
17  
18  public class JmsAtomFeedConsumeTestCase extends FunctionalTestCase
19  {
20      private final CounterCallback counter = new CounterCallback();
21  
22      @Override
23      protected String getConfigResources()
24      {
25          return "jms-atom-consume.xml";
26      }
27  
28      public void testConsumeFeed() throws Exception
29      {
30          LocalMuleClient client = muleContext.getClient();
31          FeedReceiver.receivedEntries.set(0);
32          String feed = loadResourceAsString("sample-feed.atom");
33          client.dispatch("jms://feed.in", feed, null);
34          Thread.sleep(2000);
35          assertEquals(25, FeedReceiver.receivedEntries.get());
36      }
37  
38      public void testConsumeSplitFeed() throws Exception
39      {
40          LocalMuleClient client = muleContext.getClient();
41          EntryReceiver.receivedEntries.set(0); //reset since the build reports that it's getting incremented someplace else
42          String feed = loadResourceAsString("sample-feed.atom");
43          client.dispatch("jms://feed.split.in", feed, null);
44          Thread.sleep(10000);                
45          assertEquals(25, EntryReceiver.receivedEntries.get());
46      }
47  }