mirror of https://github.com/apache/lucene.git
LUCENE-5246: improve test to be more generic
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1527460 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f6ae77fc1e
commit
d3d61d7192
|
@ -1190,17 +1190,24 @@ public class TestNumericDocValuesUpdates extends LuceneTestCase {
|
|||
doc.add(new NumericDocValuesField("f", 1L));
|
||||
writer.addDocument(doc);
|
||||
|
||||
// create _0_1.fnm
|
||||
// create first gen of update files
|
||||
writer.updateNumericDocValue(new Term("id", "d0"), "f", 2L);
|
||||
writer.commit();
|
||||
int numFiles = dir.listAll().length;
|
||||
|
||||
// create _0_2.fnm, and _0_1.fnm should be deleted
|
||||
writer.updateNumericDocValue(new Term("id", "d0"), "f", 2L);
|
||||
writer.commit();
|
||||
|
||||
assertTrue(dir.fileExists("_0_2.fnm"));
|
||||
assertFalse("old generation field infos file should not exist in the directory: _0_1.fnm", dir.fileExists("_0_1.fnm"));
|
||||
DirectoryReader r = DirectoryReader.open(dir);
|
||||
assertEquals(2L, r.leaves().get(0).reader().getNumericDocValues("f").get(0));
|
||||
r.close();
|
||||
|
||||
// create second gen of update files, first gen should be deleted
|
||||
writer.updateNumericDocValue(new Term("id", "d0"), "f", 5L);
|
||||
writer.commit();
|
||||
assertEquals(numFiles, dir.listAll().length);
|
||||
|
||||
r = DirectoryReader.open(dir);
|
||||
assertEquals(5L, r.leaves().get(0).reader().getNumericDocValues("f").get(0));
|
||||
r.close();
|
||||
|
||||
writer.close();
|
||||
dir.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue