Skip to content

Commit 6699580

Browse files
authored
HttpShardHandlerFactory urlScheme -- use sys prop for default (apache#4008)
HttpShardHandlerFactory reads the urlScheme from configuration, defaulting to "http" if there is none. Most/all solr.xml's we have, especially for tests, have this explicitly configured with urlScheme sys prop resolution. I think the factory should read that sys prop as a default, at least as a small improvement. This way, test JettySolrRunner stuff can start Solr in SSL mode without needing a solr.xml. Fixes DistributedDebugComponentTest and possibly more. SolrTestCaseJ4: don't use constants from ZkTestReader inappropriately. The affected lines are likely to be superseded by SOLR-18055
1 parent a4f26dd commit 6699580

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ private void initReplicaListTransformers(NamedList<?> routingConfig) {
224224
public void init(PluginInfo info) {
225225
StringBuilder sb = new StringBuilder();
226226
NamedList<?> args = info.initArgs;
227-
this.scheme = getParameter(args, INIT_URL_SCHEME, null, sb);
227+
// note: the sys prop is only used in testing
228+
this.scheme = getParameter(args, INIT_URL_SCHEME, System.getProperty(INIT_URL_SCHEME), sb);
228229
if (this.scheme != null && this.scheme.endsWith("://")) {
229230
this.scheme = this.scheme.replace("://", "");
230231
}

solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package org.apache.solr;
1818

1919
import static java.util.Objects.requireNonNull;
20-
import static org.apache.solr.common.cloud.ZkStateReader.HTTPS;
21-
import static org.apache.solr.common.cloud.ZkStateReader.URL_SCHEME;
2220
import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
2321
import static org.hamcrest.core.StringContains.containsString;
2422

@@ -291,7 +289,7 @@ public static void setupTestCases() {
291289
HttpJettySolrClient.setDefaultSSLConfig(sslConfig.buildClientSSLConfig());
292290
if (isSSLMode()) {
293291
// SolrCloud tests should usually clear this
294-
System.setProperty(URL_SCHEME, HTTPS);
292+
System.setProperty("urlScheme", "https");
295293
}
296294

297295
ExecutorUtil.resetThreadLocalProviders();
@@ -325,7 +323,7 @@ public static void teardownTestCases() throws Exception {
325323
System.clearProperty("tests.shardhandler.randomSeed");
326324
System.clearProperty("solr.index.updatelog.enabled");
327325
System.clearProperty("useCompoundFile");
328-
System.clearProperty(URL_SCHEME);
326+
System.clearProperty("urlScheme");
329327
System.clearProperty("solr.cloud.wait-for-updates-with-stale-state-pause");
330328
System.clearProperty("solr.zkclienttmeout");
331329
HttpClientUtil.resetHttpClientBuilder();

0 commit comments

Comments
 (0)