Add new revision for pcep types model
[bgpcep.git] / pcep / impl / src / test / java / org / opendaylight / protocol / pcep / impl / SslContextFactoryTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.protocol.pcep.impl;
10
11 import static org.junit.Assert.assertNotNull;
12 import javax.net.ssl.SSLContext;
13 import org.junit.Test;
14 import org.opendaylight.protocol.pcep.impl.tls.SslContextFactory;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.PathType;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.StoreType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.Tls;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.app.config.rev160707.pcep.dispatcher.config.TlsBuilder;
19
20 public class SslContextFactoryTest {
21
22     @Test
23     public void testSslContextFactory() {
24         final SslContextFactory sslContextFactory = new SslContextFactory(createTlsConfig());
25         final SSLContext sslContext = sslContextFactory.getServerContext();
26         assertNotNull(sslContext);
27     }
28
29     public static Tls createTlsConfig() {
30         return new TlsBuilder().setCertificatePassword("opendaylight").setKeystore("/exemplary-ctlKeystore")
31                 .setKeystorePassword("opendaylight").setKeystorePathType(PathType.CLASSPATH)
32                 .setKeystoreType(StoreType.JKS).setTruststore("/exemplary-ctlTrustStore")
33                 .setTruststorePassword("opendaylight").setTruststorePathType(PathType.CLASSPATH)
34                 .setTruststoreType(StoreType.JKS).build();
35     }
36 }