SOLR-2282: use solr home properly in the test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1058393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2011-01-13 02:39:35 +00:00
parent cfcaa9edcc
commit 3478bb9358
2 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,12 @@ import org.junit.Ignore;
public class DistributedClusteringComponentTest extends public class DistributedClusteringComponentTest extends
BaseDistributedSearchTestCase { BaseDistributedSearchTestCase {
@Override
public String getSolrHome() {
// TODO: this should work with just "solr-clustering"...
return getFile("solr-clustering").getAbsolutePath();
}
@Override @Override
public void doTest() throws Exception { public void doTest() throws Exception {
del("*:*"); del("*:*");

View File

@ -124,12 +124,21 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
return randVals; return randVals;
} }
/**
* Subclasses can override this to change a test's solr home
* (default is in test-files)
*/
public String getSolrHome() {
return SolrTestCaseJ4.TEST_HOME;
}
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with ignore_exception in it SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with ignore_exception in it
super.setUp(); super.setUp();
System.setProperty("solr.test.sys.prop1", "propone"); System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo"); System.setProperty("solr.test.sys.prop2", "proptwo");
System.setProperty("solr.solr.home", getSolrHome());
testDir = new File(TEMP_DIR, testDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis()); getClass().getName() + "-" + System.currentTimeMillis());
testDir.mkdirs(); testDir.mkdirs();