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.http;
8   
9   
10  import org.junit.Test;
11  
12  import static org.junit.Assert.assertEquals;
13  import static org.junit.Assert.assertFalse;
14  import static org.junit.Assert.assertNotNull;
15  import static org.junit.Assert.assertTrue;
16  
17  public class HttpsNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase
18  {
19  
20      public HttpsNamespaceHandlerTestCase()
21      {
22          super("https");
23      }
24  
25      @Test
26      public void testConnectorProperties()
27      {
28          HttpsConnector connector =
29                  (HttpsConnector) muleContext.getRegistry().lookupConnector("httpsConnector");
30          testBasicProperties(connector);
31  
32          //The full path gets resolved, we're just checking that the property got set
33          assertTrue(connector.getKeyStore().endsWith("/serverKeystore"));
34          assertEquals("muleserver", connector.getKeyAlias());
35          assertEquals("mulepassword", connector.getKeyPassword());
36          assertEquals("mulepassword", connector.getKeyStorePassword());
37          //The full path gets resolved, we're just checking that the property got set
38          assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore"));
39          assertEquals("mulepassword", connector.getClientKeyStorePassword());
40          //The full path gets resolved, we're just checking that the property got set
41          assertTrue(connector.getTrustStore().endsWith("/trustStore"));
42          assertEquals("mulepassword", connector.getTrustStorePassword());
43          assertTrue(connector.isExplicitTrustStoreOnly());
44          assertTrue(connector.isRequireClientAuthentication());
45  
46          assertEquals("foo", connector.getProtocolHandler());
47      }
48  
49      @Test
50      public void testPollingProperties()
51      {
52           HttpsPollingConnector connector =
53                  (HttpsPollingConnector) muleContext.getRegistry().lookupConnector("polling");
54          assertNotNull(connector);
55          assertEquals(3456, connector.getPollingFrequency());
56          assertFalse(connector.isCheckEtag());
57          assertFalse(connector.isDiscardEmptyContent());
58      }
59  }