View Javadoc

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