mirror of https://github.com/apache/lucene.git
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:
parent
bd284f8084
commit
af8490f4cb
|
@ -71,8 +71,8 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
Directory dir1 = getDir1(random);
|
Directory dir1 = getDir1(random);
|
||||||
Directory dir2 = getDir2(random);
|
Directory dir2 = getDir2(random);
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(IndexReader.open(dir1));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
|
||||||
pr.add(IndexReader.open(dir2));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir2)));
|
||||||
FieldInfos fieldInfos = pr.getFieldInfos();
|
FieldInfos fieldInfos = pr.getFieldInfos();
|
||||||
assertEquals(4, fieldInfos.size());
|
assertEquals(4, fieldInfos.size());
|
||||||
assertNotNull(fieldInfos.fieldInfo("f1"));
|
assertNotNull(fieldInfos.fieldInfo("f1"));
|
||||||
|
@ -98,10 +98,10 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
w2.close();
|
w2.close();
|
||||||
|
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(IndexReader.open(dir1));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
|
||||||
IndexReader ir = IndexReader.open(dir2);
|
DirectoryReader ir = DirectoryReader.open(dir2);
|
||||||
try {
|
try {
|
||||||
pr.add(ir);
|
pr.add(SlowCompositeReaderWrapper.wrap(ir));
|
||||||
fail("didn't get exptected exception: indexes don't have same number of documents");
|
fail("didn't get exptected exception: indexes don't have same number of documents");
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// expected exception
|
// expected exception
|
||||||
|
@ -145,7 +145,7 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
w.addDocument(d2);
|
w.addDocument(d2);
|
||||||
w.close();
|
w.close();
|
||||||
|
|
||||||
IndexReader ir = IndexReader.open(dir);
|
DirectoryReader ir = DirectoryReader.open(dir);
|
||||||
return newSearcher(ir);
|
return newSearcher(ir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ public class TestParallelReader extends LuceneTestCase {
|
||||||
dir1 = getDir1(random);
|
dir1 = getDir1(random);
|
||||||
dir2 = getDir2(random);
|
dir2 = getDir2(random);
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(IndexReader.open(dir1));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir1)));
|
||||||
pr.add(IndexReader.open(dir2));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir2)));
|
||||||
return newSearcher(pr);
|
return newSearcher(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
|
|
||||||
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
|
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(IndexReader.open(rd1));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1)));
|
||||||
pr.add(IndexReader.open(rd2));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2)));
|
||||||
|
|
||||||
// When unpatched, Lucene crashes here with a NoSuchElementException (caused by ParallelTermEnum)
|
// When unpatched, Lucene crashes here with a NoSuchElementException (caused by ParallelTermEnum)
|
||||||
iwOut.addIndexes(pr);
|
iwOut.addIndexes(pr);
|
||||||
|
@ -116,8 +116,8 @@ public class TestParallelReaderEmptyIndex extends LuceneTestCase {
|
||||||
|
|
||||||
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
|
IndexWriter iwOut = new IndexWriter(rdOut, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(IndexReader.open(rd1));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1)));
|
||||||
pr.add(IndexReader.open(rd2));
|
pr.add(SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2)));
|
||||||
|
|
||||||
// When unpatched, Lucene crashes here with an ArrayIndexOutOfBoundsException (caused by TermVectorsWriter)
|
// When unpatched, Lucene crashes here with an ArrayIndexOutOfBoundsException (caused by TermVectorsWriter)
|
||||||
iwOut.addIndexes(pr);
|
iwOut.addIndexes(pr);
|
||||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util._TestUtil;
|
import org.apache.lucene.util._TestUtil;
|
||||||
|
|
||||||
public class TestParallelTermEnum extends LuceneTestCase {
|
public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
private DirectoryReader ir1;
|
private AtomicIndexReader ir1;
|
||||||
private DirectoryReader ir2;
|
private AtomicIndexReader ir2;
|
||||||
private Directory rd1;
|
private Directory rd1;
|
||||||
private Directory rd2;
|
private Directory rd2;
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
|
|
||||||
iw2.close();
|
iw2.close();
|
||||||
|
|
||||||
this.ir1 = IndexReader.open(rd1);
|
this.ir1 = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd1));
|
||||||
this.ir2 = IndexReader.open(rd2);
|
this.ir2 = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(rd2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,8 +73,8 @@ public class TestParallelTermEnum extends LuceneTestCase {
|
||||||
|
|
||||||
public void test1() throws IOException {
|
public void test1() throws IOException {
|
||||||
ParallelReader pr = new ParallelReader();
|
ParallelReader pr = new ParallelReader();
|
||||||
pr.add(new SlowCompositeReaderWrapper(ir1));
|
pr.add(ir1);
|
||||||
pr.add(new SlowCompositeReaderWrapper(ir2));
|
pr.add(ir2);
|
||||||
|
|
||||||
Bits liveDocs = pr.getLiveDocs();
|
Bits liveDocs = pr.getLiveDocs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue