lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject svn commit: r1582248 [3/4] - in /lucene/dev/branches/solr5914: ./ lucene/analysis/common/src/test/org/apache/lucene/analysis/util/ lucene/analysis/stempel/src/test/org/egothor/stemmer/ lucene/benchmark/src/test/org/apache/lucene/benchmark/ lucene/bench...
Date Thu, 27 Mar 2014 10:45:44 GMT
Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsBasicDistributedZkTest.java Thu Mar 27 10:45:40 2014
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.IOException;
 
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.cloud.BasicDistributedZkTest;
 import org.junit.AfterClass;
@@ -38,9 +39,7 @@ public class HdfsBasicDistributedZkTest 
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
   
   @AfterClass

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsChaosMonkeySafeLeaderTest.java Thu Mar 27 10:45:40 2014
@@ -17,11 +17,11 @@ package org.apache.solr.cloud.hdfs;
  * limitations under the License.
  */
 
-import java.io.File;
 import java.io.IOException;
 
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.cloud.ChaosMonkeySafeLeaderTest;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -39,9 +39,7 @@ public class HdfsChaosMonkeySafeLeaderTe
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
   
   @AfterClass

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsCollectionsAPIDistributedZkTest.java Thu Mar 27 10:45:40 2014
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.IOException;
 
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.cloud.CollectionsAPIDistributedZkTest;
 import org.junit.AfterClass;
