lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject svn commit: r1585035 [4/5] - in /lucene/dev/branches/branch_4x: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/common/src/test/org/apache/lucene/analysis/util/ lucene/analysis/stempel/src/test/org/egothor/stemmer/ lucene/benchmark/ lucene/bench...
Date Sat, 05 Apr 2014 10:09:47 GMT
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java Sat Apr  5 10:09:42 2014
@@ -17,7 +17,6 @@
 
 package org.apache.solr.cloud.hdfs;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -60,9 +59,7 @@ public class HdfsWriteToMultipleCollecti
   @BeforeClass
   public static void setupClass() throws Exception {
     schemaString = "schema15.xml";      // we need a string id
-    dfsCluster = HdfsTestUtil.setupClass(new File(dataDir,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
     System.setProperty(SOLR_HDFS_HOME, dfsCluster.getURI().toString() + "/solr");
   }
   

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java Sat Apr  5 10:09:42 2014
@@ -17,7 +17,6 @@
 
 package org.apache.solr.cloud.hdfs;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -62,10 +61,7 @@ public class StressHdfsTest extends Basi
   
   @BeforeClass
   public static void setupClass() throws Exception {
-
-    dfsCluster = HdfsTestUtil.setupClass(new File(dataDir,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
     System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
   }
   
@@ -182,8 +178,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/branch_4x/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/CoreContainerCoreInitFailuresTest.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,11 @@
 
 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.solr.SolrTestCaseJ4;
@@ -24,21 +29,13 @@ import org.apache.solr.common.SolrExcept
 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;
   CoreContainer cc = null;
 
   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(dataDir, this.getClass().getName() + "_" + dirSuffix);
-    assertTrue("Failed to mkdirs solrhome [" + solrHome + "]", solrHome.mkdirs());
+    solrHome = createTempDir(dirSuffix);
   }
 
   @After
@@ -48,12 +45,7 @@ public class CoreContainerCoreInitFailur
       cc = null;
     }
 
-    if (null != solrHome) {
-      if (solrHome.exists()) {
-        FileUtils.deleteDirectory(solrHome);
-      }
-      solrHome = null;
-    }
+    solrHome = null;
   }
 
   public void testFlowWithEmpty() throws Exception {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java Sat Apr  5 10:09:42 2014
@@ -30,7 +30,6 @@ 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.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@@ -86,8 +85,7 @@ public class OpenCloseCoreStressTest ext
     coreNames = new ArrayList<>();
     cumulativeDocs = 0;
 
-    solrHomeDirectory = new File(dataDir, "OpenCloseCoreStressTest_");
-    FileUtils.deleteDirectory(solrHomeDirectory); // Ensure that a failed test didn't leave something lying around.
+    solrHomeDirectory = createTempDir();
 
     jetty = new JettySolrRunner(solrHomeDirectory.getAbsolutePath(), "/solr", 0, null, null, true, null, sslConfig);
   }
@@ -95,7 +93,6 @@ public class OpenCloseCoreStressTest ext
   @After
   public void tearDownServer() throws Exception {
     if (jetty != null) jetty.stop();
-    FileUtils.deleteDirectory(solrHomeDirectory);
     for(SolrServer server:indexingServers) {
       server.shutdown();
     }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java Sat Apr  5 10:09:42 2014
@@ -60,7 +60,7 @@ public class ResourceLoaderTest extends 
   }
 
   public void testEscapeInstanceDir() throws Exception {
-    File temp = TestUtil.getTempDir("testEscapeInstanceDir");
+    File temp = createTempDir("testEscapeInstanceDir");
     try {
       temp.mkdirs();
       new File(temp, "dummy.txt").createNewFile();
@@ -76,7 +76,7 @@ public class ResourceLoaderTest extends 
       }
       loader.close();
     } finally {
-      TestUtil.rmDir(temp);
+      TestUtil.rm(temp);
     }
   }
 
