lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject svn commit: r1527460 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java
Date Mon, 30 Sep 2013 06:39:53 GMT
Author: shaie
Date: Mon Sep 30 06:39:52 2013
New Revision: 1527460

URL: http://svn.apache.org/r1527460
Log:
LUCENE-5246: improve test to be more generic

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java?rev=1527460&r1=1527459&r2=1527460&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java
(original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestNumericDocValuesUpdates.java
Mon Sep 30 06:39:52 2013
@@ -1190,17 +1190,24 @@ public class TestNumericDocValuesUpdates
     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);
+    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();
 
-    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"));
-    
     writer.close();
     dir.close();
   }



Mime
View raw message