View Javadoc

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