@@ -170,7 +170,7 @@ public class ResourceLoaderTest extends 
   }
 
   public void testClassLoaderLibs() throws Exception {
-    File tmpRoot = TestUtil.getTempDir("testClassLoaderLibs");
+    File tmpRoot = createTempDir("testClassLoaderLibs");
 
     File lib = new File(tmpRoot, "lib");
     lib.mkdirs();

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java Sat Apr  5 10:09:42 2014
@@ -17,20 +17,19 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
+import java.io.File;
+import java.util.Map;
+
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.LockObtainFailedException;
 import org.apache.lucene.store.NativeFSLockFactory;
 import org.apache.lucene.store.SimpleFSLockFactory;
-import org.apache.lucene.util.Version;
 import org.apache.solr.SolrTestCaseJ4;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.Map;
-
 public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {
 
   @Override
@@ -41,7 +40,7 @@ public class SolrCoreCheckLockOnStartupT
     System.setProperty("solr.directoryFactory", "org.apache.solr.core.SimpleFSDirectoryFactory");
 
     IndexWriterConfig indexWriterConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, null);
-    Directory directory = newFSDirectory(new File(dataDir, "index"));
+    Directory directory = newFSDirectory(createTempDir("index"));
     //creates a new index on the known location
     new IndexWriter(
         directory,
@@ -53,7 +52,7 @@ public class SolrCoreCheckLockOnStartupT
   @Test
   public void testSimpleLockErrorOnStartup() throws Exception {
 
-    Directory directory = newFSDirectory(new File(dataDir, "index"), new SimpleFSLockFactory());
+    Directory directory = newFSDirectory(new File(initCoreDataDir, "index"), new SimpleFSLockFactory());
     //creates a new IndexWriter without releasing the lock yet
     IndexWriter indexWriter = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, null));
 
@@ -77,7 +76,7 @@ public class SolrCoreCheckLockOnStartupT
   @Test
   public void testNativeLockErrorOnStartup() throws Exception {
 
-    File indexDir = new File(dataDir, "index");
+    File indexDir = new File(initCoreDataDir, "index");
     log.info("Acquiring lock on {}", indexDir.getAbsolutePath());
     Directory directory = newFSDirectory(indexDir, new NativeFSLockFactory());
     //creates a new IndexWriter without releasing the lock yet

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/SolrCoreTest.java Sat Apr  5 10:09:42 2014
@@ -17,10 +17,19 @@
 
 package org.apache.solr.core;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.handler.RequestHandlerBase;
-import org.apache.solr.handler.component.SpellCheckComponent;
 import org.apache.solr.handler.component.QueryComponent;
+import org.apache.solr.handler.component.SpellCheckComponent;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrRequestHandler;
 import org.apache.solr.response.SolrQueryResponse;
@@ -29,16 +38,6 @@ import org.apache.solr.util.DefaultSolrT
 import org.apache.solr.util.plugin.SolrCoreAware;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
 public class SolrCoreTest extends SolrTestCaseJ4 {
   private static final String COLLECTION1 = "collection1";
   
@@ -67,8 +66,7 @@ public class SolrCoreTest extends SolrTe
     core.close();
     
     
-    SolrCore newCore = new SolrCore(COLLECTION1, dataDir + File.separator
-        + "datadir2", new SolrConfig("solr/collection1", "solrconfig.xml", null), schema,
+    SolrCore newCore = new SolrCore(COLLECTION1, createTempDir("dataDir2").getAbsolutePath(), new SolrConfig("solr/collection1", "solrconfig.xml", null), schema,
         new CoreDescriptor(cores, COLLECTION1, "solr/collection1"));
     
     cores.register(newCore, false);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java Sat Apr  5 10:09:42 2014
@@ -72,14 +72,11 @@ public class TestArbitraryIndexDir exten
   @Override
   public void setUp() throws Exception {
     super.setUp();
-
-    dataDir = new File(dataDir,
-        getClass().getName() + "-" + System.currentTimeMillis() + System.getProperty("file.separator") + "solr"
-        + System.getProperty("file.separator") + "data");
-    dataDir.mkdirs();
+    
+    File tmpDataDir = createTempDir();
 
     solrConfig = TestHarness.createConfig(getSolrHome(), "solrconfig.xml");
-    h = new TestHarness( dataDir.getAbsolutePath(),
+    h = new TestHarness( tmpDataDir.getAbsolutePath(),
         solrConfig,
         "schema12.xml");
     lrf = h.getRequestFactory

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfigSets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfigSets.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfigSets.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfigSets.java Sat Apr  5 10:09:42 2014
@@ -17,7 +17,14 @@ 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.solr.SolrTestCaseJ4;
 import org.junit.Rule;
@@ -25,13 +32,7 @@ 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 {
 
@@ -40,10 +41,8 @@ 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(dataDir, testName);
-    testDirectory.mkdirs();
+  public CoreContainer setupContainer(String configSetsBaseDir) {
+    File testDirectory = createTempDir();
 
     System.setProperty("configsets", configSetsBaseDir);
 
@@ -58,7 +57,7 @@ public class TestConfigSets extends Solr
   public void testConfigSetServiceFindsConfigSets() {
     CoreContainer container = null;
     try {
-      container = setupContainer("findsConfigSets", getFile("solr/configsets").getAbsolutePath());
+      container = setupContainer(getFile("solr/configsets").getAbsolutePath());
       String testDirectory = container.getResourceLoader().getInstanceDir();
 
       SolrCore core1 = container.create("core1", testDirectory + "/core1", "configSet", "configset-2");
@@ -77,7 +76,7 @@ public class TestConfigSets extends Solr
   public void testNonExistentConfigSetThrowsException() {
     CoreContainer container = null;
     try {
-      container = setupContainer("badConfigSet", getFile("solr/configsets").getAbsolutePath());
+      container = setupContainer(getFile("solr/configsets").getAbsolutePath());
       String testDirectory = container.getResourceLoader().getInstanceDir();
 
       container.create("core1", testDirectory + "/core1", "configSet", "nonexistent");
@@ -95,7 +94,7 @@ public class TestConfigSets extends Solr
 
   @Test
   public void testConfigSetOnCoreReload() throws IOException {
-    File testDirectory = new File(dataDir, "core-reload");
+    File testDirectory = new File(initCoreDataDir, "core-reload");
     testDirectory.mkdirs();
     File configSetsDir = new File(testDirectory, "configsets");
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreContainer.java Sat Apr  5 10:09:42 2014
@@ -17,18 +17,8 @@
 
 package org.apache.solr.core;
 
-import org.apache.commons.io.FileUtils;
-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 javax.xml.parsers.ParserConfigurationException;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 
 import java.io.BufferedWriter;
 import java.io.File;
@@ -41,9 +31,21 @@ 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.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 {
 
@@ -69,12 +71,7 @@ public class TestCoreContainer extends S
 
   private CoreContainer init(String dirName) throws Exception {
 
-    solrHomeDirectory = new File(dataDir, this.getClass().getName() + dirName);
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = createTempDir(dirName);
 
     FileUtils.copyDirectory(new File(SolrTestCaseJ4.TEST_HOME()), solrHomeDirectory);
     System.out.println("Using solrconfig from " + new File(SolrTestCaseJ4.TEST_HOME()).getAbsolutePath());
@@ -153,8 +150,7 @@ public class TestCoreContainer extends S
   @Test
   public void testNoCores() throws IOException, ParserConfigurationException, SAXException {
     //create solrHome
-    File solrHomeDirectory = new File(dataDir, this.getClass().getName()
-        + "_noCores");
+    File solrHomeDirectory = createTempDir();
     
     boolean oldSolrXml = random().nextBoolean();
     
@@ -190,7 +186,6 @@ public class TestCoreContainer extends S
       assertNull(ret);
     } finally {
       cores.shutdown();
-      FileUtils.deleteDirectory(solrHomeDirectory);
     }
 
   }
@@ -240,9 +235,7 @@ public class TestCoreContainer extends S
 
   @Test
   public void testSharedLib() throws Exception {
-
-    File tmpRoot = TestUtil.getTempDir("testSharedLib");
-
+    File tmpRoot = createTempDir("testSharedLib");
     File lib = new File(tmpRoot, "lib");
     lib.mkdirs();
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,12 @@ 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.solr.SolrTestCaseJ4;
@@ -25,12 +31,7 @@ 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.nio.charset.StandardCharsets;
-import java.util.Properties;
 
 public class TestCoreDiscovery extends SolrTestCaseJ4 {
 
@@ -39,14 +40,9 @@ public class TestCoreDiscovery extends S
     initCore();
   }
 
-  private final File solrHomeDirectory = new File(dataDir, "org.apache.solr.core.TestCoreDiscovery" + File.separator + "solrHome");
+  private final File solrHomeDirectory = createTempDir();
 
   private void setMeUp(String alternateCoreDir) throws Exception {
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
-
     System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
     String xmlStr = SOLR_XML;
     if (alternateCoreDir != null) {
@@ -116,9 +112,7 @@ public class TestCoreDiscovery extends S
 
   @After
   public void after() throws Exception {
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
+
   }
 
   // Test the basic setup, create some dirs with core.properties files in them, but solr.xml has discoverCores
@@ -199,9 +193,9 @@ public class TestCoreDiscovery extends S
 
   @Test
   public void testAlternateCoreDir() throws Exception {
-    File alt = new File(dataDir, "alternateCoreDir");
-    if (alt.exists()) FileUtils.deleteDirectory(alt);
-    alt.mkdirs();
+
+    File alt = createTempDir();
+
     setMeUp(alt.getAbsolutePath());
     addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
         new File(alt, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
@@ -214,14 +208,11 @@ public class TestCoreDiscovery extends S
       assertNotNull(core2);
     } finally {
       cc.shutdown();
-      if (alt.exists()) FileUtils.deleteDirectory(alt);
     }
   }
   @Test
   public void testNoCoreDir() throws Exception {
-    File noCoreDir = new File(dataDir, "noCoreDir");
-    if (noCoreDir.exists()) FileUtils.deleteDirectory(noCoreDir);
-    noCoreDir.mkdirs();
+    File noCoreDir = createTempDir();
     setMeUp(noCoreDir.getAbsolutePath());
     addCoreWithProps(makeCorePropFile("core1", false, true),
         new File(noCoreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
@@ -234,7 +225,6 @@ public class TestCoreDiscovery extends S
       assertNotNull(core2);
     } finally {
       cc.shutdown();
-      if (noCoreDir.exists()) FileUtils.deleteDirectory(noCoreDir);
     }
   }
   // For testing whether finding a solr.xml overrides looking at solr.properties

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,16 @@ 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.solr.SolrTestCaseJ4;
@@ -31,20 +41,10 @@ import org.apache.solr.update.AddUpdateC
 import org.apache.solr.update.CommitUpdateCommand;
 import org.apache.solr.update.UpdateHandler;
 import org.apache.solr.util.TestHarness;
-import org.junit.After;
+import org.junit.Before;
 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 +52,17 @@ public class TestLazyCores extends SolrT
     initCore("solrconfig-minimal.xml", "schema-tiny.xml");
   }
 
-  private final File solrHomeDirectory = new File(dataDir, TestLazyCores.getSimpleClassName());
+  private File solrHomeDirectory;
+  
+  @Before
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+  }
 
   private CoreContainer init() throws Exception {
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = createTempDir();
+    
     for (int idx = 1; idx < 10; ++idx) {
       copyMinConf(new File(solrHomeDirectory, "collection" + idx));
     }
@@ -77,13 +80,7 @@ public class TestLazyCores extends SolrT
     cores.load();
     return cores;
   }
-
-  @After
-  public void after() throws Exception {
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-  }
+  
   @Test
   public void testLazyLoad() throws Exception {
     CoreContainer cc = init();
@@ -502,13 +499,13 @@ public class TestLazyCores extends SolrT
       // Did we get the expected message for each of the cores that failed to load? Make sure we don't run afoul of
       // the dreaded slash/backslash difference on Windows and *nix machines.
       testMessage(cc.getCoreInitFailures(),
-          "TestLazyCores" + File.separator + "badConfig1" + File.separator + "solrconfig.xml");
+          "badConfig1" + File.separator + "solrconfig.xml");
       testMessage(cc.getCoreInitFailures(),
-          "TestLazyCores" + File.separator + "badConfig2" + File.separator + "solrconfig.xml");
+          "badConfig2" + File.separator + "solrconfig.xml");
       testMessage(cc.getCoreInitFailures(),
-          "TestLazyCores" + File.separator + "badSchema1" + File.separator + "schema.xml");
+          "badSchema1" + File.separator + "schema.xml");
       testMessage(cc.getCoreInitFailures(),
-          "TestLazyCores" + File.separator + "badSchema2" + File.separator + "schema.xml");
+          "badSchema2" + File.separator + "schema.xml");
 
       // Status should report that there are failure messages for the bad cores and none for the good cores.
       checkStatus(cc, true, "core1");
@@ -591,15 +588,11 @@ public class TestLazyCores extends SolrT
   private CoreContainer initGoodAndBad(List<String> goodCores,
                                        List<String> badSchemaCores,
                                        List<String> badConfigCores) throws Exception {
-
+    solrHomeDirectory = createTempDir();
+    
     // Don't pollute the log with exception traces when they're expected.
     ignoreException(Pattern.quote("SAXParseException"));
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
-
+    
     // Create the cores that should be fine.
     for (String coreName : goodCores) {
       File coreRoot = new File(solrHomeDirectory, coreName);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNRTOpen.java Sat Apr  5 10:09:42 2014
@@ -46,10 +46,10 @@ public class TestNRTOpen extends SolrTes
     // add a doc
     assertU(adoc("foo", "bar"));
     assertU(commit());
-    File myDir = dataDir;
+    File myDir = initCoreDataDir;
     deleteCore();
     // boot up again over the same index
-    dataDir = myDir;
+    initCoreDataDir = myDir;
     initCore("solrconfig-basic.xml", "schema-minimal.xml");
     // startup
     assertNRT(1);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNonNRTOpen.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNonNRTOpen.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNonNRTOpen.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestNonNRTOpen.java Sat Apr  5 10:09:42 2014
@@ -51,10 +51,10 @@ public class TestNonNRTOpen extends Solr
     // add a doc
     assertU(adoc("foo", "bar"));
     assertU(commit());
-    File myDir = dataDir;
+    File myDir = initCoreDataDir;
     deleteCore();
     // boot up again over the same index
-    dataDir = myDir;
+    initCoreDataDir = myDir;
     initCore("solrconfig-basic.xml", "schema-minimal.xml");
     // startup
     assertNotNRT(1);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXMLSerializer.java Sat Apr  5 10:09:42 2014
@@ -81,12 +81,10 @@ public class TestSolrXMLSerializer exten
     }
     
     assertResults(w.toString().getBytes(StandardCharsets.UTF_8));
-    
+
     // again with default file
-    File tmpFile = TestUtil.createTempFile("solr.xml", null, dataDir);
-    
+    File tmpFile = new File(createTempDir(), "solr.xml");
     serializer.persistFile(tmpFile, solrXMLDef);
-
     assertResults(FileUtils.readFileToByteArray(tmpFile));
     tmpFile.delete();
   }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXml.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXml.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXml.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXml.java Sat Apr  5 10:09:42 2014
@@ -17,7 +17,9 @@ 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.solr.SolrTestCaseJ4;
 import org.junit.Rule;
@@ -25,15 +27,14 @@ 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(dataDir, TestSolrXml.getClassName() + File.separator + "solrHome");
+  private final File solrHome = createTempDir();
 
   @Test
   public void testAllInfoPresent() throws IOException {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistence.java Sat Apr  5 10:09:42 2014
@@ -17,15 +17,32 @@
 
 package org.apache.solr.core;
 
+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 com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 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;
@@ -36,33 +53,24 @@ 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 com.google.common.base.Charsets;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.hamcrest.core.Is.is;
 
 public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
 
-  private File solrHomeDirectory = new File(dataDir, this.getClass().getName());
+  private File solrHomeDirectory = createTempDir();
 
   @Rule
   public TestRule solrTestRules =
       RuleChain.outerRule(new SystemPropertiesRestoreRule());
 
+  @Before
+  public void setupTest() {
+    solrHomeDirectory = createTempDir(LuceneTestCase.getTestClass().getSimpleName());
+  }
 
   private CoreContainer init(String solrXmlString, String... subDirs) throws Exception {
 
-    solrHomeDirectory = dataDir;
-
     for (String s : subDirs) {
       copyMinConf(new File(solrHomeDirectory, s));
     }
@@ -91,9 +99,6 @@ public class TestSolrXmlPersistence exte
       origMatchesPersist(cc, SOLR_XML_LOTS_SYSVARS);
     } finally {
       cc.shutdown();
-      if (solrHomeDirectory.exists()) {
-        FileUtils.deleteDirectory(solrHomeDirectory);
-      }
     }
   }
 
@@ -252,9 +257,6 @@ public class TestSolrXmlPersistence exte
       origMatchesPersist(cc, SOLR_XML_MINIMAL);
     } finally {
       cc.shutdown();
-      if (solrHomeDirectory.exists()) {
-        FileUtils.deleteDirectory(solrHomeDirectory);
-      }
     }
   }
 
@@ -392,10 +394,6 @@ public class TestSolrXmlPersistence exte
 
     } finally {
       cc.shutdown();
-      if (solrHomeDirectory.exists()) {
-        FileUtils.deleteDirectory(solrHomeDirectory);
-      }
-
     }
   }
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java Sat Apr  5 10:09:42 2014
@@ -59,34 +59,26 @@ public class TestSolrXmlPersistor  exten
 
   @Test
   public void simpleCoreDescriptorIsPersisted() throws IOException {
-
+    
     final String solrxml = "<solr><cores></cores></solr>";
-
-    final File solrHomeDirectory = new File(dataDir, "ZkControllerTest");
-    try {
-      if (solrHomeDirectory.exists()) {
-        FileUtils.deleteDirectory(solrHomeDirectory);
-      }
-      copyMinFullSetup(solrHomeDirectory);
-
-      CoreContainer cc = new CoreContainer(solrHomeDirectory.getAbsolutePath());
-
-      final CoreDescriptor cd = new CoreDescriptor(cc, "testcore", "instance/dir/");
-      List<CoreDescriptor> cds = ImmutableList.of(cd);
-
-      SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
-      String xml = persistor.buildSolrXML(cds);
-      
-      assertTrue(xml.contains("<solr><cores>"));
-      assertTrue(xml.contains("name=\"testcore\""));
-      assertTrue(xml.contains("instanceDir=\"instance/dir/\""));
-      assertTrue(xml.contains("</cores></solr>"));
-    } finally {
-      if (solrHomeDirectory.exists()) {
-        FileUtils.deleteDirectory(solrHomeDirectory);
-      }
-
-    }
+    
+    final File solrHomeDirectory = createTempDir();
+    
+    copyMinFullSetup(solrHomeDirectory);
+    
+    CoreContainer cc = new CoreContainer(solrHomeDirectory.getAbsolutePath());
+    
+    final CoreDescriptor cd = new CoreDescriptor(cc, "testcore",
+        "instance/dir/");
+    List<CoreDescriptor> cds = ImmutableList.of(cd);
+    
+    SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
+    String xml = persistor.buildSolrXML(cds);
+    
+    assertTrue(xml.contains("<solr><cores>"));
+    assertTrue(xml.contains("name=\"testcore\""));
+    assertTrue(xml.contains("instanceDir=\"instance/dir/\""));
+    assertTrue(xml.contains("</cores></solr>"));
   }
 
   @Test

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/PingRequestHandlerTest.java Sat Apr  5 10:09:42 2014
@@ -17,22 +17,17 @@
 
 package org.apache.solr.handler;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.IOException;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
-
-import org.apache.commons.io.FileUtils;
-
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 
 public class PingRequestHandlerTest extends SolrTestCaseJ4 {
 
@@ -47,14 +42,14 @@ public class PingRequestHandlerTest exte
 
   @Before
   public void before() throws IOException {
-
+    File tmpDir = initCoreDataDir;
     // by default, use relative file in dataDir
-    healthcheckFile = new File(dataDir, fileName);
+    healthcheckFile = new File(tmpDir, fileName);
     String fileNameParam = fileName;
 
     // sometimes randomly use an absolute File path instead 
     if (random().nextBoolean()) {
-      healthcheckFile = new File(dataDir, fileName);
+      healthcheckFile = new File(tmpDir, fileName);
       fileNameParam = healthcheckFile.getAbsolutePath();
     } 
       
@@ -84,9 +79,10 @@ public class PingRequestHandlerTest exte
     assertEquals("OK", rsp.getValues().get("status")); 
 
   }
+  
   public void testEnablingServer() throws Exception {
 
-    assertTrue(! healthcheckFile.exists());
+    assertTrue(!healthcheckFile.exists());
 
     // first make sure that ping responds back that the service is disabled
     SolrQueryResponse sqr = makeRequest(handler, req());

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestCSVLoader.java Sat Apr  5 10:09:42 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 = createTempDir("TestCSVLoader");
     file = new File(tempDir, "solr_tmp.csv");
     filename = file.getPath();
     cleanup();

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Sat Apr  5 10:09:42 2014
@@ -45,6 +45,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;
@@ -1598,7 +1599,6 @@ public class TestReplicationHandler exte
       File home = new File(dataDir, 
                            getClass().getName() + "-" + 
                            System.currentTimeMillis());
-                           
 
       homeDir = new File(home, name);
       dataDir = new File(homeDir + "/collection1", "data");

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,12 @@
 
 package org.apache.solr.handler.admin;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
@@ -28,12 +34,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
-import java.util.Properties;
 
 public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {
 
@@ -49,11 +50,7 @@ public class CoreAdminCreateDiscoverTest
   public static void beforeClass() throws Exception {
     useFactory(null); // I require FS-based indexes for this test.
 
-    solrHomeDirectory = new File(dataDir, "solrHome/" + CoreAdminCreateDiscoverTest.getClassName());
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
+    solrHomeDirectory = createTempDir();
 
     setupNoCoreTest(solrHomeDirectory, null);
 
@@ -63,9 +60,6 @@ public class CoreAdminCreateDiscoverTest
   @AfterClass
   public static void afterClass() throws Exception {
     admin = null; // Release it or the test harness complains.
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
   }
 
   private static void setupCore(String coreName, boolean blivet) throws IOException {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java Sat Apr  5 10:09:42 2014
@@ -17,7 +17,9 @@
 
 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.solr.SolrTestCaseJ4;
@@ -39,8 +41,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 +59,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(dataDir, getCoreName());
+    final File workDir = 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");
@@ -125,20 +122,11 @@ public class CoreAdminHandlerTest extend
     assertTrue("Should have found index dir at " + test.getAbsolutePath(), test.exists());
     test = new File(test,"segments.gen");
     assertTrue("Should have found segments.gen at " + test.getAbsolutePath(), test.exists());
-
-    // Cleanup
-    FileUtils.deleteDirectory(workDir);
-
   }
 
   @Test
   public void testCoreAdminHandler() throws Exception {
-    final File workDir = new File(dataDir, this.getClass().getName());
-
-    if (workDir.exists()) {
-      FileUtils.deleteDirectory(workDir);
-    }
-    assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
+    final File workDir = createTempDir();
     
     final CoreContainer cores = h.getCoreContainer();
 
@@ -217,14 +205,11 @@ public class CoreAdminHandlerTest extend
                
     // :TODO: because of SOLR-3665 we can't ask for status from all cores
 
-    // cleanup
-    FileUtils.deleteDirectory(workDir);
-
   }
 
   @Test
   public void testDeleteInstanceDir() throws Exception  {
-    File solrHomeDirectory = new File(dataDir, getClass().getName() + "-corex-"
+    File solrHomeDirectory = new File(initCoreDataDir, getClass().getName() + "-corex-"
         + System.currentTimeMillis());
     solrHomeDirectory.mkdirs();
     copySolrHomeToTemp(solrHomeDirectory, "corex", true);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,8 @@ package org.apache.solr.handler.admin;
  * limitations under the License.
  */
 
+import java.io.File;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.CoreAdminParams;
@@ -26,8 +28,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,12 +37,7 @@ public class CoreAdminRequestStatusTest 
 
   @Test
   public void testCoreAdminRequestStatus() throws Exception {
-    final File workDir = new File(dataDir, this.getClass().getName());
-
-    if (workDir.exists()) {
-      FileUtils.deleteDirectory(workDir);
-    }
-    assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
+    final File workDir = createTempDir();
 
     final CoreContainer cores = h.getCoreContainer();
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/admin/CoreMergeIndexesAdminHandlerTest.java Sat Apr  5 10:09:42 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.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
@@ -36,8 +40,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 {
   
@@ -72,12 +75,7 @@ public class CoreMergeIndexesAdminHandle
 
   @Test
   public void testMergeIndexesCoreAdminHandler() throws Exception {
-    final File workDir = new File(dataDir, this.getClass().getName());
-
-    if (workDir.exists()) {
-      FileUtils.deleteDirectory(workDir);
-    }
-    assertTrue("Failed to mkdirs workDir", workDir.mkdirs());
+    final File workDir = createTempDir();
 
     final CoreContainer cores = h.getCoreContainer();
 
@@ -105,8 +103,5 @@ public class CoreMergeIndexesAdminHandle
       }
       dirFactory.fail = false;
     }
-
-    // cleanup
-    FileUtils.deleteDirectory(workDir);
   }
 }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java Sat Apr  5 10:09:42 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(dataDir, DistributedDebugComponentTest.class.getName());
+    File workDir = createTempDir();
     setupJettyTestHome(workDir, "collection1");
     FileUtils.copyDirectory(new File(workDir, "collection1"), new File(workDir, "collection2"));
     return workDir;
@@ -56,7 +57,7 @@ public class DistributedDebugComponentTe
 
   @AfterClass
   public static void afterTest() throws Exception {
-    cleanUpJettyHome(solrHome);
+  
   }
   
   @Before

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java Sat Apr  5 10:09:42 2014
@@ -23,8 +23,8 @@ import java.util.List;
 
 import junit.framework.Assert;
 
-import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util.LuceneTestCase.SuppressTempFileChecks;
 import org.apache.solr.BaseDistributedSearchTestCase;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -41,7 +41,7 @@ import org.junit.BeforeClass;
  * @see org.apache.solr.handler.component.SpellCheckComponent
  */
 @Slow
-@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
+@SuppressTempFileChecks(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
 public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTestCase {
   
   public DistributedSpellCheckComponentTest()

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Sat Apr  5 10:09:42 2014
@@ -59,7 +59,7 @@ public class QueryElevationComponentTest
     //write out elevate-data.xml to the Data dir first by copying it from conf, which we know exists, this way we can test both conf and data configurations
     File parent = new File(TEST_HOME() + "/collection1", "conf");
     File elevateFile = new File(parent, "elevate.xml");
-    File elevateDataFile = new File(dataDir, "elevate-data.xml");
+    File elevateDataFile = new File(initCoreDataDir, "elevate-data.xml");
     FileUtils.copyFile(elevateFile, elevateDataFile);
 
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Sat Apr  5 10:09:42 2014
@@ -21,8 +21,8 @@ import java.io.File;
 import java.util.*;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util.LuceneTestCase.SuppressTempFileChecks;
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.SpellingParams;
@@ -42,7 +42,7 @@ import org.junit.Test;
  * @since solr 1.3
  */
 @Slow
-@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
+@SuppressTempFileChecks(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
 public class SpellCheckComponentTest extends SolrTestCaseJ4 {
   static String rh = "spellCheckCompRH";
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/request/TestRemoteStreaming.java Sat Apr  5 10:09:42 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;
@@ -49,19 +51,19 @@ import java.nio.charset.StandardCharsets
  */
 @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 = createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     setupJettyTestHome(solrHomeDirectory, "collection1");
     createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
   }
 
   @AfterClass
   public static void afterTest() throws Exception {
-    cleanUpJettyHome(solrHomeDirectory);
+
   }
 
   @Before

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/TestManagedSchemaFieldResource.java Sat Apr  5 10:09:42 2014
@@ -16,6 +16,11 @@ 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.solr.util.RestTestBase;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -24,11 +29,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;
@@ -40,11 +40,10 @@ public class TestManagedSchemaFieldResou
 
   @Before
   public void before() throws Exception {
-    tmpSolrHome = new File( dataDir + File.separator + TestManagedSchemaFieldResource.class.getSimpleName() 
-                          + System.currentTimeMillis());
+    tmpSolrHome = createTempDir();
     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/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/rest/schema/analysis/TestManagedStopFilterFactory.java Sat Apr  5 10:09:42 2014
@@ -44,8 +44,7 @@ public class TestManagedStopFilterFactor
 
   @Before
   public void before() throws Exception {
-    tmpSolrHome = new File(dataDir + File.separator + TestManagedStopFilterFactory.class.getSimpleName()
-                          + System.currentTimeMillis());
+    tmpSolrHome = createTempDir();
     tmpConfDir = new File(tmpSolrHome, confDir);
     FileUtils.copyDirectory(new File(TEST_HOME()), tmpSolrHome.getAbsoluteFile());
 
@@ -65,7 +64,6 @@ public class TestManagedStopFilterFactor
   private void after() throws Exception {
     jetty.stop();
     jetty = null;
-    FileUtils.deleteDirectory(tmpSolrHome);
     System.clearProperty("managed.schema.mutable");
     System.clearProperty("enable.update.log");
   }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/ChangedSchemaMergeTest.java Sat Apr  5 10:09:42 2014
@@ -17,6 +17,9 @@
 
 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.solr.SolrTestCaseJ4;
@@ -31,16 +34,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(dataDir, getSimpleClassName());
+  private final File solrHomeDirectory = createTempDir();
   private File schemaFile = null;
 
   private void addDoc(SolrCore core, String... fieldValues) throws IOException {
@@ -51,11 +51,6 @@ public class ChangedSchemaMergeTest exte
   }
 
   private CoreContainer init() throws Exception {
-
-    if (solrHomeDirectory.exists()) {
-      FileUtils.deleteDirectory(solrHomeDirectory);
-    }
-    assertTrue("Failed to mkdirs workDir", solrHomeDirectory.mkdirs());
     File changed = new File(solrHomeDirectory, "changed");
     copyMinConf(changed, "name=changed");
     // Overlay with my local schema

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java Sat Apr  5 10:09:42 2014
@@ -35,8 +35,8 @@ public class TestBinaryField extends Sol
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    File homeDir = new File(dataDir,
-                            "solrtest-TestBinaryField-" + System.currentTimeMillis());
+    File homeDir = createTempDir();
+
     File collDir = new File(homeDir, "collection1");
     File dataDir = new File(collDir, "data");
     File confDir = new File(collDir, "conf");

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationField.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationField.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationField.java Sat Apr  5 10:09:42 2014
@@ -66,7 +66,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 = createTempDir("collation1");
     tmpFile.delete();
     tmpFile.mkdir();
     

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestCollationFieldDocValues.java Sat Apr  5 10:09:42 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 = createTempDir("collation1");
     tmpFile.delete();
     tmpFile.mkdir();
     

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/TestManagedSchema.java Sat Apr  5 10:09:42 2014
@@ -16,6 +16,13 @@ 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.solr.common.SolrException;
@@ -29,13 +36,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;
@@ -46,9 +46,7 @@ public class TestManagedSchema extends A
   
   @Before
   private void initManagedSchemaCore() throws Exception {
-    final String tmpSolrHomePath 
-        = dataDir + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
-    tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
+    tmpSolrHome = createTempDir();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);
     FileUtils.copyFileToDirectory(new File(testHomeConfDir, "solrconfig-managed-schema.xml"), tmpConfDir);
@@ -68,9 +66,8 @@ public class TestManagedSchema extends A
   }
 
   @After
-  private void deleteCoreAndTempSolrHomeDirectory() throws Exception {
+  private void afterClass() throws Exception {
     deleteCore();
-    FileUtils.deleteDirectory(tmpSolrHome);
     System.clearProperty("managed.schema.mutable");
     System.clearProperty("enable.update.log");
   }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestAddFieldRealTimeGet.java Sat Apr  5 10:09:42 2014
@@ -17,15 +17,14 @@ 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.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;
@@ -36,8 +35,7 @@ public class TestAddFieldRealTimeGet ext
 
   @Before
   private void initManagedSchemaCore() throws Exception {
-    final String tmpSolrHomePath
-        = dataDir + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
+    final String tmpSolrHomePath = createTempDir().getAbsolutePath();
     tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);
@@ -45,7 +43,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/branch_4x/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestRecoveryHdfs.java Sat Apr  5 10:09:42 2014
@@ -77,9 +77,7 @@ public class TestRecoveryHdfs extends So
   
   @BeforeClass
   public static void beforeClass() throws Exception {
-    dfsCluster = HdfsTestUtil.setupClass(new File(dataDir,
-        HdfsBasicDistributedZk2Test.class.getName() + "_"
-            + System.currentTimeMillis()).getAbsolutePath());
+    dfsCluster = HdfsTestUtil.setupClass(createTempDir().getAbsolutePath());
     hdfsUri = dfsCluster.getFileSystem().getUri().toString();
     
     try {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java Sat Apr  5 10:09:42 2014
@@ -16,22 +16,17 @@
  */
 package org.apache.solr.search;
 
+import java.io.File;
+import java.util.Collections;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.common.util.NamedList;
 import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.SchemaField;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.ManagedIndexSchema;
-
-import org.apache.lucene.util.TestUtil;
-
-import org.apache.commons.io.FileUtils;
-
-import java.io.File;
-import java.util.Collections;
-
-import org.junit.BeforeClass;
+import org.apache.solr.schema.SchemaField;
 import org.junit.AfterClass;
+import org.junit.BeforeClass;
 
 /**
  * Requests to open a new searcher w/o any underlying change to the index exposed 
@@ -54,7 +49,7 @@ public class TestSearcherReuse extends S
    */
   @BeforeClass
   private static void setupTempDirAndCoreWithManagedSchema() throws Exception {
-    solrHome = new File(dataDir, TestSearcherReuse.class.getSimpleName());
+    solrHome = createTempDir();
     solrHome = solrHome.getAbsoluteFile();
 
     File confDir = new File(solrHome, confPath);
@@ -71,8 +66,7 @@ public class TestSearcherReuse extends S
   }
 
   @AfterClass
-  private static void deleteCoreAndTempSolrHomeDirectory() throws Exception {
-    FileUtils.deleteDirectory(solrHome);
+  private static void afterClass() throws Exception {
     solrHome = null;
   }
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Sat Apr  5 10:09:42 2014
@@ -16,6 +16,8 @@
  */
 package org.apache.solr.servlet;
 
+
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
@@ -28,7 +30,6 @@ import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.impl.cookie.DateUtils;
-import org.apache.lucene.util.TestUtil;
 import org.apache.solr.common.params.CommonParams;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -38,17 +39,18 @@ import org.junit.Test;
  * A test case for the several HTTP cache headers emitted by Solr
  */
 public class CacheHeaderTest extends CacheHeaderTestBase {
-    private static final File solrHomeDirectory = new File(dataDir, "CacheHeaderTest");
+  private static File solrHomeDirectory;
     
   @BeforeClass
   public static void beforeTest() throws Exception {
+    solrHomeDirectory = createTempDir();
     setupJettyTestHome(solrHomeDirectory, "collection1");
     createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
   }
 
   @AfterClass
   public static void afterTest() throws Exception {
-    cleanUpJettyHome(solrHomeDirectory);
+
   }
 
   protected static final String CONTENTS = "id\n100\n101\n102";
@@ -252,7 +254,7 @@ public class CacheHeaderTest extends Cac
 
   protected File makeFile(String contents, String charset) {
     try {
-      File f = TestUtil.createTempFile("cachetest_csv", null, dataDir);
+      File f = new File(initCoreDataDir, "cachetest_csv");
       Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
       out.write(contents);
       out.close();

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java Sat Apr  5 10:09:42 2014
@@ -21,8 +21,8 @@ import java.util.Collection;
 import java.util.Map;
 
 import org.apache.lucene.analysis.Token;
+import org.apache.lucene.util.LuceneTestCase.SuppressTempFileChecks;
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
 import org.apache.solr.common.params.SpellingParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
@@ -35,7 +35,7 @@ import org.junit.Test;
 /**
  * Simple tests for {@link DirectSolrSpellChecker}
  */
-@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
+@SuppressTempFileChecks(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
 public class DirectSolrSpellCheckerTest extends SolrTestCaseJ4 {
 
   private static SpellingQueryConverter queryConverter;

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java?rev=1585035&r1=1585034&r2=1585035&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java Sat Apr  5 10:09:42 2014
@@ -17,27 +17,28 @@
 
 package org.apache.solr.spelling;
 
-import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
+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.lucene.util.LuceneTestCase.SuppressTempFileChecks;
 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
  **/
-@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
+@SuppressTempFileChecks(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck IndexReader leak bug?")
 public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
 
   private static SpellingQueryConverter queryConverter;
@@ -70,8 +71,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 = createTempDir(LuceneTestCase.getTestClass().getSimpleName());
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     SolrCore core = h.getCore();
     String dictName = checker.init(spellchecker, core);
@@ -106,7 +106,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(dataDir, "spellingIdx" + new Date().getTime());
+    File indexDir = createTempDir();
     indexDir.mkdirs();
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(SolrSpellChecker.FIELD_TYPE, "teststop");



Mime
View raw message