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.jetty;
8   
9   import org.mule.tck.junit4.FunctionalTestCase;
10  
11  import org.junit.Test;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  import static org.junit.Assert.assertTrue;
16  
17  public class JettyNamespaceHandlerTestCase extends FunctionalTestCase
18  {
19      public JettyNamespaceHandlerTestCase()
20      {
21          super();
22          setStartContext(false);
23      }
24  
25      @Override
26      protected String getConfigResources()
27      {
28          return "jetty-namespace-config.xml";
29      }
30  
31      @Test
32      public void checkConnectorProperties()
33      {
34          JettyHttpConnector connector =
35              (JettyHttpConnector) muleContext.getRegistry().lookupConnector("jettyConnector");
36          assertNotNull(connector.getConfigFile());
37          assertEquals("jetty-config.xml", connector.getConfigFile());
38          // Test a abstract connector property (MULE-5776)
39          assertTrue(connector.isValidateConnections());
40      }
41  
42      @Test
43      public void checkSslConnectorProperties()
44      {
45          JettyHttpsConnector connector =
46              (JettyHttpsConnector) muleContext.getRegistry().lookupConnector("jettySslConnector");
47          //The full path gets resolved, we're just checking that the property got set
48          assertTrue(connector.getKeyStore().endsWith("/serverKeystore"));
49          assertEquals("muleserver", connector.getKeyAlias());
50          assertEquals("mulepassword", connector.getKeyPassword());
51          assertEquals("mulepassword", connector.getKeyStorePassword());
52          //The full path gets resolved, we're just checking that the property got set
53          assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore"));
54          assertEquals("mulepassword", connector.getClientKeyStorePassword());
55          //The full path gets resolved, we're just checking that the property got set
56          assertTrue(connector.getTrustStore().endsWith("/trustStore"));
57          assertEquals("mulepassword", connector.getTrustStorePassword());
58          // Test a abstract connector property (MULE-5776)
59          assertTrue(connector.isValidateConnections());
60      }
61  
62      /* See MULE-3603
63      @Test
64      public void testEndpointConfig() throws MuleException
65      {
66          InboundEndpoint endpoint =
67              muleContext.getRegistry().lookupEndpointBuilder("endpoint").buildInboundEndpoint();
68          assertNotNull(endpoint);
69          // is the following test correct?
70          // Can't test it now, the config for the endpoint isn't even valid
71          assertEquals("http://localhost:60223/", endpoint.getEndpointURI().getAddress());
72      }
73      */
74  
75  }