From 32a370e127836938ff14a4df1c2df6269c76e454 Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Tue, 23 Mar 2010 20:56:54 +0000 Subject: [PATCH] use random tmp data dir for more tests git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@926776 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/client/solrj/SolrExampleTestBase.java | 2 +- .../solr/client/solrj/embedded/JettyWebappTest.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java index 4260927ba09..b4dc835c622 100644 --- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java +++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java @@ -42,7 +42,7 @@ abstract public class SolrExampleTestBase extends AbstractSolrTestCase // this sets the property for jetty starting SolrDispatchFilter System.setProperty( "solr.solr.home", this.getSolrHome() ); - System.setProperty( "solr.data.dir", "./solr/data" ); + System.setProperty( "solr.data.dir", this.dataDir.getCanonicalPath() ); } /** diff --git a/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java b/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java index 6d91e211a06..7090c470663 100644 --- a/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java +++ b/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java @@ -17,6 +17,7 @@ package org.apache.solr.client.solrj.embedded; +import java.io.File; import java.net.URL; import junit.framework.TestCase; @@ -42,7 +43,12 @@ public class JettyWebappTest extends TestCase public void setUp() throws Exception { System.setProperty("solr.solr.home", "../../../example/solr"); - System.setProperty("solr.data.dir", "./solr/data"); + + File dataDir = new File(System.getProperty("java.io.tmpdir") + + System.getProperty("file.separator") + + getClass().getName() + "-" + System.currentTimeMillis()); + dataDir.mkdirs(); + System.setProperty("solr.data.dir", dataDir.getCanonicalPath()); String path = "../../webapp/web"; server = new Server(port);