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.protocol.pcep.impl.tls.SslContextFactory;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.StoreType;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
21 public class SslContextFactoryTest {
24 public void testSslContextFactory() {
25 final SslContextFactory sslContextFactory = new SslContextFactory(createTlsConfig());
26 final SSLContext sslContext = sslContextFactory.getServerContext();
27 assertNotNull(sslContext);
30 public static Tls createTlsConfig() {
31 return new TlsBuilder().setCertificatePassword("opendaylight").setKeystore("/exemplary-ctlKeystore")
32 .setKeystorePassword("opendaylight").setKeystorePathType(PathType.CLASSPATH)
33 .setKeystoreType(StoreType.JKS).setTruststore("/exemplary-ctlTrustStore")
34 .setTruststorePassword("opendaylight").setTruststorePathType(PathType.CLASSPATH)
35 .setTruststoreType(StoreType.JKS).build();