You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2017/06/02 10:56:49 UTC

[26/38] lucene-solr:jira/solr-8668: SOLR-10791: Remove deprecated options in SSLTestConfig

SOLR-10791: Remove deprecated options in SSLTestConfig


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fb3d3f1c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fb3d3f1c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fb3d3f1c

Branch: refs/heads/jira/solr-8668
Commit: fb3d3f1c9296734576a70b80f61b497eccc8ebd5
Parents: c88c524
Author: Chris Hostetter <ho...@apache.org>
Authored: Thu Jun 1 10:50:58 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Thu Jun 1 10:50:58 2017 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |   2 +
 .../server/etc/test/create-solrtest.keystore.sh |  37 ------------
 solr/server/etc/test/solrtest.keystore          | Bin 2208 -> 0 bytes
 .../solrj/impl/BasicHttpSolrClientTest.java     |  16 -----
 .../org/apache/solr/util/SSLTestConfig.java     |  58 +++----------------
 5 files changed, 10 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb3d3f1c/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 4159318..106a4df 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -213,6 +213,8 @@ Other Changes
 
 * SOLR-10792: Deprecate and remove implicit registration of "lucenePlusSort" aka OldLuceneQParser (hossman)
 
+* SOLR-10791: Remove deprecated options in SSLTestConfig (hossman)
+
 ==================  6.7.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb3d3f1c/solr/server/etc/test/create-solrtest.keystore.sh
----------------------------------------------------------------------
diff --git a/solr/server/etc/test/create-solrtest.keystore.sh b/solr/server/etc/test/create-solrtest.keystore.sh
deleted file mode 100755
index 36c5f0d..0000000
--- a/solr/server/etc/test/create-solrtest.keystore.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash -ex
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-############
- 
-# This script shows how the solrtest.keystore file used for solr tests 
-# was generated.
-#
-# Running this script should only be necessary if the keystore file
-# needs to be replaced, which shouldn't be required until sometime around
-# the year 4751.
-#
-# NOTE: the "-ext" option used in the "keytool" command requires that you have
-# the java7 version of keytool, but the generated key will work with any 
-# version of java
-
-echo "### remove old keystore"
-rm -f solrtest.keystore
-
-echo "### create keystore and keys"
-keytool -keystore solrtest.keystore -storepass "secret" -alias solrtest -keypass "secret" -genkey -keyalg RSA -dname "cn=localhost, ou=SolrTest, o=lucene.apache.org, c=US" -ext "san=ip:127.0.0.1" -validity 999999
-
-

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb3d3f1c/solr/server/etc/test/solrtest.keystore
----------------------------------------------------------------------
diff --git a/solr/server/etc/test/solrtest.keystore b/solr/server/etc/test/solrtest.keystore
deleted file mode 100644
index bcc6ec0..0000000
Binary files a/solr/server/etc/test/solrtest.keystore and /dev/null differ

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb3d3f1c/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
index 4addce3..a5b45a2 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrClientTest.java
@@ -71,7 +71,6 @@ import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SuppressForbidden;
-import org.apache.solr.util.SSLTestConfig;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -623,21 +622,6 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
   }
 
   /**
-   * A trivial test that verifies the example keystore used for SSL testing can be 
-   * found using the base class. this helps future-proof against the possibility of 
-   * something moving/breaking the keystore path in a way that results in the SSL 
-   * randomization logic being forced to silently never use SSL.  (We can't enforce 
-   * this type of check in the base class because then it would not be usable by client 
-   * code depending on the test framework
-   */
-  public void testExampleKeystorePath() {
-    assertNotNull("Example keystore is null, meaning that something has changed in the " +
-                  "structure of the example configs and/or ExternalPaths.java - " + 
-                  "SSL randomization is broken",
-                  SSLTestConfig.TEST_KEYSTORE);
-  }
-
-  /**
    * An interceptor changing the request
    */
   HttpRequestInterceptor changeRequestInterceptor = new HttpRequestInterceptor() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fb3d3f1c/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java
index 7dc0275..b60efdb 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java
@@ -16,7 +16,6 @@
  */
 package org.apache.solr.util;
 
