lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1582413 [2/2] - in /lucene/dev/trunk/solr: contrib/analysis-extras/src/test/org/apache/solr/schema/ contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/ contrib/map-reduce/src/test/org/apache/solr/hadoop/ contrib/morphlin...
Date Thu, 27 Mar 2014 17:23:42 GMT
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSearcherReuse.java Thu
Mar 27 17:23:40 2014
@@ -54,8 +54,7 @@ public class TestSearcherReuse extends S
    */
   @BeforeClass
   private static void setupTempDirAndCoreWithManagedSchema() throws Exception {
-    createTempDir();
-    solrHome = new File(TEMP_DIR, TestSearcherReuse.class.getSimpleName());
+    solrHome = new File(dataDir, TestSearcherReuse.class.getSimpleName());
     solrHome = solrHome.getAbsoluteFile();
 
     File confDir = new File(solrHome, confPath);

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java Thu Mar
27 17:23:40 2014
@@ -39,7 +39,7 @@ 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 final File solrHomeDirectory = new File(dataDir, "CacheHeaderTest");
     
   @BeforeClass
   public static void beforeTest() throws Exception {
@@ -253,7 +253,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, dataDir);
       Writer out = new OutputStreamWriter(new FileOutputStream(f), charset);
       out.write(contents);
       out.close();

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/DirectSolrSpellCheckerTest.java
Thu Mar 27 17:23:40 2014
@@ -23,15 +23,12 @@ import java.util.Map;
 import org.apache.lucene.analysis.Token;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
-import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.SpellingParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.component.SpellCheckComponent;
-import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.RefCounted;
-import org.apache.solr.util.TestHarness;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/FileBasedSpellCheckerTest.java
Thu Mar 27 17:23:40 2014
@@ -17,6 +17,7 @@
 
 package org.apache.solr.spelling;
 
+import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
@@ -36,6 +37,7 @@ import java.util.Collection;
  *
  * @since solr 1.3
  **/
+@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck
IndexReader leak bug?")
 public class FileBasedSpellCheckerTest extends SolrTestCaseJ4 {
 
   private static SpellingQueryConverter queryConverter;
@@ -104,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(TEMP_DIR, "spellingIdx" + new Date().getTime());
+    File indexDir = new File(dataDir, "spellingIdx" + new Date().getTime());
     indexDir.mkdirs();
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(SolrSpellChecker.FIELD_TYPE, "teststop");

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/IndexBasedSpellCheckerTest.java
Thu Mar 27 17:23:40 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.spelling;
 
+import org.apache.solr.SolrTestCaseJ4.SuppressTempDirCleanUp;
 import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
@@ -50,6 +51,7 @@ import java.util.Map;
 /**
  * @since solr 1.3
  */
+@SuppressTempDirCleanUp(bugUrl = "https://issues.apache.org/jira/browse/SOLR-1877 Spellcheck
IndexReader leak bug?")
 public class IndexBasedSpellCheckerTest extends SolrTestCaseJ4 {
   protected static SpellingQueryConverter queryConverter;
 
@@ -108,7 +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());
+    File indexDir = new File(dataDir, "spellingIdx" + new Date().getTime());
     indexDir.mkdirs();
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
@@ -184,7 +186,7 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
+    File indexDir = new File(dataDir, "spellingIdx" + new Date().getTime());
     indexDir.mkdirs();
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
@@ -241,7 +243,7 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
+    File indexDir = new File(dataDir, "spellingIdx" + new Date().getTime());
     indexDir.mkdirs();
     spellchecker.add(AbstractLuceneSpellChecker.INDEX_DIR, indexDir.getAbsolutePath());
     spellchecker.add(AbstractLuceneSpellChecker.FIELD, "title");
@@ -281,9 +283,9 @@ public class IndexBasedSpellCheckerTest 
     NamedList spellchecker = new NamedList();
     spellchecker.add("classname", IndexBasedSpellChecker.class.getName());
 
-    File indexDir = new File(TEMP_DIR, "spellingIdx" + new Date().getTime());
+    File indexDir = new File(dataDir, "spellingIdx" + new Date().getTime());
     //create a standalone index
-    File altIndexDir = new File(TEMP_DIR, "alternateIdx" + new Date().getTime());
+    File altIndexDir = new File(dataDir, "alternateIdx" + new Date().getTime());
     Directory dir = newFSDirectory(altIndexDir);
     IndexWriter iw = new IndexWriter(
         dir,

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
Thu Mar 27 17:23:40 2014
@@ -30,6 +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.SolrTestCaseJ4;
 import org.apache.solr.store.hdfs.HdfsDirectory;
 import org.junit.After;
 import org.junit.Before;
@@ -37,7 +38,7 @@ import org.junit.Test;
 
 import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
 
-public class BlockDirectoryTest extends LuceneTestCase {
+public class BlockDirectoryTest extends SolrTestCaseJ4 {
 
   private class MapperCache implements Cache {
     public Map<String, byte[]> map = new ConcurrentLinkedHashMap.Builder<String,
byte[]>().maximumWeightedCapacity(8).build();
@@ -103,7 +104,7 @@ public class BlockDirectoryTest extends 
   @Before
   public void setUp() throws Exception {
     super.setUp();
-    file = new File(TEMP_DIR, HdfsDirectory.class.getName() + "-" + System.currentTimeMillis());
+    file = new File(dataDir, HdfsDirectory.class.getName() + "-" + System.currentTimeMillis());
     rm(file);
     file.mkdirs();
     FSDirectory dir = FSDirectory.open(new File(file, "base"));

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
Thu Mar 27 17:23:40 2014
@@ -58,8 +58,7 @@ public class HdfsDirectoryTest extends S
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    createTempDir();
-    dfsCluster = HdfsTestUtil.setupClass(TEMP_DIR.getAbsolutePath()
+    dfsCluster = HdfsTestUtil.setupClass(dataDir.getAbsolutePath()
         + File.separator + HdfsDirectoryTest.class.getName() + "_hdfsdir-"
         + System.currentTimeMillis());
   }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
Thu Mar 27 17:23:40 2014
@@ -43,8 +43,7 @@ public class HdfsLockFactoryTest extends
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    createTempDir();
-    dfsCluster = HdfsTestUtil.setupClass(TEMP_DIR.getAbsolutePath()
+    dfsCluster = HdfsTestUtil.setupClass(dataDir.getAbsolutePath()
         + File.separator + HdfsLockFactoryTest.class.getName() + "_hdfsdir-"
         + System.currentTimeMillis());
   }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
Thu Mar 27 17:23:40 2014
@@ -56,11 +56,11 @@ public class SolrIndexSplitterTest exten
     super.setUp();
     clearIndex();
     assertU(commit());
-    indexDir1 = new File(TEMP_DIR, this.getClass().getName()
+    indexDir1 = new File(dataDir, this.getClass().getName()
         + "_testSplit1");
-    indexDir2 = new File(TEMP_DIR, this.getClass().getName()
+    indexDir2 = new File(dataDir, this.getClass().getName()
         + "_testSplit2");
-    indexDir3 = new File(TEMP_DIR, this.getClass().getName()
+    indexDir3 = new File(dataDir, this.getClass().getName()
         + "_testSplit3");
 
     if (indexDir1.exists()) {
@@ -269,7 +269,7 @@ public class SolrIndexSplitterTest exten
 
   @Test
   public void testSplitByRouteKey() throws Exception  {
-    File indexDir = new File(TEMP_DIR, this.getClass().getName() + "testSplitByRouteKey");
+    File indexDir = new File(dataDir, this.getClass().getName() + "testSplitByRouteKey");
     if (indexDir.exists())  {
       FileUtils.deleteDirectory(indexDir);
     }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java
(original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java
Thu Mar 27 17:23:40 2014
@@ -47,9 +47,8 @@ public class AddSchemaFieldsUpdateProces
 
   @Before
   private void initManagedSchemaCore() throws Exception {
-    createTempDir();
     final String tmpSolrHomePath
-        = TEMP_DIR + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
+        = dataDir + File.separator + TestManagedSchema.class.getSimpleName() + System.currentTimeMillis();
     tmpSolrHome = new File(tmpSolrHomePath).getAbsoluteFile();
     tmpConfDir = new File(tmpSolrHome, confDir);
     File testHomeConfDir = new File(TEST_HOME(), confDir);

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
Thu Mar 27 17:23:40 2014
@@ -53,9 +53,7 @@ public abstract class MergeIndexesExampl
 
   @BeforeClass
   public static void beforeClass2() throws Exception {
-    if (dataDir == null) {
-      createTempDir();
-    }
+
   }
 
   protected void setupCoreContainer() {
@@ -73,7 +71,7 @@ public abstract class MergeIndexesExampl
     // setup datadirs
     System.setProperty( "solr.core0.data.dir", SolrTestCaseJ4.dataDir.getCanonicalPath()
);
 
-    dataDir2 = new File(TEMP_DIR, getClass().getName() + "-"
+    dataDir2 = new File(dataDir, getClass().getName() + "-"
         + System.currentTimeMillis());
     dataDir2.mkdirs();
 

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
Thu Mar 27 17:23:40 2014
@@ -56,11 +56,11 @@ public abstract class MultiCoreExampleTe
   @Override public void setUp() throws Exception {
     super.setUp();
 
-    dataDir1 = new File(TEMP_DIR, getClass().getName() + "-core0-"
+    dataDir1 = new File(dataDir, getClass().getName() + "-core0-"
         + System.currentTimeMillis());
     dataDir1.mkdirs();
     
-    dataDir2 = new File(TEMP_DIR, getClass().getName() + "-core1-"
+    dataDir2 = new File(dataDir, getClass().getName() + "-core1-"
         + System.currentTimeMillis());
     dataDir2.mkdirs();
     

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java
Thu Mar 27 17:23:40 2014
@@ -36,9 +36,7 @@ abstract public class SolrExampleTestBas
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    if (dataDir == null) {
-      createTempDir();
-    }
+
   }
  
   @Override

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
Thu Mar 27 17:23:40 2014
@@ -284,7 +284,7 @@ public class TestLBHttpSolrServer extend
 
 
     public void setUp() throws Exception {
-      File home = new File(LuceneTestCase.TEMP_DIR,
+      File home = new File(dataDir,
               getClass().getName() + "-" + System.currentTimeMillis());
 
 

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java
Thu Mar 27 17:23:40 2014
@@ -17,19 +17,17 @@ package org.apache.solr.client.solrj.emb
  * limitations under the License.
  */
 
-import org.apache.lucene.util.LuceneTestCase;
+import java.io.File;
+
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.core.CoreContainer;
-import org.apache.solr.util.AbstractSolrTestCase;
 import org.junit.After;
 import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-
-public abstract class AbstractEmbeddedSolrServerTestCase extends LuceneTestCase {
+public abstract class AbstractEmbeddedSolrServerTestCase extends SolrTestCaseJ4 {
 
   protected static Logger log = LoggerFactory.getLogger(AbstractEmbeddedSolrServerTestCase.class);
 
@@ -40,7 +38,7 @@ public abstract class AbstractEmbeddedSo
 
   protected void createTempDir() {
     if (tempDir == null) {
-      tempDir = new File(TEMP_DIR, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
+      tempDir = new File(dataDir, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
       tempDir.mkdirs();
     }
   }

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
Thu Mar 27 17:23:40 2014
@@ -58,7 +58,7 @@ public class JettyWebappTest extends Sol
     System.setProperty("solr.solr.home", ExternalPaths.EXAMPLE_HOME);
     System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
 
-    File dataDir = new File(LuceneTestCase.TEMP_DIR,
+    File dataDir = new File(this.dataDir,
         getClass().getName() + "-" + System.currentTimeMillis());
     dataDir.mkdirs();
     System.setProperty("solr.data.dir", dataDir.getCanonicalPath());

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
Thu Mar 27 17:23:40 2014
@@ -92,7 +92,7 @@ public class TestCoreAdmin extends Abstr
   }
 
   private File createTestDirectory() {
-    File tmp = new File(TEMP_DIR, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
+    File tmp = new File(dataDir, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
     assertTrue("Couldn't create temporary directory " + tmp.getAbsolutePath(), tmp.mkdirs());
     return tmp;
   }

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
(original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java
Thu Mar 27 17:23:40 2014
@@ -23,15 +23,16 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.Reader;
 import java.net.URL;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.core.SolrResourceLoader;
 
 /**
  */
-public class ContentStreamTest extends LuceneTestCase 
+public class ContentStreamTest extends SolrTestCaseJ4 
 {  
   public void testStringStream() throws IOException 
   {
@@ -46,15 +47,26 @@ public class ContentStreamTest extends L
   {
     InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
     assertNotNull( is );
-    File file = new File(TEMP_DIR, "README");
+    File file = new File(dataDir, "README");
     FileOutputStream os = new FileOutputStream(file);
     IOUtils.copy(is, os);
     os.close();
+    is.close();
     
-    ContentStreamBase stream = new ContentStreamBase.FileStream( file );
-    assertEquals( file.length(), stream.getSize().intValue() );
-    assertTrue( IOUtils.contentEquals( new FileInputStream( file ), stream.getStream() )
);
-    assertTrue( IOUtils.contentEquals( new InputStreamReader(new FileInputStream(file), "UTF-8"),
stream.getReader() ) );
+    ContentStreamBase stream = new ContentStreamBase.FileStream(file);
+    InputStream s = stream.getStream();
+    FileInputStream fis = new FileInputStream(file);
+    InputStreamReader isr = new InputStreamReader(
+        new FileInputStream(file), "UTF-8");
+    try {
+      assertEquals(file.length(), stream.getSize().intValue());
+      assertTrue(IOUtils.contentEquals(fis, s));
+      assertTrue(IOUtils.contentEquals(isr, stream.getReader()));
+    } finally {
+      s.close();
+      isr.close();
+      fis.close();
+    }
   }
   
 
@@ -62,15 +74,30 @@ public class ContentStreamTest extends L
   {
     InputStream is = new SolrResourceLoader(null, null).openResource( "solrj/README" );
     assertNotNull( is );
-    File file = new File(TEMP_DIR, "README");
+    File file = new File(dataDir, "README");
     FileOutputStream os = new FileOutputStream(file);
     IOUtils.copy(is, os);
     os.close();
+    is.close();
     
-    ContentStreamBase stream = new ContentStreamBase.URLStream( new URL(file.toURI().toASCIIString())
);
-    assertTrue( IOUtils.contentEquals( new FileInputStream( file ), stream.getStream() )
);
-    assertEquals( file.length(), stream.getSize().intValue() );
-    assertTrue( IOUtils.contentEquals( new InputStreamReader(new FileInputStream(file), "UTF-8"),
stream.getReader() ) );
-    assertEquals( file.length(), stream.getSize().intValue() );
+    ContentStreamBase stream = new ContentStreamBase.URLStream(new URL(file
+        .toURI().toASCIIString()));
+    InputStream s = stream.getStream();
+    FileInputStream fis = new FileInputStream(file);
+    FileInputStream fis2 = new FileInputStream(file);
+    InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
+    Reader r = stream.getReader();
+    try {
+      assertTrue(IOUtils.contentEquals(fis2, s));
+      assertEquals(file.length(), stream.getSize().intValue());
+      assertTrue(IOUtils.contentEquals(isr, r));
+      assertEquals(file.length(), stream.getSize().intValue());
+    } finally {
+      r.close();
+      s.close();
+      isr.close();
+      fis.close();
+      fis2.close();
+    }
   }
 }

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
(original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
Thu Mar 27 17:23:40 2014
@@ -278,7 +278,7 @@ public abstract class BaseDistributedSea
     super.setUp();
     System.setProperty("solr.test.sys.prop1", "propone");
     System.setProperty("solr.test.sys.prop2", "proptwo");
-    testDir = new File(TEMP_DIR,
+    testDir = new File(dataDir,
             getClass().getName() + "-" + System.currentTimeMillis());
     testDir.mkdirs();
   }

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Thu
Mar 27 17:23:40 2014
@@ -163,6 +163,12 @@ public abstract class SolrTestCaseJ4 ext
   @BeforeClass 
   @SuppressWarnings("unused")
   private static void beforeClass() {
+    String cname = getSimpleClassName();
+    dataDir = new File(TEMP_DIR,
+            "solrtest-" + cname + "-" + System.currentTimeMillis());
+    dataDir.mkdirs();
+    System.err.println("Creating dataDir: " + dataDir.getAbsolutePath());
+    
     System.setProperty("jetty.testMode", "true");
     System.setProperty("enable.update.log", usually() ? "true" : "false");
     System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
@@ -194,14 +200,22 @@ public abstract class SolrTestCaseJ4 ext
       coreName = ConfigSolrXmlOld.DEFAULT_DEFAULT_CORE_NAME;
     } finally {
       try {
-        if (dataDir != null && dataDir.exists() && !recurseDelete(dataDir))
{
-          String msg = "!!!! WARNING: best effort to remove "
-              + dataDir.getAbsolutePath() + " FAILED !!!!!";
-          if (RandomizedContext.current().getTargetClass()
-              .isAnnotationPresent(SuppressTempDirCleanUp.class)) {
-            System.err.println(msg);
-          } else {
-            fail(msg);
+        boolean skip = Boolean.getBoolean("solr.test.leavedatadir");
+        if (skip) {
+          System.err
+              .println("NOTE: per solr.test.leavedatadir, dataDir will not be removed: "
+                  + dataDir.getAbsolutePath());
+        } else {
+          
+          if (dataDir != null && dataDir.exists() && !recurseDelete(dataDir))
{
+            String msg = "!!!! WARNING: best effort to remove "
+                + dataDir.getAbsolutePath() + " FAILED !!!!!";
+            if (RandomizedContext.current().getTargetClass()
+                .isAnnotationPresent(SuppressTempDirCleanUp.class)) {
+              System.err.println(msg);
+            } else {
+              fail(msg);
+            }
           }
         }
       } finally {
@@ -562,13 +576,6 @@ public abstract class SolrTestCaseJ4 ext
 
   private static String factoryProp;
 
-  public static void createTempDir() {
-    String cname = getSimpleClassName();
-    dataDir = new File(TEMP_DIR,
-            "solrtest-" + cname + "-" + System.currentTimeMillis());
-    dataDir.mkdirs();
-    System.err.println("Creating dataDir: " + dataDir.getAbsolutePath());
-  }
 
   public static void initCore() throws Exception {
     log.info("####initCore");
@@ -578,9 +585,6 @@ public abstract class SolrTestCaseJ4 ext
     if (factoryProp == null) {
       System.setProperty("solr.directoryFactory","solr.RAMDirectoryFactory");
     }
-    if (dataDir == null) {
-      createTempDir();
-    }
 
     // other  methods like starting a jetty instance need these too
     System.setProperty("solr.test.sys.prop1", "propone");
@@ -605,8 +609,6 @@ public abstract class SolrTestCaseJ4 ext
 
   public static CoreContainer createCoreContainer(String solrHome, String solrXML) {
     testSolrHome = checkNotNull(solrHome);
-    if (dataDir == null)
-      createTempDir();
     h = new TestHarness(solrHome, solrXML);
     lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
     return h.getCoreContainer();
@@ -614,8 +616,6 @@ public abstract class SolrTestCaseJ4 ext
 
   public static CoreContainer createDefaultCoreContainer(String solrHome) {
     testSolrHome = checkNotNull(solrHome);
-    if (dataDir == null)
-      createTempDir();
     h = new TestHarness("collection1", dataDir.getAbsolutePath(), "solrconfig.xml", "schema.xml");
     lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
     return h.getCoreContainer();

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
(original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
Thu Mar 27 17:23:40 2014
@@ -59,7 +59,6 @@ public abstract class AbstractDistribZkT
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    createTempDir();
     
     String zkDir = testDir.getAbsolutePath() + File.separator
     + "zookeeper/server1/data";

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
(original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
Thu Mar 27 17:23:40 2014
@@ -284,7 +284,7 @@ public abstract class AbstractFullDistri
     // System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
     System.setProperty(ZkStateReader.NUM_SHARDS_PROP, "1");
 
-    File controlJettyDir = new File(TEMP_DIR,
+    File controlJettyDir = new File(dataDir,
             getClass().getName() + "-controljetty-" + System.currentTimeMillis());
     setupJettySolrHome(controlJettyDir);
 
@@ -360,7 +360,7 @@ public abstract class AbstractFullDistri
     for (int i = 1; i <= numJettys; i++) {
       if (sb.length() > 0) sb.append(',');
       int cnt = this.jettyIntCntr.incrementAndGet();
-      File jettyDir = new File(TEMP_DIR,
+      File jettyDir = new File(dataDir,
           getClass().getName() + "-jetty" + cnt + "-" + System.currentTimeMillis());
       jettyDir.mkdirs();
       setupJettySolrHome(jettyDir);
@@ -425,7 +425,7 @@ public abstract class AbstractFullDistri
 
 
     int cnt = this.jettyIntCntr.incrementAndGet();
-      File jettyDir = new File(TEMP_DIR,
+      File jettyDir = new File(dataDir,
           getClass().getName() + "-jetty" + cnt + "-" + System.currentTimeMillis());
       jettyDir.mkdirs();
       org.apache.commons.io.FileUtils.copyDirectory(new File(getSolrHome()), jettyDir);

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
(original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java
Thu Mar 27 17:23:40 2014
@@ -63,7 +63,6 @@ public abstract class AbstractZkTestCase
 
   @BeforeClass
   public static void azt_beforeClass() throws Exception {
-    createTempDir();
     zkDir = dataDir.getAbsolutePath() + File.separator
         + "zookeeper/server1/data";
     zkServer = new ZkTestServer(zkDir);

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java?rev=1582413&r1=1582412&r2=1582413&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
(original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
Thu Mar 27 17:23:40 2014
@@ -53,7 +53,7 @@ public class ZkTestServer {
 
   private int clientPort;
 
-  private Thread zooThread;
+  private volatile Thread zooThread;
   
   private int theTickTime = TICK_TIME;
 
@@ -105,9 +105,9 @@ public class ZkTestServer {
             config.getMaxClientCnxns());
         cnxnFactory.startup(zooKeeperServer);
         cnxnFactory.join();
-        if (zooKeeperServer.isRunning()) {
+       // if (zooKeeperServer.isRunning()) {
           zkServer.shutdown();
-        }
+       // }
       } catch (InterruptedException e) {
         // warn, but generally this is ok
         log.warn("Server interrupted", e);
@@ -121,14 +121,19 @@ public class ZkTestServer {
     protected void shutdown() throws IOException {
       zooKeeperServer.shutdown();
       ZKDatabase zkDb = zooKeeperServer.getZKDatabase();
-      if (zkDb != null) {
-        zkDb.close();
-      }
       if (cnxnFactory != null && cnxnFactory.getLocalPort() != 0) {
         waitForServerDown(getZkHost() + ":" + getPort(), 5000);
       }
       if (cnxnFactory != null) {
         cnxnFactory.shutdown();
+        try {
+          cnxnFactory.join();
+        } catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
+      }
+      if (zkDb != null) {
+        zkDb.close();
       }
     }
 
@@ -251,11 +256,15 @@ public class ZkTestServer {
   }
 
   @SuppressWarnings("deprecation")
-  public void shutdown() throws IOException {
+  public void shutdown() throws IOException, InterruptedException {
     // TODO: this can log an exception while trying to unregister a JMX MBean
     zkServer.shutdown();
+    try {
+      zooThread.join();
+    } catch (NullPointerException e) {
+      // okay
+    }
   }
- 
   
   public static boolean waitForServerDown(String hp, long timeout) {
     long start = System.currentTimeMillis();



Mime
View raw message