9816c25003ca4de744edd6c358973b21a0efc206
[openflowjava.git] / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / connection / TlsConfigurationImplTest.java
1 /*\r
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.api.connection;\r
10 \r
11 import static org.junit.Assert.*;\r
12 \r
13 import org.junit.Test;\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
16 \r
17 /**\r
18  * @author michal.polkorab\r
19  *\r
20  */\r
21 public class TlsConfigurationImplTest {\r
22 \r
23     /**\r
24      * Test correct TlsConfigurationImpl creation\r
25      */\r
26     @Test\r
27     public void test() {\r
28         TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,\r
29                 "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH);\r
30         assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());\r
31         assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());\r
32         assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());\r
33         assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());\r
34         assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());\r
35         assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());\r
36         assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());\r
37         assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());\r
38         assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());\r
39     }\r
40 }