cf00ef7a168901cad547a2b5f71fe55e28e73f18
[openflowplugin.git] / openflowjava / 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 package org.opendaylight.openflowjava.protocol.impl.core;
9
10 import static org.junit.Assert.assertNotNull;
11
12 import java.util.List;
13 import javax.net.ssl.SSLContext;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
17 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
20
21 /**
22  * Unit tests for SslContextFactory.
23  *
24  * @author jameshall
25  */
26 public class SslContextFactoryTest {
27
28     SslContextFactory sslContextFactory;
29     TlsConfiguration tlsConfiguration ;
30
31     /**
32      * Sets up test environment.
33      */
34     @Before
35     public void setUp() {
36         tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
37                 PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH,
38                 List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
39         sslContextFactory = new SslContextFactory(tlsConfiguration);
40     }
41
42     @Test
43     public void testGetServerContext() {
44         SSLContext context  = sslContextFactory.getServerContext() ;
45
46         assertNotNull(context);
47     }
48 }