652e086cc9f8094676b56043b9891e1b6defe19a
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / SslContextFactoryTest.java
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowjava.protocol.impl.core;
10
11 import static org.junit.Assert.assertNotNull;
12
13 import javax.net.ssl.SSLContext;
14
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.mockito.MockitoAnnotations;
18 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
19 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
22
23 /**
24  *
25  * @author jameshall
26  */
27 public class SslContextFactoryTest {
28
29     SslContextFactory sslContextFactory;
30     TlsConfiguration tlsConfiguration ;
31
32     /**
33      * Sets up test environment
34      */
35     @Before
36     public void setUp() {
37         MockitoAnnotations.initMocks(this);
38         tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
39                 PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH) ;
40         sslContextFactory = new SslContextFactory(tlsConfiguration);
41     }
42
43     /**
44      * @throws Exception 
45      */
46     @Test
47     public void testGetServerContext() throws Exception {
48         SSLContext context  = sslContextFactory.getServerContext() ;
49
50         assertNotNull( context );
51     }
52
53 }
54