mirror of https://github.com/apache/lucene.git
do not write to test-files dir, use dirs that are less likely to collide for jettys
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1388492 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
468a6650e7
commit
b8f9525142
|
@ -27,7 +27,6 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import javax.xml.xpath.XPathExpressionException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.lucene.search.MatchAllDocsQuery;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -43,19 +42,22 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
|
|||
|
||||
|
||||
public void testShareSchema() throws IOException, ParserConfigurationException, SAXException {
|
||||
final File workDir = new File(TEMP_DIR, this.getClass().getName());
|
||||
|
||||
if (workDir.exists()) {
|
||||
FileUtils.deleteDirectory(workDir);
|
||||
final File solrHomeDirectory = new File(TEMP_DIR, this.getClass().getName()
|
||||
+ "_shareSchema");
|
||||
|
||||
if (solrHomeDirectory.exists()) {
|
||||
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||
}
|
||||
assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
|
||||
assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
|
||||
|
||||
String solrHome = SolrResourceLoader.locateSolrHome();
|
||||
File fconf = new File(solrHome, "solr.xml");
|
||||
FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME()), solrHomeDirectory);
|
||||
|
||||
final CoreContainer cores = new CoreContainer(solrHome);
|
||||
File fconf = new File(solrHomeDirectory, "solr.xml");
|
||||
|
||||
final CoreContainer cores = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||
System.setProperty("shareSchema", "true");
|
||||
cores.load(solrHome, fconf);
|
||||
cores.load(solrHomeDirectory.getAbsolutePath(), fconf);
|
||||
try {
|
||||
cores.setPersistent(false);
|
||||
assertTrue(cores.isShareSchema());
|
||||
|
@ -72,6 +74,7 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
|
|||
core2.close();
|
||||
} finally {
|
||||
cores.shutdown();
|
||||
System.clearProperty("shareSchema");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,8 +233,9 @@ public class TestCoreContainer extends SolrTestCaseJ4 {
|
|||
//assert cero cores
|
||||
assertEquals("There should not be cores", 0, cores.getCores().size());
|
||||
|
||||
FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME(), "collection1"), solrHomeDirectory);
|
||||
//add a new core
|
||||
CoreDescriptor coreDescriptor = new CoreDescriptor(cores, "core1", SolrTestCaseJ4.TEST_HOME() + "/collection1");
|
||||
CoreDescriptor coreDescriptor = new CoreDescriptor(cores, "core1", solrHomeDirectory.getAbsolutePath());
|
||||
SolrCore newCore = cores.create(coreDescriptor);
|
||||
cores.register(newCore, false);
|
||||
|
||||
|
|
|
@ -257,7 +257,12 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
System.setProperty("collection", "control_collection");
|
||||
String numShards = System.getProperty(ZkStateReader.NUM_SHARDS_PROP);
|
||||
System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
|
||||
controlJetty = createJetty(new File(getSolrHome()), testDir + "/control/data",
|
||||
|
||||
File controlJettyDir = new File(TEMP_DIR,
|
||||
getClass().getName() + "-controljetty-" + System.currentTimeMillis());
|
||||
org.apache.commons.io.FileUtils.copyDirectory(new File(getSolrHome()), controlJettyDir);
|
||||
|
||||
controlJetty = createJetty(controlJettyDir, testDir + "/control/data",
|
||||
"control_shard");
|
||||
System.clearProperty("collection");
|
||||
if(numShards != null) {
|
||||
|
@ -290,7 +295,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
if (sb.length() > 0) sb.append(',');
|
||||
int cnt = this.jettyIntCntr.incrementAndGet();
|
||||
File jettyDir = new File(TEMP_DIR,
|
||||
"solrtest-" + "jetty" + cnt + "-" + System.currentTimeMillis());
|
||||
getClass().getName() + "-jetty" + cnt + "-" + System.currentTimeMillis());
|
||||
jettyDir.mkdirs();
|
||||
org.apache.commons.io.FileUtils.copyDirectory(new File(getSolrHome()), jettyDir);
|
||||
JettySolrRunner j = createJetty(jettyDir, testDir + "/jetty"
|
||||
|
|
Loading…
Reference in New Issue