-import java.io.File;
 import java.util.Random;
 import java.security.KeyManagementException;
 import java.security.KeyStore;
@@ -51,14 +50,6 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
  */
 public class SSLTestConfig extends SSLConfig {
 
-  /** @deprecated No longer used except by {@link #setSSLSystemProperties} */
-  public static File TEST_KEYSTORE = ExternalPaths.SERVER_HOME == null ? null
-    : new File(ExternalPaths.SERVER_HOME, "../etc/test/solrtest.keystore");
-  
-  /** @deprecated No longer used except by {@link #setSSLSystemProperties} */
-  private static String TEST_KEYSTORE_PATH = TEST_KEYSTORE != null
-    && TEST_KEYSTORE.exists() ? TEST_KEYSTORE.getAbsolutePath() : null;
-
   private static final String TEST_KEYSTORE_RESOURCE = "SSLTestConfig.testing.keystore";
   private static final String TEST_KEYSTORE_PASSWORD = "secret";
 
@@ -87,17 +78,6 @@ public class SSLTestConfig extends SSLConfig {
     }
   }
 
-  /** 
-   * Create an SSLTestConfig using explicit paths for files 
-   * @deprecated - use {@link SSLConfig} directly
-   */
-  @Deprecated
-  public SSLTestConfig(boolean useSSL, boolean clientAuth, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword) {
-    super(useSSL, clientAuth, keyStore, keyStorePassword, trustStore, trustStorePassword);
-    this.keyStore = tryNewResource(keyStore, "KeyStore");
-    this.trustStore = tryNewResource(trustStore, "TrustStore");
-  }
-
   /**
    * Helper utility for building resources from arbitrary user input paths/urls
    * if input is null, returns null; otherwise attempts to build Resource and verifies that Resource exists.
@@ -118,19 +98,21 @@ public class SSLTestConfig extends SSLConfig {
     return result;
   }
 
-  /** NOTE: This method is meaningless unless you explicitly provide paths when constructing this instance 
-   * @see #SSLTestConfig(boolean,boolean,String,String,String,String)
+  /** 
+   * NOTE: This method is meaningless in SSLTestConfig.
+   * @return null
    */
   @Override
   public String getKeyStore() {
-    return super.getKeyStore();
+    return null;
   }
-  /** NOTE: This method is meaningless unless you explicitly provide paths when constructing this instance 
-   * @see #SSLTestConfig(boolean,boolean,String,String,String,String)
+  /** 
+   * NOTE: This method is meaningless in SSLTestConfig.
+   * @return null
    */
   @Override
   public String getTrustStore() {
-    return super.getTrustStore();
+    return null;
   }
   
   /**
@@ -302,30 +284,6 @@ public class SSLTestConfig extends SSLConfig {
   }
 
   /**
-   * @deprecated this method has very little practical use, in most cases you'll want to use 
-   * {@link SSLContext#setDefault} with {@link #buildClientSSLContext} instead.
-   */
-  @Deprecated
-  public static void setSSLSystemProperties() {
-    System.setProperty("javax.net.ssl.keyStore", TEST_KEYSTORE_PATH);
-    System.setProperty("javax.net.ssl.keyStorePassword", TEST_KEYSTORE_PASSWORD);
-    System.setProperty("javax.net.ssl.trustStore", TEST_KEYSTORE_PATH);
-    System.setProperty("javax.net.ssl.trustStorePassword", TEST_KEYSTORE_PASSWORD);
-  }
-  
-  /**
-   * @deprecated this method has very little practical use, in most cases you'll want to use 
-   * {@link SSLContext#setDefault} with {@link #buildClientSSLContext} instead.
-   */
-  @Deprecated
-  public static void clearSSLSystemProperties() {
-    System.clearProperty("javax.net.ssl.keyStore");
-    System.clearProperty("javax.net.ssl.keyStorePassword");
-    System.clearProperty("javax.net.ssl.trustStore");
-    System.clearProperty("javax.net.ssl.trustStorePassword");
-  }
-
-  /**
    * A mocked up instance of SecureRandom that just uses {@link Random} under the covers.
    * This is to prevent blocking issues that arise in platform default 
    * SecureRandom instances due to too many instances / not enough random entropy.