mirror of https://github.com/apache/lucene.git
LUCENE-5907: merge test cases forward to 5.0 (the issue only affects 4.x)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1620751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c137b0cb57
commit
561fddd8a7
|
@ -1119,4 +1119,38 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LUCENE-5907
|
||||||
|
public void testUpgradeWithNRTReader() throws Exception {
|
||||||
|
for (String name : oldNames) {
|
||||||
|
Directory dir = newDirectory(oldIndexDirs.get(name));
|
||||||
|
|
||||||
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(new MockAnalyzer(random()))
|
||||||
|
.setOpenMode(OpenMode.APPEND));
|
||||||
|
writer.addDocument(new Document());
|
||||||
|
DirectoryReader r = DirectoryReader.open(writer, true);
|
||||||
|
writer.commit();
|
||||||
|
r.close();
|
||||||
|
writer.forceMerge(1);
|
||||||
|
writer.commit();
|
||||||
|
writer.rollback();
|
||||||
|
new SegmentInfos().read(dir);
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// LUCENE-5907
|
||||||
|
public void testUpgradeThenMultipleCommits() throws Exception {
|
||||||
|
for (String name : oldNames) {
|
||||||
|
Directory dir = newDirectory(oldIndexDirs.get(name));
|
||||||
|
|
||||||
|
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(new MockAnalyzer(random()))
|
||||||
|
.setOpenMode(OpenMode.APPEND));
|
||||||
|
writer.addDocument(new Document());
|
||||||
|
writer.commit();
|
||||||
|
writer.addDocument(new Document());
|
||||||
|
writer.commit();
|
||||||
|
writer.close();
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue