You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by el...@apache.org on 2013/03/07 13:24:34 UTC

svn commit: r1453806 - in /labs/mavibot/trunk/mavibot/src: main/java/org/apache/mavibot/btree/store/RecordManager.java test/java/org/apache/mavibot/btree/store/ReadTest.java test/java/org/apache/mavibot/btree/store/StoreTest.java

Author: elecharny
Date: Thu Mar  7 12:24:34 2013
New Revision: 1453806

URL: http://svn.apache.org/r1453806
Log:
o Changed the position of the PageIO[] parameter in the store() method, so that we can pass a single page, or many (using ellipsis)

Modified:
    labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/store/RecordManager.java
    labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/ReadTest.java
    labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/StoreTest.java

Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/store/RecordManager.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/store/RecordManager.java?rev=1453806&r1=1453805&r2=1453806&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/store/RecordManager.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/store/RecordManager.java Thu Mar  7 12:24:34 2013
@@ -725,12 +725,12 @@ public class RecordManager
         byte[] valueSerializerBytes = Strings.getBytesUtf8( valueSerializerFqcn );
 
         int bufferSize =
-            btreeNameBytes.length + // The name
-                INT_SIZE + // The name size
-                keySerializerBytes.length + // The keySerializerBytes
+            INT_SIZE + // The name size
+                btreeNameBytes.length + // The name
                 INT_SIZE + // The keySerializerBytes size 
-                valueSerializerBytes.length + // The valueSerializerBytes
+                keySerializerBytes.length + // The keySerializerBytes
                 INT_SIZE + // The valueSerializerBytes size
+                valueSerializerBytes.length + // The valueSerializerBytes
                 INT_SIZE + // The page size
                 LONG_SIZE + // The revision
                 LONG_SIZE + // the number of element
@@ -739,6 +739,9 @@ public class RecordManager
         // Get a free page to store the RootPage
         PageIO rootPageIo = fetchNewPage();
 
+        // Update the number of elements to 0
+        store( 0L, 0L, rootPageIo );
+
         flushPages( rootPageIo );
 
         // Get the pageIOs we need to store the data. We may need more than one.
@@ -756,25 +759,25 @@ public class RecordManager
         long position = 0L;
 
         // The tree name
-        position = store( pageIos, position, btreeNameBytes );
+        position = store( position, btreeNameBytes, rootPageIo );
 
         // The keySerializer FQCN
-        position = store( pageIos, position, keySerializerBytes );
+        position = store( position, keySerializerBytes, rootPageIo );
 
         // The valueSerialier FQCN
-        position = store( pageIos, position, valueSerializerBytes );
+        position = store( position, valueSerializerBytes, rootPageIo );
 
         // The BTree page size
-        position = store( pageIos, position, btree.getPageSize() );
+        position = store( position, btree.getPageSize(), rootPageIo );
 
         // The BTree current revision
-        position = store( pageIos, position, btree.getRevision() );
+        position = store( position, btree.getRevision(), rootPageIo );
 
         // The nb elems in the tree
-        position = store( pageIos, position, btree.getNbElems() );
+        position = store( position, btree.getNbElems(), rootPageIo );
 
         // The BTree rootPage offset
-        position = store( pageIos, position, rootPageIo.getOffset() );
+        position = store( position, rootPageIo.getOffset(), rootPageIo );
 
         // And flush the pages to disk now
         flushPages( pageIos );
@@ -837,17 +840,17 @@ public class RecordManager
      * Stores a byte[] into one ore more pageIO (depending if the long is stored
      * across a boundary or not)
      * 
-     * @param pageIos The pageIOs we have to store the data in
      * @param position The position in a virtual byte[] if all the pages were contiguous
      * @param bytes The byte[] to serialize
+     * @param pageIos The pageIOs we have to store the data in
      * @return The new position
      */
