mirror of https://github.com/apache/lucene.git
SOLR-2717: Some tests annoyingly use a data dir under example/multicore/core0|1 - worse, more than one test does this, so sometimes they can stomp on each other.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1159304 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
74f13af83d
commit
277c674be0
|
@ -27,6 +27,7 @@
|
||||||
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
|
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
|
||||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
||||||
|
|
||||||
|
<dataDir>${solr.core0.data.dir:}</dataDir>
|
||||||
|
|
||||||
<updateHandler class="solr.DirectUpdateHandler2" />
|
<updateHandler class="solr.DirectUpdateHandler2" />
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
|
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
|
||||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
||||||
|
|
||||||
|
<dataDir>${solr.core1.data.dir:}</dataDir>
|
||||||
|
|
||||||
<updateHandler class="solr.DirectUpdateHandler2" />
|
<updateHandler class="solr.DirectUpdateHandler2" />
|
||||||
|
|
||||||
<requestDispatcher handleSelect="true" >
|
<requestDispatcher handleSelect="true" >
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.solr.core.CoreContainer;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.util.ExternalPaths;
|
import org.apache.solr.util.ExternalPaths;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,6 +39,7 @@ import java.io.IOException;
|
||||||
public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
||||||
// protected static final CoreContainer cores = new CoreContainer();
|
// protected static final CoreContainer cores = new CoreContainer();
|
||||||
protected static CoreContainer cores;
|
protected static CoreContainer cores;
|
||||||
|
private File dataDir2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSolrHome() {
|
public String getSolrHome() {
|
||||||
|
@ -54,12 +56,37 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
|
||||||
return getSolrHome() + "/core0/conf/solrconfig.xml";
|
return getSolrHome() + "/core0/conf/solrconfig.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
cores = h.getCoreContainer();
|
cores = h.getCoreContainer();
|
||||||
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
|
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
|
||||||
cores.setPersistent(false);
|
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
|
@Override
|
||||||
|
|
|
@ -41,6 +41,7 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
|
||||||
{
|
{
|
||||||
// protected static final CoreContainer cores = new CoreContainer();
|
// protected static final CoreContainer cores = new CoreContainer();
|
||||||
protected static CoreContainer cores;
|
protected static CoreContainer cores;
|
||||||
|
private File dataDir2;
|
||||||
|
|
||||||
@Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
|
@Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
|
||||||
|
|
||||||
|
@ -52,6 +53,26 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
|
||||||
cores = h.getCoreContainer();
|
cores = h.getCoreContainer();
|
||||||
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
|
SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
|
||||||
cores.setPersistent(false);
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue