View Javadoc

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