-    private long store( PageIO[] pageIos, long position, byte[] bytes )
+    private long store( long position, byte[] bytes, PageIO... pageIos )
     {
         if ( bytes != null )
         {
             // Write the bytes length
-            position = store( pageIos, position, bytes.length );
+            position = store( position, bytes.length, pageIos );
 
             // Compute the page in which we will store the data given the 
             // current position
@@ -894,7 +897,7 @@ public class RecordManager
         else
         {
             // No bytes : write 0 and return
-            position = store( pageIos, position, 0 );
+            position = store( position, 0, pageIos );
         }
 
         return position;
@@ -905,12 +908,12 @@ public class RecordManager
      * Stores an Integer into one ore more pageIO (depending if the int is stored
      * across a boundary or not)
      * 
-     * @param pageIos The pageIOs we have to store the data in
      * @param position The position in a virtual byte[] if all the pages were contiguous
      * @param value The int to serialize
+     * @param pageIos The pageIOs we have to store the data in
      * @return The new position
      */
-    private long store( PageIO[] pageIos, long position, int value )
+    private long store( long position, int value, PageIO... pageIos )
     {
         // Compute the page in which we will store the data given the 
         // current position
@@ -980,12 +983,12 @@ public class RecordManager
      * Stores a Long into one ore more pageIO (depending if the long is stored
      * across a boundary or not)
      * 
-     * @param pageIos The pageIOs we have to store the data in
      * @param position The position in a virtual byte[] if all the pages were contiguous
      * @param value The long to serialize
+     * @param pageIos The pageIOs we have to store the data in
      * @return The new position
      */
-    private long store( PageIO[] pageIos, long position, long value )
+    private long store( long position, long value, PageIO... pageIos )
     {
         // Compute the page in which we will store the data given the 
         // current position

Modified: labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/ReadTest.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/ReadTest.java?rev=1453806&r1=1453805&r2=1453806&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/ReadTest.java (original)
+++ labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/ReadTest.java Thu Mar  7 12:24:34 2013
@@ -49,7 +49,7 @@ public class ReadTest
 
         // Create page size of 32 only
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
-        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, int.class );
+        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, int.class, PageIO[].class );
         Method readIntMethod = RecordManager.class.getDeclaredMethod( "readInt", PageIO[].class, long.class );
         storeMethod.setAccessible( true );
         readIntMethod.setAccessible( true );
@@ -62,7 +62,7 @@ public class ReadTest
         pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
 
         // Set the int at the beginning
-        storeMethod.invoke( recordManager, pageIos, 0, 0x12345678 );
+        storeMethod.invoke( recordManager, 0, 0x12345678, pageIos );
 
         // Read it back
         int readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 0 );
@@ -70,7 +70,7 @@ public class ReadTest
         assertEquals( 0x12345678, readValue );
 
         // Set the int at the end of the first page
-        storeMethod.invoke( recordManager, pageIos, 16, 0x12345678 );
+        storeMethod.invoke( recordManager, 16, 0x12345678, pageIos );
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 16 );
@@ -79,7 +79,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 1 byte overlapping
-        storeMethod.invoke( recordManager, pageIos, 17, 0x12345678 );
+        storeMethod.invoke( recordManager, 17, 0x12345678, pageIos );
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 17 );
@@ -88,7 +88,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 2 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 18, 0x12345678 );
+        storeMethod.invoke( recordManager, 18, 0x12345678, pageIos );
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 18 );
@@ -97,7 +97,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 3 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 19, 0x12345678 );
+        storeMethod.invoke( recordManager, 19, 0x12345678, pageIos );
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 19 );
@@ -105,7 +105,7 @@ public class ReadTest
         assertEquals( 0x12345678, readValue );
 
         // Set the int at the beginning of the second page
