Skip to content

Apache Lucene open-source search software

SOLR-2282: use solr home properly in the test

Koji Sekiguchi3478bb935862
diff --git a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java
index 1b815b2cb0d..51c9726d95f 100644
--- a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java
+++ b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/DistributedClusteringComponentTest.java
@@ -26,6 +26,12 @@ import org.junit.Ignore;
public class DistributedClusteringComponentTest extends
BaseDistributedSearchTestCase {
+ @Override
+ public String getSolrHome() {
+ // TODO: this should work with just "solr-clustering"...
+ return getFile("solr-clustering").getAbsolutePath();
+ }
+
@Override
public void doTest() throws Exception {
del("*:*");
diff --git a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
index 945d54da3e1..33839c86c3d 100644
--- a/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
+++ b/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -124,12 +124,21 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
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
public void setUp() throws Exception {
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with ignore_exception in it
super.setUp();
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
+ System.setProperty("solr.solr.home", getSolrHome());
testDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
testDir.mkdirs();