lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1130044 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/src/test-framework/org/apache/lucene/util/ solr/ solr/contrib/analysis-extras/ solr/contrib/clustering/ solr/contrib/dataimporthandler/ solr/contrib/extractio...
Date Wed, 01 Jun 2011 08:27:17 GMT
Author: rmuir
Date: Wed Jun  1 08:27:16 2011
New Revision: 1130044

URL: http://svn.apache.org/viewvc?rev=1130044&view=rev
Log:
SOLR-2279: use Lucene's MockDirectoryWrapper in Solr tests

Added:
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/core/MockDirectoryFactory.java
      - copied unchanged from r1130042, lucene/dev/trunk/solr/src/test/org/apache/solr/core/MockDirectoryFactory.java
Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/build.xml
    lucene/dev/branches/branch_3x/solr/common-build.xml
    lucene/dev/branches/branch_3x/solr/contrib/analysis-extras/build.xml
    lucene/dev/branches/branch_3x/solr/contrib/clustering/build.xml
    lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/build.xml
    lucene/dev/branches/branch_3x/solr/contrib/extraction/build.xml
    lucene/dev/branches/branch_3x/solr/contrib/uima/build.xml
    lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
    lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestSolrCoreProperties.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java

Modified: lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
Wed Jun  1 08:27:16 2011
@@ -196,7 +196,7 @@ public abstract class LuceneTestCase ext
   private static TimeZone timeZone;
   private static TimeZone savedTimeZone;
   
-  private static Map<MockDirectoryWrapper,StackTraceElement[]> stores;
+  protected static Map<MockDirectoryWrapper,StackTraceElement[]> stores;
   
   private static class TwoLongs {
     public final long l1, l2;

Modified: lucene/dev/branches/branch_3x/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/build.xml Wed Jun  1 08:27:16 2011
@@ -461,9 +461,8 @@
       <sysproperty key="testmethod" value="${testmethod}"/>
       <!-- set whether or not nightly tests should run -->
       <sysproperty key="tests.nightly" value="${tests.nightly}"/>
-      <!-- TODO: why is this unconditionally set to "" above? disable for now
-         <jvmarg line="${dir.prop}"/>
-      -->
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
 
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>

Modified: lucene/dev/branches/branch_3x/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/common-build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/common-build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/common-build.xml Wed Jun  1 08:27:16 2011
@@ -66,6 +66,7 @@
   <property name="tests.seed" value="random" />
   <property name="tests.nightly" value="false" />
   <property name="tests.verbose" value="false" />
+  <property name="tests.directory" value="random" />
 
   <condition property="dir.prop" value="-Dsolr.directoryFactory=solr.StandardDirectoryFactory">
     <isset property="use.fsdir"/>

Modified: lucene/dev/branches/branch_3x/solr/contrib/analysis-extras/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/analysis-extras/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/analysis-extras/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/analysis-extras/build.xml Wed Jun  1 08:27:16
2011
@@ -158,6 +158,8 @@
       <sysproperty key="jetty.testMode" value="1"/>
       <sysproperty key="tempDir" file="${junit.output.dir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.classpath"/>

Modified: lucene/dev/branches/branch_3x/solr/contrib/clustering/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/clustering/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/clustering/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/clustering/build.xml Wed Jun  1 08:27:16 2011
@@ -129,6 +129,8 @@
       <sysproperty key="jetty.testMode" value="1"/>
       <sysproperty key="tempDir" file="${junit.output.dir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.classpath"/>

Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/build.xml Wed Jun  1 08:27:16
2011
@@ -171,6 +171,8 @@
       <sysproperty key="jetty.testMode" value="1"/>
       <sysproperty key="tempDir" file="${tempDir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.classpath"/>
@@ -216,6 +218,8 @@
       <sysproperty key="jetty.testMode" value="1"/>
       <sysproperty key="tempDir" file="${tempDir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.extras.classpath"/>

Modified: lucene/dev/branches/branch_3x/solr/contrib/extraction/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/extraction/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/extraction/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/extraction/build.xml Wed Jun  1 08:27:16 2011
@@ -115,6 +115,8 @@
       <sysproperty key="jetty.testMode" value="1"/>
       <sysproperty key="tempDir" file="${tempDir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.classpath"/>

Modified: lucene/dev/branches/branch_3x/solr/contrib/uima/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/uima/build.xml?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/uima/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/uima/build.xml Wed Jun  1 08:27:16 2011
@@ -123,6 +123,8 @@
       <sysproperty key="jetty.insecurerandom" value="1"/>
       <sysproperty key="tempDir" file="${tempDir}"/>
       <sysproperty key="testmethod" value="${testmethod}"/>
+      <sysproperty key="tests.directory" value="${tests.directory}"/>
+      <sysproperty key="solr.directoryFactory" value="org.apache.solr.core.MockDirectoryFactory"/>
       <jvmarg line="${args}"/>
       <formatter classname="${junit.details.formatter}" usefile="false" if="junit.details"/>
       <classpath refid="test.classpath"/>

Modified: lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/SolrTestCaseJ4.java
Wed Jun  1 08:27:16 2011
@@ -19,6 +19,7 @@
 package org.apache.solr;
 
 
+import org.apache.lucene.store.MockDirectoryWrapper;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.noggit.CharArr;
 import org.apache.noggit.JSONUtil;
@@ -72,6 +73,16 @@ public abstract class SolrTestCaseJ4 ext
     resetExceptionIgnores();
     endTrackingSearchers();
   }
