Maintaining code - remove unused class SslTrustManagerFactory 11/12311/1
authorMarian Adamjak <marian.adamjak@pantheon.sk>
Wed, 29 Oct 2014 08:45:55 +0000 (09:45 +0100)
committerMarian Adamjak <marian.adamjak@pantheon.sk>
Wed, 29 Oct 2014 08:49:05 +0000 (09:49 +0100)
Change-Id: I24a35c5c3ad6a06a27599f689f3de72ab1a47cc1
Signed-off-by: Marian Adamjak <marian.adamjak@pantheon.sk>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactory.java [deleted file]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactoryTest.java [deleted file]

diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactory.java
deleted file mode 100644 (file)
index 14f970c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2013 Pantheon Technologies s.r.o. 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 javax.net.ssl.ManagerFactoryParameters;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactorySpi;
-import javax.net.ssl.X509TrustManager;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.cert.X509Certificate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author michal.polkorab
- */
-public class SslTrustManagerFactory extends TrustManagerFactorySpi {
-
-    /**
-     * Logger for SslTrustManagerFactory
-     */
-    public static final Logger LOGGER = LoggerFactory.getLogger(SslTrustManagerFactory.class);
-    private static final TrustManager DUMMY_TRUST_MANAGER = new X509TrustManager() {
-        @Override
-        public X509Certificate[] getAcceptedIssuers() {
-            return new X509Certificate[0];
-        }
-
-        @Override
-        public void checkClientTrusted(X509Certificate[] chain, String authType) {
-            LOGGER.warn("UNKNOWN CLIENT CERTIFICATE: {}", chain[0].getSubjectDN());
-        }
-
-        @Override
-        public void checkServerTrusted(X509Certificate[] chain, String authType) {
-            LOGGER.warn("UNKNOWN SERVER CERTIFICATE: {}", chain[0].getSubjectDN());
-        }
-    };
-
-    /**
-     * Getter for TrustManagers
-     *
-     * @return TrustManager[]
-     */
-    public static TrustManager[] getTrustManagers() {
-        return new TrustManager[]{DUMMY_TRUST_MANAGER};
-    }
-
-    @Override
-    protected TrustManager[] engineGetTrustManagers() {
-        return getTrustManagers();
-    }
-
-    @Override
-    protected void engineInit(KeyStore ks) throws KeyStoreException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override
-    protected void engineInit(ManagerFactoryParameters mfp) throws InvalidAlgorithmParameterException {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-}
\ No newline at end of file
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactoryTest.java
deleted file mode 100644 (file)
index 2336284..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 static org.junit.Assert.assertTrue;
-
-import java.security.cert.X509Certificate;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-
-/**
- *
- * @author jameshall
- */
-public class SslTrustManagerFactoryTest {
-
-    /**
-     * Sets up test environment
-     */
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    /**
-     * 
-     */
-    @Test
-    public void testGetTrustManagers() throws Exception {
-        TrustManager[] tmArray  = SslTrustManagerFactory.getTrustManagers() ;
-
-        assertNotNull( tmArray );
-        for ( TrustManager tm : tmArray ) {
-            if ( tm.getClass() == X509TrustManager.class ) {
-                X509Certificate[] certsArray = ((X509TrustManager)tm).getAcceptedIssuers() ;
-                assertTrue( certsArray.length > 0 ) ;
-
-                //                Boolean caught = false;
-                //                try {
-                //                    ((X509TrustManager)tm).checkClientTrusted( certsArray, TrustManagerFactory.getDefaultAlgorithm()) ;
-                //                } catch (CertificateException ce) {
-                //                    caught = true ;
-                //                }
-                //                assertTrue( caught ) ;
-                //
-                //                caught = false;
-                //                try {
-                //                    ((X509TrustManager)tm).checkServerTrusted( certsArray, TrustManagerFactory.getDefaultAlgorithm()) ;
-                //                } catch (CertificateException ce) {
-                //                    caught = true ;
-                //                }
-                //                assertTrue( caught ) ;
-                //            }
-            }
-        }
-    }
-}
-