2 * Copyright (c) 2014 Brocade Communications 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.openflowjava.protocol.impl.core;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
14 import java.io.InputStream;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.mockito.MockitoAnnotations;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
25 public class SslKeyStoreTest {
28 * Sets up test environment
32 MockitoAnnotations.initMocks(this);
36 * Test keystore file access - via classpath
40 public void testAsInputStream() throws Exception {
41 InputStream inputStream = SslKeyStore.asInputStream("/key.bin", PathType.CLASSPATH);
42 assertNotNull( inputStream );
47 * Test keystore file access - via relative path
51 public void testAsInputStream2() throws Exception {
52 InputStream inputStream = SslKeyStore.asInputStream("src/test/resources/key.bin", PathType.PATH);
53 assertNotNull( inputStream );
58 * Test certificate password retrieval
61 public void testGetCertificatePassword() {
62 char[] password = SslKeyStore.getCertificatePassword();
63 assertNotNull(password);
64 assertTrue (password.length>0) ;
68 * Test keystore password retrieval
71 public void testGetKeyStorePassword() {
72 char[] password = SslKeyStore.getKeyStorePassword() ;
73 assertNotNull(password);
74 assertTrue (password.length>0) ;