LUCENE-2858: Fix ParallelReader tests (ParallelReader is now atomic, makes no sense otherwise)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237382 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-01-29 17:36:36 +00:00
parent bd284f8084
commit af8490f4cb
3 changed files with 18 additions and 18 deletions

View File

@ -71,8 +71,8 @@ public class TestParallelReader extends LuceneTestCase {
Directory dir1 = getDir1(random);
Directory dir2 = getDir2(random);
ParallelReader pr = new ParallelReader();
pr.add(IndexReader.open(dir1));
pr.add(IndexReader.open(dir2));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir2)));
FieldInfos fieldInfos = pr.getFieldInfos();
assertEquals(4, fieldInfos.size());
assertNotNull(fieldInfos.fieldInfo("f1"));
@ -98,10 +98,10 @@ public class TestParallelReader extends LuceneTestCase {
w2.close();
ParallelReader pr = new ParallelReader();
pr.add(IndexReader.open(dir1));
IndexReader ir = IndexReader.open(dir2);
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
DirectoryReader ir = DirectoryReader.open(dir2);
try {
pr.add(ir);
pr.add(SlowCompositeReaderWrapper.wrap(ir));
fail("didn't get exptected exception: indexes don't have same number of documents");
} catch (IllegalArgumentException e) {
// expected exception
@ -145,7 +145,7 @@ public class TestParallelReader extends LuceneTestCase {
w.addDocument(d2);
w.close();
IndexReader ir = IndexReader.open(dir);
DirectoryReader ir = DirectoryReader.open(dir);
return newSearcher(ir);
}
@ -154,8 +154,8 @@ public class TestParallelReader extends LuceneTestCase {
dir1 = getDir1(random);
dir2 = getDir2(random);
ParallelReader pr = new ParallelReader();
pr.add(IndexReader.open(dir1));
pr.add(IndexReader.open(dir2));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir2)));
return newSearcher(pr);
}

View File

@ -53,8 +53,8 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
ParallelReader pr = new ParallelReader();
pr.add(IndexReader.open(rd1));
pr.add(IndexReader.open(rd2));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1)));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2)));
// When unpatched, Lucene crashes here with a NoSuchElementException (caused by ParallelTermEnum)
iwOut.addIndexes(pr);
@ -116,8 +116,8 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
ParallelReader pr = new ParallelReader();
pr.add(IndexReader.open(rd1));
pr.add(IndexReader.open(rd2));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1)));
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2)));
// When unpatched, Lucene crashes here with an ArrayIndexOutOfBoundsException (caused by TermVectorsWriter)
iwOut.addIndexes(pr);

View File

@ -28,8 +28,8 @@ import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
public class TestParallelTermEnum extends LuceneTestCase {
private DirectoryReader ir1;
private DirectoryReader ir2;
private AtomicIndexReader ir1;
private AtomicIndexReader ir2;
private Directory rd1;
private Directory rd2;
@ -58,8 +58,8 @@ public class TestParallelTermEnum extends LuceneTestCase {
iw2.close();
this.ir1 = IndexReader.open(rd1);
this.ir2 = IndexReader.open(rd2);
this.ir1 = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1));
this.ir2 = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2));
}
@Override
@ -73,8 +73,8 @@ public class TestParallelTermEnum extends LuceneTestCase {
public void test1() throws IOException {
ParallelReader pr = new ParallelReader();
pr.add(new SlowCompositeReaderWrapper(ir1));
pr.add(new SlowCompositeReaderWrapper(ir2));
pr.add(ir1);
pr.add(ir2);
Bits liveDocs = pr.getLiveDocs();