2 * Copyright (c) 2015 Cisco Systems, Inc. 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
9 package org.opendaylight.protocol.pcep.impl;
11 import static org.junit.Assert.assertNotNull;
13 import javax.net.ssl.SSLContext;
14 import org.junit.Test;
15 import org.opendaylight.controller.config.yang.pcep.impl.Tls;
16 import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.PathType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.StoreType;
20 public class SslContextFactoryTest {
23 public void testSslContextFactory() {
24 final SslContextFactory sslContextFactory = new SslContextFactory(createTlsConfig());
25 final SSLContext sslContext = sslContextFactory.getServerContext();
26 assertNotNull(sslContext);
29 public static Tls createTlsConfig() {
30 final Tls tlsConfig = new Tls();
31 tlsConfig.setCertificatePassword("opendaylight");
32 tlsConfig.setKeystore("/exemplary-ctlKeystore");
33 tlsConfig.setKeystorePassword("opendaylight");
34 tlsConfig.setKeystorePathType(PathType.CLASSPATH);
35 tlsConfig.setKeystoreType(StoreType.JKS);
36 tlsConfig.setTruststore("/exemplary-ctlTrustStore");
37 tlsConfig.setTruststorePassword("opendaylight");
38 tlsConfig.setTruststorePathType(PathType.CLASSPATH);
39 tlsConfig.setTruststoreType(StoreType.JKS);