View Javadoc

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