+  
+  // SOLR-2279: hack to shut these directories down
+  // we still keep the ability to track open index files this way
+  public static void closeDirectories() throws Exception {
+    for (MockDirectoryWrapper d : stores.keySet()) {
+      if (d.isOpen()) {
+        d.close();
+      }
+    }
+  }
 
   @Override
   public void setUp() throws Exception {
@@ -270,6 +281,7 @@ public abstract class SolrTestCaseJ4 ext
   public static void deleteCore() throws Exception {
     log.info("###deleteCore" );
     if (h != null) { h.close(); }
+    closeDirectories();
     if (dataDir != null) {
       String skip = System.getProperty("solr.test.leavedatadir");
       if (null != skip && 0 != skip.trim().length()) {

Modified: lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test-framework/org/apache/solr/util/AbstractSolrTestCase.java
Wed Jun  1 08:27:16 2011
@@ -190,6 +190,7 @@ public abstract class AbstractSolrTestCa
     }
 
     if (h != null) { h.close(); }
+    SolrTestCaseJ4.closeDirectories();
     String skip = System.getProperty("solr.test.leavedatadir");
     if (null != skip && 0 != skip.trim().length()) {
       System.err.println("NOTE: per solr.test.leavedatadir, dataDir will not be removed:
" + dataDir.getAbsolutePath());

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestSolrCoreProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestSolrCoreProperties.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestSolrCoreProperties.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestSolrCoreProperties.java
Wed Jun  1 08:27:16 2011
@@ -59,6 +59,7 @@ public class TestSolrCoreProperties exte
   @Override
   public void tearDown() throws Exception {
     solrJetty.stop();
+    SolrTestCaseJ4.closeDirectories();
     AbstractSolrTestCase.recurseDelete(homeDir);
     super.tearDown();
   }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
Wed Jun  1 08:27:16 2011
@@ -78,6 +78,7 @@ public class JettyWebappTest extends Luc
     try {
       server.stop();
     } catch( Exception ex ) {}
+    SolrTestCaseJ4.closeDirectories();
     super.tearDown();
   }
   

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java
Wed Jun  1 08:27:16 2011
@@ -33,6 +33,8 @@ public class MergeIndexesEmbeddedTest ex
 
   @Override
   public void setUp() throws Exception {
+    // TODO: fix this test to use MockDirectoryFactory
+    System.clearProperty("solr.directoryFactory");
     super.setUp();
 
     File home = new File(getSolrHome());

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
Wed Jun  1 08:27:16 2011
@@ -32,6 +32,8 @@ public class MultiCoreEmbeddedTest exten
 
   @Override public void setUp() throws Exception 
   {
+    // TODO: fix this test to use MockDirectoryFactory
+    System.clearProperty("solr.directoryFactory");
     super.setUp();
     
     File home = new File( getSolrHome() );

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java?rev=1130044&r1=1130043&r2=1130044&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java
Wed Jun  1 08:27:16 2011
@@ -38,6 +38,8 @@ public class MultiCoreExampleJettyTest e
   
   @Override public void setUp() throws Exception 
   {    
+    // TODO: fix this test to use MockDirectoryFactory
+    System.clearProperty("solr.directoryFactory");
     super.setUp();
 
     jetty = new JettySolrRunner( context, 0 );



Mime
View raw message