View Javadoc

1   /*
2    * $Id: FeedConsumeAndSplitExplicitNonHttpTestCase.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.rss;
11  
12  import org.mule.api.client.LocalMuleClient;
13  import org.mule.tck.FunctionalTestCase;
14  import org.mule.tck.functional.CounterCallback;
15  import org.mule.tck.functional.FunctionalTestComponent;
16  
17  public class FeedConsumeAndSplitExplicitNonHttpTestCase extends FunctionalTestCase
18  {
19      private final CounterCallback counter = new CounterCallback();
20  
21      @Override
22      protected String getConfigResources()
23      {
24          return "vm-rss-consume-and-explicit-split.xml";
25      }
26  
27      @Override
28      protected void doSetUp() throws Exception
29      {
30          FunctionalTestComponent comp = (FunctionalTestComponent)getComponent("feedConsumer");
31          comp.setEventCallback(counter);
32      }
33  
34      public void testConsume() throws Exception
35      {
36          LocalMuleClient client = muleContext.getClient();
37          String feed = loadResourceAsString("sample-feed.rss");
38          client.dispatch("vm://feed.in", feed, null);
39          Thread.sleep(2000);
40          int count = counter.getCallbackCount();
41          assertEquals(25, count);
42      }
43  }