SOLR-1214 followup -- Fix root cause of test failures by setting solrHome correctly for different scenarios

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@787967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-06-24 10:25:15 +00:00
parent f2343ea987
commit e340bce86d
2 changed files with 6 additions and 10 deletions

View File

@ -72,14 +72,10 @@ public class CoreContainer
protected Map<String ,IndexSchema> indexSchemaCache;
protected String adminHandler;
protected boolean shareSchema;
protected final String solrHome;
protected String solrHome;
@Deprecated
public CoreContainer() {
solrHome =".";
}
public CoreContainer(String home) {
solrHome =home;
solrHome = SolrResourceLoader.locateSolrHome();
}
public Properties getContainerProperties() {
@ -115,7 +111,7 @@ public class CoreContainer
log.info("looking for solr.xml: " + fconf.getAbsolutePath());
if (fconf.exists()) {
cores = new CoreContainer(solrHome);
cores = new CoreContainer();
cores.load(solrHome, fconf);
abortOnConfigurationError = false;
// if any core aborts on startup, then abort
@ -153,7 +149,6 @@ public class CoreContainer
*/
public CoreContainer(String dir, File configFile ) throws ParserConfigurationException, IOException, SAXException
{
solrHome = dir;
this.load(dir, configFile);
}
@ -163,7 +158,7 @@ public class CoreContainer
*/
public CoreContainer(SolrResourceLoader loader) {
this.loader = loader;
solrHome = loader.getInstanceDir();
this.solrHome = loader.getInstanceDir();
}
//-------------------------------------------------------------------
@ -181,6 +176,7 @@ public class CoreContainer
public void load(String dir, File configFile ) throws ParserConfigurationException, IOException, SAXException {
this.configFile = configFile;
this.loader = new SolrResourceLoader(dir);
solrHome = loader.getInstanceDir();
FileInputStream cfgis = new FileInputStream(configFile);
try {
Config cfg = new Config(loader, null, cfgis, null);

View File

@ -175,7 +175,7 @@ public class TestHarness {
}
@Override
public CoreContainer initialize() {
CoreContainer container = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateInstanceDir()));
CoreContainer container = new CoreContainer(new SolrResourceLoader(SolrResourceLoader.locateSolrHome()));
CoreDescriptor dcore = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstanceDir());
dcore.setConfigName(solrConfig.getResourceName());
dcore.setSchemaName(indexSchema.getResourceName());