verifying the number of pages created
authorKiran Ayyagari <kayyagari@apache.org>
Sun, 17 May 2015 10:26:14 +0000 (10:26 +0000)
committerKiran Ayyagari <kayyagari@apache.org>
Sun, 17 May 2015 10:26:14 +0000 (10:26 +0000)
mavibot/src/test/java/org/apache/directory/mavibot/btree/SpaceReclaimerTest.java

index d07ad3c..2738237 100644 (file)
@@ -100,8 +100,8 @@ public class SpaceReclaimerTest
         }\r
 \r
         System.out.println( "Total size before closing " + dbFile.length() );\r
+        System.out.println( dbFile.length() );\r
         closeAndReopenRM();\r
-        \r
         System.out.println( "Total size AFTER closing " + dbFile.length() );\r
         \r
         int count = 0;\r
@@ -257,6 +257,16 @@ public class SpaceReclaimerTest
             btree.insert( i, String.valueOf( i ) );\r
         }\r
         \r
+        System.out.println( "Total number of pages created " + manager.nbCreatedPages );\r
+        System.out.println( "Total number of pages reused " + manager.nbReusedPages );\r
+        System.out.println( "Total number of pages freed " + manager.nbFreedPages );\r
+        System.out.println( "Total file size (bytes) " + file.length() );\r
+        \r
+        long totalPages = file.length() / RecordManager.DEFAULT_PAGE_SIZE;\r
+        \r
+        // in RM the header page gets skipped before incrementing nbCreatedPages \r
+        assertEquals( manager.nbCreatedPages.get()+1, totalPages );\r
+        \r
         System.out.println(btree.getRootPage());\r
         System.out.println( file.getAbsolutePath() );\r
         manager.close();\r