lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r912336 - in /lucene/java/branches/lucene_3_0_back_compat_tests: ./ contrib/ contrib/highlighter/src/test/ src/java/org/apache/lucene/search/ src/test/org/apache/lucene/analysis/ src/test/org/apache/lucene/document/ src/test/org/apache/luce...
Date Sun, 21 Feb 2010 12:00:15 GMT
Author: uschindler
Date: Sun Feb 21 12:00:00 2010
New Revision: 912336

URL: http://svn.apache.org/viewvc?rev=912336&view=rev
Log:
backport some test fixes to backwards to run correctly without jvm fork

Modified:
    lucene/java/branches/lucene_3_0_back_compat_tests/   (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/CHANGES.txt   (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/contrib/   (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/contrib/CHANGES.txt   (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/contrib/highlighter/src/test/   (props
changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
  (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
  (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/document/TestDateTools.java
  (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/document/TestNumberTools.java
  (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/TestAttributeSource.java
  (props changed)

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9:817269-818600,825998,829134,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests:818601-821336
 /lucene/java/branches/lucene_3_0:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/CHANGES.txt:817269-818600,825998,829134,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/CHANGES.txt:818601-821336
 /lucene/java/branches/lucene_3_0/CHANGES.txt:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/CHANGES.txt:881213,881315,881466,881819,882374,882464,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/CHANGES.txt:881213,881315,881466,881819,882374,882464,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib:817269-818600,825998,829134,829816,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib:818601-821336
 /lucene/java/branches/lucene_3_0/contrib:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/contrib:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/contrib:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/contrib/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib/CHANGES.txt:817269-818600,825998,826775,829134,829816,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/CHANGES.txt:818601-821336
 /lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/contrib/CHANGES.txt:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/contrib/CHANGES.txt:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/contrib/highlighter/src/test:817269-818600,825998,826775,829134,829816,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/highlighter/src/test:818601-821336
 /lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/contrib/highlighter/src/test:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/contrib/highlighter/src/test:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:817269-818600,825998,829134,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:818601-821336
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:881213,881315,881466,881819,881984,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:881213,881315,881466,881819,881984,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:825998,829134,829881,831036
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestDateTools.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java:825998,829134,829881,831036
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestNumberTools.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java:825998,829134,829881,831036
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:748824
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:825998,829134,829881,831036
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,885214,912319,912324,912328,912335

Modified: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=912336&r1=912335&r2=912336&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java
(original)
+++ lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java
Sun Feb 21 12:00:00 2010
@@ -81,12 +81,16 @@
         IndexReader reader = null;
         int i;
 
-        IndexWriter.setDefaultWriteLockTimeout(2000);
-        assertEquals(2000, IndexWriter.getDefaultWriteLockTimeout());
+        long savedWriteLockTimeout = IndexWriter.getDefaultWriteLockTimeout();
+        try {
+          IndexWriter.setDefaultWriteLockTimeout(2000);
+          assertEquals(2000, IndexWriter.getDefaultWriteLockTimeout());
 
-        writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
+          writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
 
-        IndexWriter.setDefaultWriteLockTimeout(1000);
+        } finally {
+          IndexWriter.setDefaultWriteLockTimeout(savedWriteLockTimeout);
+        }
 
         // add 100 documents
         for (i = 0; i < 100; i++) {

Modified: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java?rev=912336&r1=912335&r2=912336&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java
(original)
+++ lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java
Sun Feb 21 12:00:00 2010
@@ -28,7 +28,7 @@
 import org.apache.lucene.search.DefaultSimilarity;
 import org.apache.lucene.search.Similarity;
 import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.store.RAMDirectory;
 
 import java.io.File;
 import java.io.IOException;
@@ -75,15 +75,7 @@
    * Including optimize. 
    */
   public void testNorms() throws IOException {
-    // tmp dir
-    String tempDir = System.getProperty("java.io.tmpdir");
-    if (tempDir == null) {
-      throw new IOException("java.io.tmpdir undefined, cannot run test");
-    }
-    
-    // test with a single index: index1
-    File indexDir1 = new File(tempDir, "lucenetestindex1");
-    Directory dir1 = FSDirectory.open(indexDir1);
+    Directory dir1 = new RAMDirectory();
 
     norms = new ArrayList();
     modifiedNorms = new ArrayList();
@@ -100,15 +92,13 @@
     modifiedNorms = new ArrayList();
     numDocNorms = 0;
     
-    File indexDir2 = new File(tempDir, "lucenetestindex2");
-    Directory dir2 = FSDirectory.open(indexDir2);
+    Directory dir2 = new RAMDirectory();
 
     createIndex(dir2);
     doTestNorms(dir2);
 
     // add index1 and index2 to a third index: index3
-    File indexDir3 = new File(tempDir, "lucenetestindex3");
-    Directory dir3 = FSDirectory.open(indexDir3);
+    Directory dir3 = new RAMDirectory();
 
     createIndex(dir3);
     IndexWriter iw = new IndexWriter(dir3,anlzr,false, IndexWriter.MaxFieldLength.LIMITED);

Modified: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=912336&r1=912335&r2=912336&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
(original)
+++ lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
Sun Feb 21 12:00:00 2010
@@ -42,9 +42,6 @@
   private static final IndexSearcher searcher;
   static {
     try {    
-      // set the theoretical maximum term count for 8bit (see docs for the number)
-      BooleanQuery.setMaxClauseCount(3*255*2 + 255);
-      
       directory = new RAMDirectory();
       IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(),
       true, MaxFieldLength.UNLIMITED);
@@ -87,6 +84,14 @@
     }
   }
   
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    // set the theoretical maximum term count for 8bit (see docs for the number)
+    // super.tearDown will restore the default
+    BooleanQuery.setMaxClauseCount(3*255*2 + 255);
+  }
+  
   /** test for both constant score and boolean query, the other tests only use the constant
score mode */
   private void testRange(int precisionStep) throws Exception {
     String field="field"+precisionStep;

Modified: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=912336&r1=912335&r2=912336&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
(original)
+++ lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
Sun Feb 21 12:00:00 2010
@@ -41,9 +41,6 @@
   private static final IndexSearcher searcher;
   static {
     try {
-      // set the theoretical maximum term count for 8bit (see docs for the number)
-      BooleanQuery.setMaxClauseCount(7*255*2 + 255);
-      
       directory = new RAMDirectory();
       IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(),
       true, MaxFieldLength.UNLIMITED);
@@ -90,6 +87,14 @@
     }
   }
   
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    // set the theoretical maximum term count for 8bit (see docs for the number)
+    // super.tearDown will restore the default
+    BooleanQuery.setMaxClauseCount(7*255*2 + 255);
+  }
+  
   /** test for constant score + boolean query + filter, the other tests only use the constant
score mode */
   private void testRange(int precisionStep) throws Exception {
     String field="field"+precisionStep;

Modified: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=912336&r1=912335&r2=912336&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java
Sun Feb 21 12:00:00 2010
@@ -25,6 +25,7 @@
 import junit.framework.TestCase;
 
 import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.FieldCache;
 import org.apache.lucene.search.FieldCache.CacheEntry;
 import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;
@@ -49,6 +50,8 @@
  */
 public abstract class LuceneTestCase extends TestCase {
 
+
+  private int savedBoolMaxClauseCount;
   public LuceneTestCase() {
     super();
   }
@@ -61,6 +64,7 @@
   protected void setUp() throws Exception {
     super.setUp();
     ConcurrentMergeScheduler.setTestMode();
+    savedBoolMaxClauseCount = BooleanQuery.getMaxClauseCount();
   }
 
   /**
@@ -83,6 +87,7 @@
 
   @Override
   protected void tearDown() throws Exception {
+    BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);
     try {
       // this isn't as useful as calling directly from the scope where the 
       // index readers are used, because they could be gc'ed just before

Propchange: lucene/java/branches/lucene_3_0_back_compat_tests/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 21 12:00:00 2010
@@ -2,4 +2,4 @@
 /lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java:817269-818600,825998,829134,829881,831036
 /lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/util/TestAttributeSource.java:818601-821336
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/util/TestAttributeSource.java:880754,880793,880823,881216,881317,881376,881473,881549,881820,882467,882890,883076,883080
-/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,883079,885214
+/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:881213,881315,881466,881819,882374,882807,882888,882977,883074-883075,883079,885214,912319,912324,912328,912335



Mime
View raw message