2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowjava.protocol.api.connection;
10 import static org.junit.Assert.assertEquals;
12 import java.util.List;
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
18 * Unit tests for TlsConfigurationImpl.
20 * @author michal.polkorab
22 public class TlsConfigurationImplTest {
24 * Test correct TlsConfigurationImpl creation.
28 List<String> cipherSuites = List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256");
29 TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
30 "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH, cipherSuites);
31 assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
32 assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());
33 assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());
34 assertEquals("Wrong truststore type", KeystoreType.JKS, config.getTlsTruststoreType());
35 assertEquals("Wrong keystore path type", PathType.PATH, config.getTlsKeystorePathType());
36 assertEquals("Wrong truststore path type", PathType.CLASSPATH, config.getTlsTruststorePathType());
37 assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());
38 assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());
39 assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
40 assertEquals("Wrong cipher suites", cipherSuites, config.getCipherSuites());