LUCENE-2858: fix tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237354 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-01-29 17:09:45 +00:00
parent 8719c6cd76
commit 8cda5b8a4a
3 changed files with 7 additions and 7 deletions

View File

@ -36,14 +36,14 @@ public class TestNRTThreads extends ThreadedIndexingAndSearchingTestCase {
boolean anyOpenDelFiles = false;
IndexReader r = IndexReader.open(writer, true);
DirectoryReader r = IndexReader.open(writer, true);
while (System.currentTimeMillis() < stopTime && !failed.get()) {
if (random.nextBoolean()) {
if (VERBOSE) {
System.out.println("TEST: now reopen r=" + r);
}
final IndexReader r2 = IndexReader.openIfChanged(r);
final DirectoryReader r2 = DirectoryReader.openIfChanged(r);
if (r2 != null) {
r.close();
r = r2;

View File

@ -98,7 +98,7 @@ public class TestNorms extends LuceneTestCase {
public void testMaxByteNorms() throws IOException {
Directory dir = newDirectory();
buildIndex(dir, true);
IndexReader open = SlowCompositeReaderWrapper.wrap(IndexReader.open(dir));
AtomicIndexReader open = SlowCompositeReaderWrapper.wrap(IndexReader.open(dir));
DocValues normValues = open.normValues(byteTestField);
assertNotNull(normValues);
Source source = normValues.getSource();
@ -129,7 +129,7 @@ public class TestNorms extends LuceneTestCase {
boolean secondWriteNorm = random.nextBoolean();
buildIndex(otherDir, secondWriteNorm);
IndexReader reader = SlowCompositeReaderWrapper.wrap(IndexReader.open(otherDir));
AtomicIndexReader reader = SlowCompositeReaderWrapper.wrap(IndexReader.open(otherDir));
FieldInfos fieldInfos = reader.getFieldInfos();
FieldInfo fieldInfo = fieldInfos.fieldInfo(byteTestField);
assertFalse(fieldInfo.omitNorms);
@ -144,7 +144,7 @@ public class TestNorms extends LuceneTestCase {
new MockAnalyzer(random));
RandomIndexWriter writer = new RandomIndexWriter(random, dir, config);
writer.addIndexes(reader);
IndexReader mergedReader = SlowCompositeReaderWrapper.wrap(writer.getReader());
AtomicIndexReader mergedReader = SlowCompositeReaderWrapper.wrap(writer.getReader());
if (!firstWriteNorm && !secondWriteNorm) {
DocValues normValues = mergedReader.normValues(byteTestField);
assertNull(normValues);

View File

@ -295,8 +295,8 @@ public class TestOmitNorms extends LuceneTestCase {
// fully merge and validate MultiNorms against single segment.
riw.forceMerge(1);
IndexReader ir2 = riw.getReader();
DocValues dv2 = ir2.getSequentialSubReaders()[0].normValues(field);
DirectoryReader ir2 = riw.getReader();
DocValues dv2 = getOnlySegmentReader(ir2).normValues(field);
byte[] norms2 = dv2 == null ? null : (byte[]) dv2.getSource().getArray();
assertArrayEquals(norms1, norms2);