Add method to register listener for unknown msg
[openflowjava.git] / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / connection / TlsConfigurationImplTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. 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.api.connection;
10
11 import static org.junit.Assert.*;
12
13 import java.util.List;
14
15 import org.junit.Test;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
18
19 import com.google.common.collect.Lists;
20
21 /**
22  * @author michal.polkorab
23  *
24  */
25 public class TlsConfigurationImplTest {
26
27     /**
28      * Test correct TlsConfigurationImpl creation
29      */
30     @Test
31     public void test() {
32         List<String> cipherSuites = Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256");
33         TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
34                 "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH, cipherSuites);
35         assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
36         assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());
37         assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());
38         assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());
39         assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());
40         assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());
41         assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());
42         assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());
43         assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
44         assertEquals("Wrong cipher suites", cipherSuites, config.getCipherSuites());
45     }
46 }