diff --git a/solr/example/multicore/core0/conf/solrconfig.xml b/solr/example/multicore/core0/conf/solrconfig.xml
index f8ba12efc37..64ea8fa2d76 100644
--- a/solr/example/multicore/core0/conf/solrconfig.xml
+++ b/solr/example/multicore/core0/conf/solrconfig.xml
@@ -27,6 +27,7 @@
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
+ ${solr.core0.data.dir:}
diff --git a/solr/example/multicore/core1/conf/solrconfig.xml b/solr/example/multicore/core1/conf/solrconfig.xml
index f92d54e8f9c..9d2c68ecd7b 100644
--- a/solr/example/multicore/core1/conf/solrconfig.xml
+++ b/solr/example/multicore/core1/conf/solrconfig.xml
@@ -27,6 +27,8 @@
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
+ ${solr.core1.data.dir:}
+
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
index 95f408057ef..25fc124313d 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
@@ -27,6 +27,7 @@ import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.util.ExternalPaths;
+import java.io.File;
import java.io.IOException;
/**
@@ -38,6 +39,7 @@ import java.io.IOException;
public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
// protected static final CoreContainer cores = new CoreContainer();
protected static CoreContainer cores;
+ private File dataDir2;
@Override
public String getSolrHome() {
@@ -54,12 +56,37 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
return getSolrHome() + "/core0/conf/solrconfig.xml";
}
- @Override
public void setUp() throws Exception {
+ System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
super.setUp();
+
cores = h.getCoreContainer();
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
cores.setPersistent(false);
+
+ // setup datadirs
+ System.setProperty( "solr.core0.data.dir", this.dataDir.getCanonicalPath() );
+
+ dataDir2 = new File(TEMP_DIR, getClass().getName() + "-"
+ + System.currentTimeMillis());
+ dataDir2.mkdirs();
+
+ System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ String skip = System.getProperty("solr.test.leavedatadir");
+ if (null != skip && 0 != skip.trim().length()) {
+ System.err.println("NOTE: per solr.test.leavedatadir, dataDir2 will not be removed: " + dataDir2.getAbsolutePath());
+ } else {
+ if (!recurseDelete(dataDir2)) {
+ System.err.println("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!");
+ }
+ }
+
}
@Override
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
index c74ffd4c20b..187d92b0037 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
@@ -41,7 +41,8 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
{
// protected static final CoreContainer cores = new CoreContainer();
protected static CoreContainer cores;
-
+ private File dataDir2;
+
@Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
@Override public String getSchemaFile() { return getSolrHome()+"/core0/conf/schema.xml"; }
@@ -52,6 +53,26 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
cores = h.getCoreContainer();
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
cores.setPersistent(false);
+
+ dataDir2 = new File(TEMP_DIR, getClass().getName() + "-"
+ + System.currentTimeMillis());
+ dataDir2.mkdirs();
+
+ System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ String skip = System.getProperty("solr.test.leavedatadir");
+ if (null != skip && 0 != skip.trim().length()) {
+ System.err.println("NOTE: per solr.test.leavedatadir, dataDir2 will not be removed: " + dataDir2.getAbsolutePath());
+ } else {
+ if (!recurseDelete(dataDir2)) {
+ System.err.println("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!");
+ }
+ }
}
@Override