View Javadoc

1   /*
2    * $Id: JettyNamespaceHandlerTestCase.java 22503 2011-07-21 14:46:28Z dirk.olmes $
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  
11  package org.mule.transport.servlet.jetty;
12  
13  import org.mule.tck.junit4.FunctionalTestCase;
14  
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  import static org.junit.Assert.assertNotNull;
19  import static org.junit.Assert.assertTrue;
20  
21  public class JettyNamespaceHandlerTestCase extends FunctionalTestCase
22  {
23      public JettyNamespaceHandlerTestCase()
24      {
25          super();
26          setStartContext(false);
27      }
28  
29      @Override
30      protected String getConfigResources()
31      {
32          return "jetty-namespace-config.xml";
33      }
34  
35      @Test
36      public void checkConnectorProperties()
37      {
38          JettyHttpConnector connector =
39              (JettyHttpConnector) muleContext.getRegistry().lookupConnector("jettyConnector");
40          assertNotNull(connector.getConfigFile());
41          assertEquals("jetty-config.xml", connector.getConfigFile());
42      }
43  
44      @Test
45      public void checkSslConnectorProperties()
46      {
47          JettyHttpsConnector connector =
48              (JettyHttpsConnector) muleContext.getRegistry().lookupConnector("jettySslConnector");
49          //The full path gets resolved, we're just checking that the property got set
50          assertTrue(connector.getKeyStore().endsWith("/serverKeystore"));
51          assertEquals("muleserver", connector.getKeyAlias());
52          assertEquals("mulepassword", connector.getKeyPassword());
53          assertEquals("mulepassword", connector.getKeyStorePassword());
54          //The full path gets resolved, we're just checking that the property got set
55          assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore"));
56          assertEquals("mulepassword", connector.getClientKeyStorePassword());
57          //The full path gets resolved, we're just checking that the property got set
58          assertTrue(connector.getTrustStore().endsWith("/trustStore"));
59          assertEquals("mulepassword", connector.getTrustStorePassword());
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  }