@@ -38,9 +39,7 @@ public class HdfsCollectionsAPIDistribut
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsCollectionsAPIDistributedZkTest.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
     
     System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
     System.setProperty("solr.hdfs.blockcache.enabled", "false");

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsRecoveryZkTest.java Thu Mar 27 10:45:40 2014
@@ -38,9 +38,7 @@ public class HdfsRecoveryZkTest extends 
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
     System.setProperty("solr.hdfs.blockcache.blocksperbank", "2048");
   }
   

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsSyncSliceTest.java Thu Mar 27 10:45:40 2014
@@ -40,9 +40,7 @@ public class HdfsSyncSliceTest extends S
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
   
   @AfterClass

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsTestUtil.java Thu Mar 27 10:45:40 2014
@@ -13,6 +13,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 
 /*
@@ -38,11 +39,11 @@ public class HdfsTestUtil {
   
   private static Map<MiniDFSCluster,Timer> timers = new ConcurrentHashMap<>();
 
-  public static MiniDFSCluster setupClass(String dataDir) throws Exception {
+  public static MiniDFSCluster setupClass() throws Exception {
     LuceneTestCase.assumeFalse("HDFS tests were disabled by -Dtests.disableHdfs",
       Boolean.parseBoolean(System.getProperty("tests.disableHdfs", "false")));
-    File dir = new File(dataDir);
-    new File(dataDir).mkdirs();
+
+    File dir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
 
     savedLocale = Locale.getDefault();
     // TODO: we HACK around HADOOP-9643

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsUnloadDistributedZkTest.java Thu Mar 27 10:45:40 2014
@@ -21,6 +21,8 @@ import java.io.File;
 import java.io.IOException;
 
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.cloud.UnloadDistributedZkTest;
 import org.junit.AfterClass;
@@ -38,9 +40,7 @@ public class HdfsUnloadDistributedZkTest
   
   @BeforeClass
   public static void setupClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsUnloadDistributedZkTest.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
   
   @AfterClass

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java Thu Mar 27 10:45:40 2014
@@ -26,6 +26,8 @@ import java.util.List;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.NRTCachingDirectory;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Nightly;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -60,9 +62,7 @@ public class HdfsWriteToMultipleCollecti
   @BeforeClass
   public static void setupClass() throws Exception {
     schemaString = "schema15.xml";      // we need a string id
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
     System.setProperty(SOLR_HDFS_HOME, dfsCluster.getURI().toString() + "/solr");
   }
   

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java Thu Mar 27 10:45:40 2014
@@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
@@ -62,10 +63,7 @@ public class StressHdfsTest extends Basi
   
   @BeforeClass
   public static void setupClass() throws Exception {
-
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
     System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
   }
   
@@ -182,8 +180,7 @@ public class StressHdfsTest extends Basi
         NamedList<Object> response = c.query(
             new SolrQuery().setRequestHandler("/admin/system")).getResponse();
         NamedList<Object> coreInfo = (NamedList<Object>) response.get("core");
-        String dataDir = (String) ((NamedList<Object>) coreInfo
-            .get("directory")).get("data");
+        String dataDir = (String) ((NamedList<Object>) coreInfo.get("directory")).get("data");
         dataDirs.add(dataDir);
       } finally {
         c.shutdown();

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java Thu Mar 27 10:45:40 2014
@@ -17,18 +17,20 @@
 
 package org.apache.solr.core;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Map;
+import java.util.regex.Pattern;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.junit.After;
 import org.xml.sax.SAXParseException;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Map;
-import java.util.regex.Pattern;
-
 public class CoreContainerCoreInitFailuresTest extends SolrTestCaseJ4 {
   
   File solrHome = null;
@@ -37,8 +39,7 @@ public class CoreContainerCoreInitFailur
   private void init(final String dirSuffix) {
     // would be nice to do this in an @Before method,
     // but junit doesn't let @Before methods have test names
-    solrHome = new File(TEMP_DIR, this.getClass().getName() + "_" + dirSuffix);
-    assertTrue("Failed to mkdirs solrhome [" + solrHome + "]", solrHome.mkdirs());
+    solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + dirSuffix);
   }
 
   @After

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java Thu Mar 27 10:45:40 2014
@@ -30,7 +30,8 @@ import java.util.concurrent.atomic.Atomi
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.lucene.util.LuceneTestCase.BadApple;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@@ -86,9 +87,7 @@ public class OpenCloseCoreStressTest ext
     coreNames = new ArrayList<>();
     cumulativeDocs = 0;
 
-    solrHomeDirectory = new File(TEMP_DIR, "OpenCloseCoreStressTest_");
-    FileUtils.deleteDirectory(solrHomeDirectory); // Ensure that a failed test didn't leave something lying around.
-
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     jetty = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), "/solr", 0, null, null, true, null, sslConfig);
   }
 

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java Thu Mar 27 10:45:40 2014
@@ -60,7 +60,7 @@ public class ResourceLoaderTest extends 
   }
 
   public void testEscapeInstanceDir() throws Exception {
-    File temp = TestUtil.getTempDir("testEscapeInstanceDir");
+    File temp = TestUtil.createTempDir("testEscapeInstanceDir");
     try {
       temp.mkdirs();
       new File(temp, "dummy.txt").createNewFile();
@@ -170,7 +170,7 @@ public class ResourceLoaderTest extends 
   }
 
   public void testClassLoaderLibs() throws Exception {
-    File tmpRoot = TestUtil.getTempDir("testClassLoaderLibs");
+    File tmpRoot = TestUtil.createTempDir("testClassLoaderLibs");
 
     File lib = new File(tmpRoot, "lib");
     lib.mkdirs();

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java Thu Mar 27 10:45:40 2014
@@ -33,7 +33,8 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.Version;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.handler.SnapPuller;
@@ -73,11 +74,7 @@ public class TestArbitraryIndexDir exten
   public void setUp() throws Exception {
     super.setUp();
 
-    dataDir = new File(TEMP_DIR,
-        getClass().getName() + "-" + System.currentTimeMillis() + System.getProperty("file.separator") + "solr"
-        + System.getProperty("file.separator") + "data");
-    dataDir.mkdirs();
-
+    dataDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     solrConfig = TestHarness.createConfig(getSolrHome(), "solrconfig.xml");
     h = new TestHarness( dataDir.getAbsolutePath(),
         solrConfig,

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestConfigSets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestConfigSets.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestConfigSets.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestConfigSets.java Thu Mar 27 10:45:40 2014
@@ -17,21 +17,24 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.core.Is.is;
+import static org.junit.internal.matchers.StringContains.containsString;
+
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
-import java.io.File;
-import java.io.IOException;
-
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.core.Is.is;
-import static org.junit.internal.matchers.StringContains.containsString;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 public class TestConfigSets extends SolrTestCaseJ4 {
 
@@ -41,10 +44,7 @@ public class TestConfigSets extends Solr
   public static String solrxml = "<solr><str name=\"configSetBaseDir\">${configsets:configsets}</str></solr>";
 
   public CoreContainer setupContainer(String testName, String configSetsBaseDir) {
-
-    File testDirectory = new File(TEMP_DIR, testName);
-    testDirectory.mkdirs();
-
+    File testDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-" + testName);
     System.setProperty("configsets", configSetsBaseDir);
 
     SolrResourceLoader loader = new SolrResourceLoader(testDirectory.getAbsolutePath());
@@ -95,8 +95,7 @@ public class TestConfigSets extends Solr
 
   @Test
   public void testConfigSetOnCoreReload() throws IOException {
-    File testDirectory = new File(TEMP_DIR, "core-reload");
-    testDirectory.mkdirs();
+    File testDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "-core-reload");
     File configSetsDir = new File(testDirectory, "configsets");
 
     FileUtils.copyDirectory(getFile("solr/configsets"), configSetsDir);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Thu Mar 27 10:45:40 2014
@@ -17,19 +17,9 @@
 
 package org.apache.solr.core;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.TestUtil;
-import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.handler.admin.CollectionsHandler;
-import org.apache.solr.handler.admin.CoreAdminHandler;
-import org.apache.solr.handler.admin.InfoHandler;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.xml.sax.SAXException;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 
-import javax.xml.parsers.ParserConfigurationException;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -40,8 +30,20 @@ import java.util.List;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.handler.admin.CollectionsHandler;
+import org.apache.solr.handler.admin.CoreAdminHandler;
+import org.apache.solr.handler.admin.InfoHandler;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.SAXException;
 
 public class TestCoreContainer extends SolrTestCaseJ4 {
 
@@ -67,12 +69,7 @@ public class TestCoreContainer extends S
 
   private CoreContainer init(String dirName) throws Exception {
 
-    solrHomeDirectory = new File(TEMP_DIR, this.getClass().getName() + dirName);
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + dirName);
 
     FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME()), solrHomeDirectory);
     System.out.println("Using solrconfig from " + new File(SolrTestCaseJ4.TEST_HOME()).getAbsolutePath());
@@ -151,8 +148,7 @@ public class TestCoreContainer extends S
   @Test
   public void testNoCores() throws IOException, ParserConfigurationException, SAXException {
     //create solrHome
-    File solrHomeDirectory = new File(TEMP_DIR, this.getClass().getName()
-        + "_noCores");
+    File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName() + "_noCores");
     
     boolean oldSolrXml = random().nextBoolean();
     
@@ -238,7 +234,7 @@ public class TestCoreContainer extends S
 
   @Test
   public void testSharedLib() throws Exception {
-    File tmpRoot = TestUtil.getTempDir("testSharedLib");
+    File tmpRoot = TestUtil.createTempDir("testSharedLib");
 
     File lib = new File(tmpRoot, "lib");
     lib.mkdirs();

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java Thu Mar 27 10:45:40 2014
@@ -17,20 +17,22 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Properties;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.junit.After;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.Properties;
-
 public class TestCoreDiscovery extends SolrTestCaseJ4 {
 
   @BeforeClass
@@ -38,14 +40,10 @@ public class TestCoreDiscovery extends S
     initCore();
   }
 
-  private final File solrHomeDirectory = new File(TEMP_DIR, "org.apache.solr.core.TestCoreDiscovery" + File.separator + "solrHome");
+  private File solrHomeDirectory;
 
   private void setMeUp(String alternateCoreDir) throws Exception {
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
-
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()); 
     System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
     String xmlStr = SOLR_XML;
     if (alternateCoreDir != null) {
@@ -198,9 +196,7 @@ public class TestCoreDiscovery extends S
 
   @Test
   public void testAlternateCoreDir() throws Exception {
-    File alt = new File(TEMP_DIR, "alternateCoreDir");
-    if (alt.exists()) FileUtils.deleteDirectory(alt);
-    alt.mkdirs();
+    File alt = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     setMeUp(alt.getAbsolutePath());
     addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
         new File(alt, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
@@ -218,9 +214,7 @@ public class TestCoreDiscovery extends S
   }
   @Test
   public void testNoCoreDir() throws Exception {
-    File noCoreDir = new File(TEMP_DIR, "noCoreDir");
-    if (noCoreDir.exists()) FileUtils.deleteDirectory(noCoreDir);
-    noCoreDir.mkdirs();
+    File noCoreDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     setMeUp(noCoreDir.getAbsolutePath());
     addCoreWithProps(makeCorePropFile("core1", false, true),
         new File(noCoreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Thu Mar 27 10:45:40 2014
@@ -17,8 +17,20 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
@@ -35,16 +47,6 @@ import org.junit.After;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
 public class TestLazyCores extends SolrTestCaseJ4 {
 
   @BeforeClass
@@ -52,14 +54,10 @@ public class TestLazyCores extends SolrT
     initCore("solrconfig-minimal.xml", "schema-tiny.xml");
   }
 
-  private final File solrHomeDirectory = new File(TEMP_DIR, TestLazyCores.getSimpleClassName());
+  private File solrHomeDirectory;
 
   private CoreContainer init() throws Exception {
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     for (int idx = 1; idx < 10; ++idx) {
       copyMinConf(new File(solrHomeDirectory, "collection" + idx));
     }

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java Thu Mar 27 10:45:40 2014
@@ -81,7 +81,7 @@ public class TestSolrXMLSerializer exten
     assertResults(((StringWriter) w).getBuffer().toString().getBytes("UTF-8"));
     
     // again with default file
-    File tmpFile = TestUtil.createTempFile("solr.xml", null, TEMP_DIR);
+    File tmpFile = TestUtil.createTempFile("solr.xml", null);
     
     serializer.persistFile(tmpFile, solrXMLDef);
 

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXml.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXml.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXml.java Thu Mar 27 10:45:40 2014
@@ -17,23 +17,32 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
-import java.io.File;
-import java.io.IOException;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 public class TestSolrXml extends SolrTestCaseJ4 {
 
   @Rule
   public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
 
-  private final File solrHome = new File(TEMP_DIR, TestSolrXml.getClassName() + File.separator + "solrHome");
+  private File solrHome;
+  
+  @Before
+  public void setupTest() {
+    solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
+  }
 
   @Test
   public void testAllInfoPresent() throws IOException {

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java Thu Mar 27 10:45:40 2014
@@ -17,16 +17,31 @@
 
 package org.apache.solr.core;
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-import com.google.common.base.Charsets;
+import static org.hamcrest.core.Is.is;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.handler.admin.CoreAdminHandler;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.util.TestHarness;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
@@ -37,30 +52,23 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.hamcrest.core.Is.is;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import com.google.common.base.Charsets;
 
 public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
 
-  private File solrHomeDirectory = new File(TEMP_DIR, this.getClass().getName());
+  private File solrHomeDirectory;
 
   @Rule
   public TestRule solrTestRules =
       RuleChain.outerRule(new SystemPropertiesRestoreRule());
 
+  @Before
+  public void setupTest() {
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
+  }
 
   private CoreContainer init(String solrXmlString, String... subDirs) throws Exception {
-
     createTempDir();
     solrHomeDirectory = dataDir;
 

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java Thu Mar 27 10:45:40 2014
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.junit.Test;
 
@@ -62,7 +64,7 @@ public class TestSolrXmlPersistor  exten
 
     final String solrxml = "<solr><cores></cores></solr>";
 
-    final File solrHomeDirectory = new File(TEMP_DIR, "ZkControllerTest");
+    final File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     try {
       if (solrHomeDirectory.exists()) {
         FileUtils.deleteDirectory(solrHomeDirectory);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java Thu Mar 27 10:45:40 2014
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.NamedList;
@@ -54,7 +55,7 @@ public class PingRequestHandlerTest exte
 
     // sometimes randomly use an absolute File path instead 
     if (random().nextBoolean()) {
-      healthcheckFile = new File(TEMP_DIR, fileName);
+      healthcheckFile = TestUtil.createTempFile(fileName, "");
       fileNameParam = healthcheckFile.getAbsolutePath();
     } 
       

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java Thu Mar 27 10:45:40 2014
@@ -50,7 +50,7 @@ public class TestCSVLoader extends SolrT
     // if you override setUp or tearDown, you better call
     // the super classes version
     super.setUp();
-    File tempDir = TestUtil.getTempDir("TestCSVLoader");
+    File tempDir = TestUtil.createTempDir("TestCSVLoader");
     file = new File(tempDir, "solr_tmp.csv");
     filename = file.getPath();
     cleanup();

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Thu Mar 27 10:45:40 2014
@@ -44,6 +44,7 @@ import org.apache.lucene.search.MatchAll
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.SimpleFSDirectory;
+import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.SolrTestCaseJ4;
@@ -1594,10 +1595,7 @@ public class TestReplicationHandler exte
       System.setProperty("solr.test.sys.prop1", "propone");
       System.setProperty("solr.test.sys.prop2", "proptwo");
 
-      File home = new File(TEMP_DIR, 
-                           getClass().getName() + "-" + 
-                           System.currentTimeMillis());
-                           
+      File home = TestUtil.createTempDir(getClass().getName());
 
       homeDir = new File(home, name);
       dataDir = new File(homeDir + "/collection1", "data");

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java Thu Mar 27 10:45:40 2014
@@ -19,6 +19,7 @@ package org.apache.solr.handler.admin;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
@@ -49,7 +50,7 @@ public class CoreAdminCreateDiscoverTest
   public static void beforeClass() throws Exception {
     useFactory(null); // I require FS-based indexes for this test.
 
-    solrHomeDirectory = new File(TEMP_DIR, "solrHome/" + CoreAdminCreateDiscoverTest.getClassName());
+    solrHomeDirectory = TestUtil.createTempDir(CoreAdminCreateDiscoverTest.getClassName());
     if (solrHomeDirectory.exists()) {
       FileUtils.deleteDirectory(solrHomeDirectory);
     }

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java Thu Mar 27 10:45:40 2014
@@ -17,9 +17,13 @@
 
 package org.apache.solr.handler.admin;
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import java.io.File;
+import java.util.Map;
+
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
@@ -39,8 +43,7 @@ import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
-import java.io.File;
-import java.util.Map;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 public class CoreAdminHandlerTest extends SolrTestCaseJ4 {
   
@@ -58,12 +61,8 @@ public class CoreAdminHandlerTest extend
   public void testCreateWithSysVars() throws Exception {
     useFactory(null); // I require FS-based indexes for this test.
 
-    final File workDir = new File(TEMP_DIR, getCoreName());
+    final File workDir = TestUtil.createTempDir(getCoreName());
 
-    if (workDir.exists()) {
-      FileUtils.deleteDirectory(workDir);
-    }
-    assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
     String coreName = "with_sys_vars";
     File instDir = new File(workDir, coreName);
     File subHome = new File(instDir, "conf");
@@ -133,7 +132,7 @@ public class CoreAdminHandlerTest extend
 
   @Test
   public void testCoreAdminHandler() throws Exception {
-    final File workDir = new File(TEMP_DIR, this.getClass().getName());
+    final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
 
     if (workDir.exists()) {
       FileUtils.deleteDirectory(workDir);
@@ -224,9 +223,7 @@ public class CoreAdminHandlerTest extend
 
   @Test
   public void testDeleteInstanceDir() throws Exception  {
-    File solrHomeDirectory = new File(TEMP_DIR, getClass().getName() + "-corex-"
-        + System.currentTimeMillis());
-    solrHomeDirectory.mkdirs();
+    File solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     copySolrHomeToTemp(solrHomeDirectory, "corex", true);
     File corex = new File(solrHomeDirectory, "corex");
     FileUtils.write(new File(corex, "core.properties"), "", Charsets.UTF_8.toString());

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java Thu Mar 27 10:45:40 2014
@@ -17,7 +17,11 @@ package org.apache.solr.handler.admin;
  * limitations under the License.
  */
 
