From 24446f5085468627136e38ca8f874f383be9d3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Wed, 26 Oct 2016 16:39:22 +0200 Subject: [PATCH] SOLR-9481: Fix test errors by using coreContainer.getSolrHome instead of SolrResourceLoader.locateSolrHome() in SecurityConfHandlerLocal --- .../apache/solr/handler/admin/SecurityConfHandlerLocal.java | 3 ++- .../handler/admin/SecurityConfHandlerLocalForTesting.java | 4 ---- .../org/apache/solr/security/BasicAuthStandaloneTest.java | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java index d6745c5a6fe..985a070fbb3 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/SecurityConfHandlerLocal.java @@ -23,6 +23,7 @@ import java.io.OutputStream; import java.lang.invoke.MethodHandles; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Collections; import org.apache.solr.common.SolrException; @@ -43,7 +44,7 @@ public class SecurityConfHandlerLocal extends SecurityConfHandler { public SecurityConfHandlerLocal(CoreContainer coreContainer) { super(coreContainer); - securityJsonPath = SolrResourceLoader.locateSolrHome().resolve("security.json"); + securityJsonPath = Paths.get(coreContainer.getSolrHome()).resolve("security.json"); } /** diff --git a/solr/core/src/test/org/apache/solr/handler/admin/SecurityConfHandlerLocalForTesting.java b/solr/core/src/test/org/apache/solr/handler/admin/SecurityConfHandlerLocalForTesting.java index 92a18b1d7dc..e56dd5bc1cd 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/SecurityConfHandlerLocalForTesting.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/SecurityConfHandlerLocalForTesting.java @@ -20,20 +20,16 @@ package org.apache.solr.handler.admin; import java.io.IOException; import org.apache.solr.core.CoreContainer; -import org.apache.solr.core.SolrResourceLoader; /** * Wrapper for use in tests */ public class SecurityConfHandlerLocalForTesting extends SecurityConfHandlerLocal { - public SecurityConfHandlerLocalForTesting(CoreContainer coreContainer) { super(coreContainer); } public boolean persistConf(SecurityConfig securityConfig) throws IOException { - // Set JSON_PATH again since the test may have - securityJsonPath = SolrResourceLoader.locateSolrHome().resolve("security.json"); return super.persistConf(securityConfig); } diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java index 829ce9c3590..33c0ab31a60 100644 --- a/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java +++ b/solr/core/src/test/org/apache/solr/security/BasicAuthStandaloneTest.java @@ -70,7 +70,6 @@ public class BasicAuthStandaloneTest extends AbstractSolrTestCase { super.setUp(); instance = new SolrInstance("inst", null); instance.setUp(); - System.setProperty("solr.solr.home", instance.getHomeDir().toString()); jetty = createJetty(instance); initCore("solrconfig.xml", "schema.xml", instance.getHomeDir().toString()); securityConfHandler = new SecurityConfHandlerLocalForTesting(jetty.getCoreContainer());