lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1245624 - /lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Date Fri, 17 Feb 2012 15:47:29 GMT
Author: uschindler
Date: Fri Feb 17 15:47:28 2012
New Revision: 1245624

URL: http://svn.apache.org/viewvc?rev=1245624&view=rev
Log:
Heavy committing: Just wrap readers sometimes with useless readers :-)

Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1245624&r1=1245623&r2=1245624&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Fri Feb 17 15:47:28 2012
@@ -53,6 +53,9 @@ import org.apache.lucene.codecs.lucene40
 import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldType;
+import org.apache.lucene.index.AtomicReader;
+import org.apache.lucene.index.CompositeReader;
+import org.apache.lucene.index.MultiReader;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexReader.ReaderClosedListener;
@@ -65,6 +68,8 @@ import org.apache.lucene.index.RandomCod
 import org.apache.lucene.index.RandomDocumentsWriterPerThreadPool;
 import org.apache.lucene.index.SegmentReader;
 import org.apache.lucene.index.SerialMergeScheduler;
+import org.apache.lucene.index.ParallelAtomicReader;
+import org.apache.lucene.index.ParallelCompositeReader;
 import org.apache.lucene.index.SlowCompositeReaderWrapper;
 import org.apache.lucene.index.ThreadAffinityDocumentsWriterThreadPool;
 import org.apache.lucene.index.TieredMergePolicy;
@@ -1356,6 +1361,16 @@ public abstract class LuceneTestCase ext
       if (maybeWrap && rarely()) {
         r = SlowCompositeReaderWrapper.wrap(r);
       }
+      if (maybeWrap && rarely()) {
+        // just wrap as MultiReader/ParallelXReader with one subreader
+        if (random.nextBoolean()) {
+          r = (r instanceof AtomicReader) ?
+            new ParallelAtomicReader((AtomicReader) r) :
+            new ParallelCompositeReader((CompositeReader) r);
+        } else {
+          r = new MultiReader(r);
+        }
+      }
       IndexSearcher ret = random.nextBoolean() ? new AssertingIndexSearcher(random, r) :
new AssertingIndexSearcher(random, r.getTopReaderContext());
       ret.setSimilarity(similarity);
       return ret;



Mime
View raw message