-        storeMethod.invoke( recordManager, pageIos, 20, 0x12345678 );
+        storeMethod.invoke( recordManager, 20, 0x12345678, pageIos );
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 20 );
@@ -124,7 +124,7 @@ public class ReadTest
 
         // Create page size of 32 only
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
-        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, long.class );
+        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, long.class, PageIO[].class );
         Method readLongMethod = RecordManager.class.getDeclaredMethod( "readLong", PageIO[].class, long.class );
         storeMethod.setAccessible( true );
         readLongMethod.setAccessible( true );
@@ -137,7 +137,7 @@ public class ReadTest
         pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
 
         // Set the int at the beginning
-        storeMethod.invoke( recordManager, pageIos, 0, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 0, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         long readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 0 );
@@ -145,7 +145,7 @@ public class ReadTest
         assertEquals( 0x0123456789ABCDEFL, readValue );
 
         // Set the int at the end of the first page
-        storeMethod.invoke( recordManager, pageIos, 12, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 12, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 12 );
@@ -154,7 +154,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 1 byte overlapping
-        storeMethod.invoke( recordManager, pageIos, 13, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 13, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 13 );
@@ -163,7 +163,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 2 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 14, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 14, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 14 );
@@ -172,7 +172,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 3 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 15, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 15, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 15 );
@@ -181,7 +181,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 4 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 16, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 16, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 16 );
@@ -190,7 +190,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 5 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 17, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 17, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 17 );
@@ -199,7 +199,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 6 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 18, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 18, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 18 );
@@ -208,7 +208,7 @@ public class ReadTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 7 bytes overlapping
-        storeMethod.invoke( recordManager, pageIos, 19, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 19, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 19 );
@@ -216,7 +216,7 @@ public class ReadTest
         assertEquals( 0x0123456789ABCDEFL, readValue );
 
         // Set the int at the beginning of the second page
-        storeMethod.invoke( recordManager, pageIos, 20, 0x0123456789ABCDEFL );
+        storeMethod.invoke( recordManager, 20, 0x0123456789ABCDEFL, pageIos );
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 20 );
@@ -235,7 +235,7 @@ public class ReadTest
 
         // We use smaller pages
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
-        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, byte[].class );
+        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, byte[].class, PageIO[].class );
         Method readBytesMethod = RecordManager.class.getDeclaredMethod( "readBytes", PageIO[].class, long.class );
         storeMethod.setAccessible( true );
         readBytesMethod.setAccessible( true );
@@ -256,7 +256,7 @@ public class ReadTest
             { 0x01, 0x23, 0x45, 0x67 };
 
         // Set the bytes at the beginning
-        long position = ( Long ) storeMethod.invoke( recordManager, pageIos, 0L, bytes );
+        long position = ( Long ) storeMethod.invoke( recordManager, 0L, bytes, pageIos );
 
         // Read the bytes back
         byte[] readBytes = ( byte[] ) readBytesMethod.invoke( recordManager, pageIos, 0L );
@@ -272,7 +272,7 @@ public class ReadTest
         assertEquals( 0x67, readBytes[pos++] );
 
         // Set the bytes at the end of the first page
-        position = ( Long ) storeMethod.invoke( recordManager, pageIos, 12L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 12L, bytes, pageIos );
 
         // Read the bytes back
         readBytes = ( byte[] ) readBytesMethod.invoke( recordManager, pageIos, 12L );
@@ -295,7 +295,7 @@ public class ReadTest
             bytes[i] = ( byte ) ( i + 1 );
         }
 
-        position = ( Long ) storeMethod.invoke( recordManager, pageIos, 0L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 0L, bytes, pageIos );
 
         // Read the bytes back
         readBytes = ( byte[] ) readBytesMethod.invoke( recordManager, pageIos, 0L );
@@ -311,7 +311,7 @@ public class ReadTest
         }
 
         // Write the bytes over 2 pages
-        position = ( Long ) storeMethod.invoke( recordManager, pageIos, 15L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 15L, bytes, pageIos );
 
         // Read the bytes back
         readBytes = ( byte[] ) readBytesMethod.invoke( recordManager, pageIos, 15L );
