Merge "OPNFLWPLUG-929 : Remove deprecated guava library"
[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
9 package org.opendaylight.openflowjava.protocol.impl.core;
10
11 import static org.junit.Assert.assertNotNull;
12
13 import com.google.common.collect.Lists;
14 import javax.net.ssl.SSLContext;
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  * Unit tests for SslContextFactory.
25  *
26  * @author jameshall
27  */
28 public class SslContextFactoryTest {
29
30     SslContextFactory sslContextFactory;
31     TlsConfiguration tlsConfiguration ;
32
33     /**
34      * Sets up test environment.
35      */
36     @Before
37     public void setUp() {
38         MockitoAnnotations.initMocks(this);
39         tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
40                 PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH,
41                 Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ;
42         sslContextFactory = new SslContextFactory(tlsConfiguration);
43     }
44
45     @Test
46     public void testGetServerContext() throws Exception {
47         SSLContext context  = sslContextFactory.getServerContext() ;
48
49         assertNotNull(context);
50     }
51 }