SOLR-9481: Fix test errors by using coreContainer.getSolrHome instead of SolrResourceLoader.locateSolrHome() in SecurityConfHandlerLocal

This commit is contained in:
Jan Høydahl 2016-10-26 16:39:22 +02:00
parent feb1a5d3e7
commit 24446f5085
3 changed files with 2 additions and 6 deletions

View File

@ -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");
}
/**

View File

@ -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);
}

View File

@ -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());