Apache Solr open-source search software
SOLR-10791: Remove deprecated options in SSLTestConfig
Chris Hostetterfb3d3f1c9296
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 4159318dbe4..106a4dfbf04 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.diff --git a/solr/server/etc/test/create-solrtest.keystore.sh b/solr/server/etc/test/create-solrtest.keystore.shdeleted file mode 100755index 36c5f0d3927..00000000000--- 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--diff --git a/solr/server/etc/test/solrtest.keystore b/solr/server/etc/test/solrtest.keystoredeleted file mode 100644index bcc6ec05d71..00000000000Binary files a/solr/server/etc/test/solrtest.keystore and /dev/null differdiff --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.javaindex 4addce32ce2..a5b45a2fbed 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;@@ -622,21 +621,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*/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.javaindex 7dc0275600e..b60efdbfade 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*/@Overridepublic 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*/@Overridepublic String getTrustStore() {- return super.getTrustStore();+ return null;}/**@@ -301,30 +283,6 @@ public class SSLTestConfig extends SSLConfig {return null;}- /**- * @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