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:
Michael McCandless 2014-08-26 22:03:45 +00:00
parent c137b0cb57
commit 561fddd8a7
1 changed files with 34 additions and 0 deletions

View File

@ -1119,4 +1119,38 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
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();
}
}
}