View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.servlet;
8   
9   import org.mule.api.endpoint.EndpointBuilder;
10  import org.mule.tck.junit4.FunctionalTestCase;
11  
12  import org.junit.Test;
13  
14  import static org.junit.Assert.assertEquals;
15  import static org.junit.Assert.assertNotNull;
16  import static org.junit.Assert.assertTrue;
17  
18  public class ServletNamespaceHandlerTestCase extends FunctionalTestCase
19  {
20  
21      @Override
22      protected String getConfigResources()
23      {
24          return "servlet-namespace-config.xml";
25      }
26  
27      @Test
28      public void testElements() throws Exception
29      {
30          ServletConnector connector =
31                  (ServletConnector) muleContext.getRegistry().lookupConnector("servletConnector");
32  
33          assertEquals("foo", connector.getServletUrl());
34          EndpointBuilder b = muleContext.getRegistry().lookupEndpointBuilder("ep");
35          assertNotNull(b);
36          assertEquals("foo/bar", b.buildInboundEndpoint().getEndpointURI().getAddress());
37          assertTrue(connector.isUseCachedHttpServletRequest());
38      }
39  
40  }