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