View Javadoc

1   /*
2    * $Id: NamespaceTestCase.java 19359 2010-09-03 20:03:08Z rossmason $
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.service.Service;
13  import org.mule.module.rss.endpoint.RssInboundEndpoint;
14  import org.mule.module.rss.routing.FeedSplitter;
15  import org.mule.service.ServiceCompositeMessageSource;
16  import org.mule.tck.FunctionalTestCase;
17  
18  import java.text.SimpleDateFormat;
19  
20  import junit.framework.Assert;
21  
22  public class NamespaceTestCase extends FunctionalTestCase
23  {
24      protected String getConfigResources()
25      {
26          return "namespace-config.xml";
27      }
28  
29      public void testEndpointConfig() throws Exception
30      {
31          Service service = muleContext.getRegistry().lookupService("test");
32          assertNotNull(service);
33          assertTrue(((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoints().get(0) instanceof RssInboundEndpoint);
34          RssInboundEndpoint ep = (RssInboundEndpoint) ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoints().get(0);
35          assertEquals(FeedSplitter.class, ep.getMessageProcessors().get(0).getClass());
36  
37          assertNotNull(ep.getLastUpdate());
38          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
39  
40          Assert.assertEquals(sdf.parse("2009-10-01"), ep.getLastUpdate());
41      }
42  }