TLS support
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / SslContextFactoryTest.java
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactoryTest.java
new file mode 100644 (file)
index 0000000..2457fd3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.core;
+
+import static org.junit.Assert.assertNotNull;
+
+import javax.net.ssl.SSLContext;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
+import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
+
+/**
+ *
+ * @author jameshall
+ */
+public class SslContextFactoryTest {
+
+    SslContextFactory sslContextFactory;
+    TlsConfiguration tlsConfiguration ;
+
+    /**
+     * Sets up test environment
+     */
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "src/main/resources/ctlTrustStore",
+                PathType.PATH, KeystoreType.JKS, "src/main/resources/ctlKeystore", PathType.PATH) ;
+        sslContextFactory = new SslContextFactory(tlsConfiguration);
+    }
+
+    /**
+     * @throws Exception 
+     */
+    @Test
+    public void testGetServerContext() throws Exception {
+        SSLContext context  = sslContextFactory.getServerContext() ;
+
+        assertNotNull( context );
+    }
+
+}
+