@@ -334,7 +334,7 @@ public class ReadTest
             bytes[i] = ( byte ) ( i + 1 );
         }
 
-        position = ( Long ) storeMethod.invoke( recordManager, pageIos, 2L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 2L, bytes, pageIos );
 
         // Read the bytes back
         readBytes = ( byte[] ) readBytesMethod.invoke( recordManager, pageIos, 2L );

Modified: labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/StoreTest.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/StoreTest.java?rev=1453806&r1=1453805&r2=1453806&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/StoreTest.java (original)
+++ labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/store/StoreTest.java Thu Mar  7 12:24:34 2013
@@ -47,7 +47,7 @@ public class StoreTest
         tempFile.deleteOnExit();
 
         RecordManager recordManager = new RecordManager( tempFileName );
-        Method method = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, int.class );
+        Method method = RecordManager.class.getDeclaredMethod( "store", long.class, int.class, PageIO[].class );
         method.setAccessible( true );
 
         // Allocate some Pages
@@ -58,7 +58,7 @@ public class StoreTest
         pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
 
         // Set the int at the beginning
-        long position = ( Long ) method.invoke( recordManager, pageIos, 0, 0x12345678 );
+        long position = ( Long ) method.invoke( recordManager, 0, 0x12345678, pageIos );
 
         assertEquals( 4, position );
         int pos = 12;
@@ -68,7 +68,7 @@ public class StoreTest
         assertEquals( 0x78, pageIos[0].getData().get( pos++ ) );
 
         // Set the int at the end of the first page
-        position = ( Long ) method.invoke( recordManager, pageIos, 4080, 0x12345678 );
+        position = ( Long ) method.invoke( recordManager, 4080, 0x12345678, pageIos );
 
         assertEquals( 4084, position );
         pos = 4092;
@@ -79,7 +79,7 @@ public class StoreTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 1 byte overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4081, 0x12345678 );
+        position = ( Long ) method.invoke( recordManager, 4081, 0x12345678, pageIos );
 
         assertEquals( 4085, position );
         pos = 4093;
@@ -91,7 +91,7 @@ public class StoreTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 2 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4082, 0x12345678 );
+        position = ( Long ) method.invoke( recordManager, 4082, 0x12345678, pageIos );
 
         assertEquals( 4086, position );
         pos = 4094;
@@ -103,7 +103,7 @@ public class StoreTest
 
         // Set the int at the end of the first page and overlapping on the second page
         // 3 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4083, 0x12345678 );
+        position = ( Long ) method.invoke( recordManager, 4083, 0x12345678, pageIos );
 
         assertEquals( 4087, position );
         pos = 4095;
@@ -114,7 +114,7 @@ public class StoreTest
         assertEquals( 0x78, pageIos[1].getData().get( pos++ ) );
 
         // Set the int at the beginning of the second page
-        position = ( Long ) method.invoke( recordManager, pageIos, 4084, 0x12345678 );
+        position = ( Long ) method.invoke( recordManager, 4084, 0x12345678, pageIos );
 
         assertEquals( 4088, position );
         pos = 8;
@@ -136,7 +136,7 @@ public class StoreTest
         tempFile.deleteOnExit();
 
         RecordManager recordManager = new RecordManager( tempFileName );
-        Method method = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, long.class );
+        Method method = RecordManager.class.getDeclaredMethod( "store", long.class, long.class, PageIO[].class );
         method.setAccessible( true );
 
         // Allocate some Pages
@@ -147,7 +147,7 @@ public class StoreTest
         pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
 
         // Set the long at the beginning
-        long position = ( Long ) method.invoke( recordManager, pageIos, 0, 0x0123456789ABCDEFL );
+        long position = ( Long ) method.invoke( recordManager, 0, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 8, position );
         int pos = 12;
