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.ssl;
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 SslNamespaceHandlerTestCase extends FunctionalTestCase
18  {
19      @Override
20      protected String getConfigResources()
21      {
22          return "ssl-namespace-config.xml";
23      }
24  
25      @Test
26      public void checkConnectorProperties() throws Exception
27      {
28          SslConnector connector =
29                  (SslConnector) muleContext.getRegistry().lookupConnector("sslConnector");
30          assertNotNull(connector);
31          assertEquals(1024, connector.getSendBufferSize());
32          assertEquals(2048, connector.getReceiveBufferSize());
33          assertTrue(connector.isKeepAlive());
34  
35          //The full path gets resolved, we're just checkng that the property got set
36          assertTrue(connector.getKeyStore().endsWith("/serverKeystore"));
37          assertEquals("muleserver", connector.getKeyAlias());
38          assertEquals("mulepassword", connector.getKeyPassword());
39          assertEquals("mulepassword", connector.getKeyStorePassword());
40          //The full path gets resolved, we're just checkng that the property got set
41          assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore"));
42          assertEquals("mulepassword", connector.getClientKeyStorePassword());
43          //The full path gets resolved, we're just checkng that the property got set
44          assertTrue(connector.getTrustStore().endsWith("/trustStore"));
45          assertEquals("mulepassword", connector.getTrustStorePassword());
46          assertTrue(connector.isExplicitTrustStoreOnly());
47          assertTrue(connector.isRequireClientAuthentication());
48  
49          assertEquals("foo", connector.getProtocolHandler());
50      }
51  }