+import java.io.File;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.core.CoreContainer;
@@ -26,8 +30,6 @@ import org.apache.solr.response.SolrQuer
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-
 
 public class CoreAdminRequestStatusTest extends SolrTestCaseJ4{
   @BeforeClass
@@ -37,13 +39,7 @@ public class CoreAdminRequestStatusTest 
 
   @Test
   public void testCoreAdminRequestStatus() throws Exception {
-    final File workDir = new File(TEMP_DIR, this.getClass().getName());
-
-    if (workDir.exists()) {
-      FileUtils.deleteDirectory(workDir);
-    }
-    assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
-
+    final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     final CoreContainer cores = h.getCoreContainer();
 
     final CoreAdminHandler admin = new CoreAdminHandler(cores);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java Thu Mar 27 10:45:40 2014
@@ -17,9 +17,13 @@ package org.apache.solr.handler.admin;
  * limitations under the License.
  */
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.core.CoreContainer;
@@ -32,8 +36,7 @@ import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
-import java.io.File;
-import java.io.IOException;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 public class CoreMergeIndexesAdminHandlerTest extends SolrTestCaseJ4 {
   
@@ -68,7 +71,7 @@ public class CoreMergeIndexesAdminHandle
 
   @Test
   public void testMergeIndexesCoreAdminHandler() throws Exception {
-    final File workDir = new File(TEMP_DIR, this.getClass().getName());
+    final File workDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
 
     if (workDir.exists()) {
       FileUtils.deleteDirectory(workDir);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java Thu Mar 27 10:45:40 2014
@@ -3,6 +3,7 @@ package org.apache.solr.handler.componen
 import java.io.File;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
@@ -48,7 +49,7 @@ public class DistributedDebugComponentTe
   }
   
   private static File createSolrHome() throws Exception {
-    File workDir = new File(TEMP_DIR, DistributedDebugComponentTest.class.getName());
+    File workDir = TestUtil.createTempDir(DistributedDebugComponentTest.class.getName());
     setupJettyTestHome(workDir, "collection1");
     FileUtils.copyDirectory(new File(workDir, "collection1"), new File(workDir, "collection2"));
     return workDir;

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java Thu Mar 27 10:45:40 2014
@@ -18,6 +18,8 @@ package org.apache.solr.request;
  */
 
 import org.apache.commons.io.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -48,12 +50,12 @@ import java.net.URLEncoder;
  */
 @SuppressSSL     // does not yet work with ssl yet - uses raw java.net.URL API rather than HttpClient
 public class TestRemoteStreaming extends SolrJettyTestBase {
-
-  private static final File solrHomeDirectory = new File(TEMP_DIR, "TestRemoteStreaming");
+  private static File solrHomeDirectory;
   
   @BeforeClass
   public static void beforeTest() throws Exception {
     //this one has handleSelect=true which a test here needs
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     setupJettyTestHome(solrHomeDirectory, "collection1");
     createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
   }

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java Thu Mar 27 10:45:40 2014
@@ -16,7 +16,14 @@ package org.apache.solr.rest.schema;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.regex.Pattern;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.util.RestTestBase;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.After;
@@ -24,11 +31,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.restlet.ext.servlet.ServerServlet;
 
-import java.io.File;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
-
 public class TestManagedSchemaFieldResource extends RestTestBase {
 
   private static File tmpSolrHome;
@@ -41,11 +43,10 @@ public class TestManagedSchemaFieldResou
   @Before
   public void before() throws Exception {
     createTempDir();
-    tmpSolrHome = new File( TEMP_DIR + File.separator + TestManagedSchemaFieldResource.class.getSimpleName() 
-                          + System.currentTimeMillis());
+    tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     tmpConfDir = new File(tmpSolrHome, confDir);
     FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
-    
+
     final SortedMap<ServletHolder,String> extraServlets = new TreeMap<>();
     final ServletHolder solrRestApi = new ServletHolder("SolrSchemaRestApi", ServerServlet.class);
     solrRestApi.setInitParameter("org.restlet.application", "org.apache.solr.rest.SolrSchemaRestApi");

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java Thu Mar 27 10:45:40 2014
@@ -22,6 +22,8 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.util.RestTestBase;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.After;
@@ -45,8 +47,7 @@ public class TestManagedStopFilterFactor
   @Before
   public void before() throws Exception {
     createTempDir();
-    tmpSolrHome = new File(TEMP_DIR + File.separator + TestManagedStopFilterFactory.class.getSimpleName()
-                          + System.currentTimeMillis());
+    tmpSolrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     tmpConfDir = new File(tmpSolrHome, confDir);
     FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
 

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java Thu Mar 27 10:45:40 2014
@@ -17,8 +17,13 @@
 
 package org.apache.solr.schema;
 
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.CoreContainer;
@@ -31,16 +36,13 @@ import org.apache.solr.update.UpdateHand
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.IOException;
-
 public class ChangedSchemaMergeTest extends SolrTestCaseJ4 {
   @BeforeClass
   public static void beforeClass() throws Exception {
     initCore();
   }
 
-  private final File solrHomeDirectory = new File(TEMP_DIR, getSimpleClassName());
+  private File solrHomeDirectory;
   private File schemaFile = null;
 
   private void addDoc(SolrCore core, String... fieldValues) throws IOException {
@@ -51,11 +53,7 @@ public class ChangedSchemaMergeTest exte
   }
 
   private CoreContainer init() throws Exception {
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     File changed = new File(solrHomeDirectory, "changed");
     copyMinConf(changed, "name=changed");
     // Overlay with my local schema

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java Thu Mar 27 10:45:40 2014
@@ -17,9 +17,15 @@
 
 package org.apache.solr.schema;
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import static org.junit.internal.matchers.StringContains.containsString;
+
+import java.io.File;
+import java.util.ArrayList;
+
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.ContentStream;
@@ -36,13 +42,10 @@ import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
-import java.io.File;
-import java.util.ArrayList;
-
-import static org.junit.internal.matchers.StringContains.containsString;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 
 public class ModifyConfFileTest extends SolrTestCaseJ4 {
-  private File solrHomeDirectory = new File(TEMP_DIR, this.getClass().getName());
+  private File solrHomeDirectory;
 
   @Rule
   public TestRule solrTestRules = RuleChain.outerRule(new SystemPropertiesRestoreRule());
@@ -51,10 +54,7 @@ public class ModifyConfFileTest extends 
     System.setProperty("solr.test.sys.prop1", "propone");
     System.setProperty("solr.test.sys.prop2", "proptwo");
 
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
 
     copySolrHomeToTemp(solrHomeDirectory, "core1", true);
     FileUtils.write(new File(new File(solrHomeDirectory, "core1"), "core.properties"), "", Charsets.UTF_8.toString());

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java Thu Mar 27 10:45:40 2014
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -35,8 +36,7 @@ public class TestBinaryField extends Sol
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    File homeDir = new File(TEMP_DIR,
-                            "solrtest-TestBinaryField-" + System.currentTimeMillis());
+    File homeDir = TestUtil.createTempDir("solrtest-TestBinaryField");
     File collDir = new File(homeDir, "collection1");
     File dataDir = new File(collDir, "data");
     File confDir = new File(collDir, "conf");

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationField.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationField.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationField.java Thu Mar 27 10:45:40 2014
@@ -63,7 +63,7 @@ public class TestCollationField extends 
    */
   public static String setupSolrHome() throws Exception {
     // make a solr home underneath the test's TEMP_DIR
-    File tmpFile = TestUtil.getTempDir("collation1");
+    File tmpFile = TestUtil.createTempDir("collation1");
     tmpFile.delete();
     tmpFile.mkdir();
     

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java Thu Mar 27 10:45:40 2014
@@ -65,7 +65,7 @@ public class TestCollationFieldDocValues
    */
   public static String setupSolrHome() throws Exception {
     // make a solr home underneath the test's TEMP_DIR
-    File tmpFile = TestUtil.getTempDir("collation1");
+    File tmpFile = TestUtil.createTempDir("collation1");
     tmpFile.delete();
     tmpFile.mkdir();
     

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java Thu Mar 27 10:45:40 2014
@@ -16,8 +16,17 @@ package org.apache.solr.schema;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.common.util.NamedList;
@@ -29,13 +38,6 @@ import org.apache.solr.response.SolrQuer
 import org.junit.After;
 import org.junit.Before;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
 public class TestManagedSchema extends AbstractBadConfigTestBase {
 
   private static File tmpSolrHome;
@@ -47,8 +49,7 @@ public class TestManagedSchema extends A
   @Before
   private void initManagedSchemaCore() throws Exception {
     createTempDir();
-    final String tmpSolrHomePath 
-        = TEMP_DIR + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
+    final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
     tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java Thu Mar 27 10:45:40 2014
@@ -17,15 +17,16 @@ package org.apache.solr.search;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.util.Collections;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
-import org.apache.solr.schema.TestManagedSchema;
 import org.junit.Before;
 
-import java.io.File;
-import java.util.Collections;
-
 public class TestAddFieldRealTimeGet extends TestRTGBase {
 
   private static File tmpSolrHome;
@@ -37,8 +38,7 @@ public class TestAddFieldRealTimeGet ext
   @Before
   private void initManagedSchemaCore() throws Exception {
     createTempDir();
-    final String tmpSolrHomePath
-        = TEMP_DIR + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
+    final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
     tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);
@@ -46,7 +46,7 @@ public class TestAddFieldRealTimeGet ext
     final String schemaFileName = "schema-id-and-version-fields-only.xml";
     FileUtils.copyFileToDirectory(new File(testHomeConfDir, configFileName), tmpConfDir);
     FileUtils.copyFileToDirectory(new File(testHomeConfDir, schemaFileName), tmpConfDir);
-     FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig.snippet.randomindexconfig.xml"), tmpConfDir);
+    FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig.snippet.randomindexconfig.xml"), tmpConfDir);
 
     // initCore will trigger an upgrade to managed schema, since the solrconfig has
     // <schemaFactory class="ManagedIndexSchemaFactory" ... />

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java Thu Mar 27 10:45:40 2014
@@ -40,6 +40,8 @@ import org.apache.hadoop.fs.FSDataOutput
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsBasicDistributedZk2Test;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
@@ -76,9 +78,7 @@ public class TestRecoveryHdfs extends So
   
   @BeforeClass
   public static void beforeClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(TEMP_DIR,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass();
     hdfsUri = dfsCluster.getFileSystem().getUri().toString();
     
     try {

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java Thu Mar 27 10:45:40 2014
@@ -23,6 +23,7 @@ import org.apache.solr.schema.SchemaFiel
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.ManagedIndexSchema;
 
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
 
 import org.apache.commons.io.FileUtils;
@@ -55,7 +56,7 @@ public class TestSearcherReuse extends S
   @BeforeClass
   private static void setupTempDirAndCoreWithManagedSchema() throws Exception {
     createTempDir();
-    solrHome = new File(TEMP_DIR, TestSearcherReuse.class.getSimpleName());
+    solrHome = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     solrHome = solrHome.getAbsoluteFile();
 
     File confDir = new File(solrHome, confPath);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Thu Mar 27 10:45:40 2014
@@ -39,10 +39,11 @@ import com.google.common.base.Charsets;
  * A test case for the several HTTP cache headers emitted by Solr
  */
 public class CacheHeaderTest extends CacheHeaderTestBase {
-    private static final File solrHomeDirectory = new File(TEMP_DIR, "CacheHeaderTest");
+  private static File solrHomeDirectory;
     
   @BeforeClass
   public static void beforeTest() throws Exception {
+    solrHomeDirectory = TestUtil.createTempDir("CacheHeaderTest");
     setupJettyTestHome(solrHomeDirectory, "collection1");
     createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
   }
@@ -253,7 +254,7 @@ public class CacheHeaderTest extends Cac
 
   protected File makeFile(String contents, String charset) {
     try {
-      File f = TestUtil.createTempFile("cachetest_csv", null, TEMP_DIR);
+      File f = TestUtil.createTempFile("cachetest_csv", null);
       Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
       out.write(contents);
       out.close();

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java Thu Mar 27 10:45:40 2014
@@ -17,21 +17,22 @@
 
 package org.apache.solr.spelling;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.RefCounted;
-import org.apache.lucene.analysis.Token;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.Date;
-import java.util.Map;
-import java.util.Collection;
-
 /**
  *
  * @since solr 1.3
@@ -68,8 +69,7 @@ public class FileBasedSpellCheckerTest e
     spellchecker.add(AbstractLuceneSpellChecker.LOCATION, "spellings.txt");
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "teststop");
     spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     SolrCore core = h.getCore();
     String dictName = checker.init(spellchecker, core);
@@ -104,8 +104,7 @@ public class FileBasedSpellCheckerTest e
     spellchecker.add(AbstractLuceneSpellChecker.LOCATION, "spellings.txt");
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "teststop");
     spellchecker.add(FileBasedSpellChecker.SOURCE_FILE_CHAR_ENCODING, "UTF-8");
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(SolrSpellChecker.FIELD_TYPE, "teststop");
     spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java Thu Mar 27 10:45:40 2014
@@ -16,6 +16,12 @@
  */
 package org.apache.solr.spelling;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Map;
+
 import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
@@ -31,22 +37,18 @@ import org.apache.lucene.search.spell.Su
 import org.apache.lucene.search.spell.SuggestWord;
 import org.apache.lucene.search.spell.SuggestWordFrequencyComparator;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.component.SpellCheckComponent;
-import org.apache.solr.util.RefCounted;
 import org.apache.solr.search.SolrIndexSearcher;
+import org.apache.solr.util.RefCounted;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Map;
-
 /**
  * @since solr 1.3
  */
@@ -108,8 +110,7 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
     spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
@@ -184,8 +185,7 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
     spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
@@ -241,8 +241,7 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
     spellchecker.add(AbstractLuceneSpellChecker.SPELLCHECKER_ARG_NAME, spellchecker);
@@ -281,9 +280,10 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
+    File base = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
+    File indexDir = new File(base, "spellingIdx");
     //create a standalone index
-    File altIndexDir = new File(TEMP_DIR, "alternateIdx" + new Date().getTime());
+    File altIndexDir = new File(base, "alternateIdx");
     Directory dir = newFSDirectory(altIndexDir);
     IndexWriter iw = new IndexWriter(
         dir,

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java Thu Mar 27 10:45:40 2014
@@ -30,7 +30,7 @@ import org.apache.lucene.store.IndexInpu
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.MergeInfo;
 import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.store.hdfs.HdfsDirectory;
+import org.apache.lucene.util.TestUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -103,9 +103,7 @@ public class BlockDirectoryTest extends 
   @Before
   public void setUp() throws Exception {
     super.setUp();
-    file = new File(TEMP_DIR, HdfsDirectory.class.getName() + "-" + System.currentTimeMillis());
-    rm(file);
-    file.mkdirs();
+    file = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     FSDirectory dir = FSDirectory.open(new File(file, "base"));
     mapperCache = new MapperCache();
     directory = new BlockDirectory("test", dir, mapperCache, null, true, true);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java Thu Mar 27 10:45:40 2014
@@ -31,6 +31,8 @@ import org.apache.lucene.store.IOContext
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
 import org.junit.After;
@@ -59,9 +61,7 @@ public class HdfsDirectoryTest extends S
   @BeforeClass
   public static void beforeClass() throws Exception {
     createTempDir();
-    dfsCluster = HdfsTestUtil.setupClass(TEMP_DIR.getAbsolutePath()
-        + File.separator + HdfsDirectoryTest.class.getName() + "_hdfsdir-"
-        + System.currentTimeMillis());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
   
   @AfterClass

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java Thu Mar 27 10:45:40 2014
@@ -17,7 +17,6 @@ package org.apache.solr.store.hdfs;
  * limitations under the License.
  */
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 
@@ -25,6 +24,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.lucene.store.Lock;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
 import org.junit.After;
@@ -44,11 +44,9 @@ public class HdfsLockFactoryTest extends
   @BeforeClass
   public static void beforeClass() throws Exception {
     createTempDir();
-    dfsCluster = HdfsTestUtil.setupClass(TEMP_DIR.getAbsolutePath()
-        + File.separator + HdfsLockFactoryTest.class.getName() + "_hdfsdir-"
-        + System.currentTimeMillis());
+    dfsCluster = HdfsTestUtil.setupClass();
   }
-  
+
   @AfterClass
   public static void afterClass() throws Exception {
     HdfsTestUtil.teardownClass(dfsCluster);

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java Thu Mar 27 10:45:40 2014
@@ -17,11 +17,16 @@ package org.apache.solr.update;
  * limitations under the License.
  */
 
-import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
@@ -37,9 +42,7 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
+import com.google.common.collect.Lists;
 
 public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
   File indexDir1 = null, indexDir2 = null, indexDir3 = null;
@@ -56,12 +59,10 @@ public class SolrIndexSplitterTest exten
     super.setUp();
     clearIndex();
     assertU(commit());
-    indexDir1 = new File(TEMP_DIR, this.getClass().getName()
-        + "_testSplit1");
-    indexDir2 = new File(TEMP_DIR, this.getClass().getName()
-        + "_testSplit2");
-    indexDir3 = new File(TEMP_DIR, this.getClass().getName()
-        + "_testSplit3");
+    File tempDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
+    indexDir1 = new File(tempDir, this.getClass().getName() + "_testSplit1");
+    indexDir2 = new File(tempDir, this.getClass().getName() + "_testSplit2");
+    indexDir3 = new File(tempDir, this.getClass().getName() + "_testSplit3");
 
     if (indexDir1.exists()) {
       FileUtils.deleteDirectory(indexDir1);
@@ -269,11 +270,7 @@ public class SolrIndexSplitterTest exten
 
   @Test
   public void testSplitByRouteKey() throws Exception  {
-    File indexDir = new File(TEMP_DIR, this.getClass().getName() + "testSplitByRouteKey");
-    if (indexDir.exists())  {
-      FileUtils.deleteDirectory(indexDir);
-    }
-    indexDir.mkdirs();
+    File indexDir = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName());
 
     CompositeIdRouter r1 = new CompositeIdRouter();
     String splitKey = "sea-line!";

Modified: lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java?rev=1582248&r1=1582218&r2=1582248&view=diff
==============================================================================
--- lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/solr5914/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java Thu Mar 27 10:45:40 2014
@@ -18,6 +18,8 @@
 package org.apache.solr.update.processor;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.TestManagedSchema;
@@ -48,8 +50,7 @@ public class AddSchemaFieldsUpdateProces
   @Before
   private void initManagedSchemaCore() throws Exception {
     createTempDir();
-    final String tmpSolrHomePath
-        = TEMP_DIR + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
+    final String tmpSolrHomePath = TestUtil.createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath();
     tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);



Mime
View raw message