@@ -161,7 +161,7 @@ public class StoreTest
         assertEquals( ( byte ) 0xEF, pageIos[0].getData().get( pos++ ) );
 
         // Set the long at the end of the first page
-        position = ( Long ) method.invoke( recordManager, pageIos, 4076, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4076, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4084, position );
         pos = 4088;
@@ -176,7 +176,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 1 byte overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4077, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4077, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4085, position );
         pos = 4089;
@@ -192,7 +192,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 2 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4078, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4078, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4086, position );
         pos = 4090;
@@ -208,7 +208,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 3 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4079, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4079, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4087, position );
         pos = 4091;
@@ -224,7 +224,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 4 byte overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4080, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4080, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4088, position );
         pos = 4092;
@@ -240,7 +240,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 5 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4081, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4081, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4089, position );
         pos = 4093;
@@ -256,7 +256,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 6 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4082, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4082, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4090, position );
         pos = 4094;
@@ -272,7 +272,7 @@ public class StoreTest
 
         // Set the long at the end of the first page and overlapping on the second page
         // 7 bytes overlapping
-        position = ( Long ) method.invoke( recordManager, pageIos, 4083, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4083, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4091, position );
         pos = 4095;
@@ -287,7 +287,7 @@ public class StoreTest
         assertEquals( ( byte ) 0xEF, pageIos[1].getData().get( pos++ ) );
 
         // Set the long at the beginning of the second page
-        position = ( Long ) method.invoke( recordManager, pageIos, 4084, 0x0123456789ABCDEFL );
+        position = ( Long ) method.invoke( recordManager, 4084, 0x0123456789ABCDEFL, pageIos );
 
         assertEquals( 4092, position );
         pos = 8;
@@ -314,8 +314,8 @@ public class StoreTest
 
         // We use smaller pages
         RecordManager recordManager = new RecordManager( tempFileName, 32 );
-        Method method = RecordManager.class.getDeclaredMethod( "store", PageIO[].class, long.class, byte[].class );
-        method.setAccessible( true );
+        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, byte[].class, PageIO[].class );
+        storeMethod.setAccessible( true );
 
         // Allocate some Pages
         PageIO[] pageIos = new PageIO[4];
@@ -333,7 +333,7 @@ public class StoreTest
             { 0x01, 0x23, 0x45, 0x67 };
 
         // Set the bytes at the beginning
-        long position = ( Long ) method.invoke( recordManager, pageIos, 0L, bytes );
+        long position = ( Long ) storeMethod.invoke( recordManager, 0L, bytes, pageIos );
 
         assertEquals( 8, position );
         int pos = 12;
@@ -349,7 +349,7 @@ public class StoreTest
         assertEquals( 0x67, pageIos[0].getData().get( pos++ ) );
 
         // Set the bytes at the end of the first page
-        position = ( Long ) method.invoke( recordManager, pageIos, 12L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 12L, bytes, pageIos );
 
         assertEquals( 20, position );
         pos = 24;
@@ -372,7 +372,7 @@ public class StoreTest
             bytes[i] = ( byte ) ( i + 1 );
         }
 
-        position = ( Long ) method.invoke( recordManager, pageIos, 0L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 0L, bytes, pageIos );
 
         assertEquals( 20, position );
         pos = 12;
@@ -389,7 +389,7 @@ public class StoreTest
         }
 
         // Write the bytes over 2 pages
-        position = ( Long ) method.invoke( recordManager, pageIos, 15L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 15L, bytes, pageIos );
 
         assertEquals( 35, position );
         pos = 27;
@@ -418,7 +418,7 @@ public class StoreTest
             bytes[i] = ( byte ) ( i + 1 );
         }
 
-        position = ( Long ) method.invoke( recordManager, pageIos, 2L, bytes );
+        position = ( Long ) storeMethod.invoke( recordManager, 2L, bytes, pageIos );
 
         assertEquals( 86, position );
         pos = 14;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org