directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1551913 [3/3] - in /directory/mavibot/trunk/mavibot/src: main/java/org/apache/directory/mavibot/btree/ main/java/org/apache/directory/mavibot/btree/util/ test/java/org/apache/directory/mavibot/btree/
Date Wed, 18 Dec 2013 11:12:49 GMT
Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
Wed Dec 18 11:12:48 2013
@@ -84,13 +84,13 @@ public class PersistedBTreeBrowseTest
             throw new RuntimeException( e );
         }
     }
-    
-    
+
+
     @After
     public void cleanup() throws IOException
     {
         dataDir = new File( System.getProperty( "java.io.tmpdir" ) + "/recordman" );
-        
+
         btree.close();
 
         if ( dataDir.exists() )
@@ -131,10 +131,11 @@ public class PersistedBTreeBrowseTest
     /**
      * Check a tuple
      */
-    private void checkTuple( Tuple<Long, String> tuple, long key, String value ) throws
EndOfFileExceededException, IOException
+    private void checkTuple( Tuple<Long, String> tuple, long key, String value ) throws
EndOfFileExceededException,
+        IOException
     {
         assertNotNull( tuple );
-        assertEquals( key, (long)tuple.getKey() );
+        assertEquals( key, ( long ) tuple.getKey() );
         assertEquals( value, tuple.getValue() );
     }
 
@@ -142,10 +143,11 @@ public class PersistedBTreeBrowseTest
     /**
      * Check a next() call
      */
-    private void checkNext( TupleCursor<Long, String> cursor, long key, String value,
boolean next, boolean prev ) throws EndOfFileExceededException, IOException
+    private void checkNext( TupleCursor<Long, String> cursor, long key, String value,
boolean next, boolean prev )
+        throws EndOfFileExceededException, IOException
     {
         Tuple<Long, String> tuple = cursor.next();
-        
+
         checkTuple( tuple, key, value );
         assertEquals( next, cursor.hasNext() );
         assertEquals( prev, cursor.hasPrev() );
@@ -155,26 +157,27 @@ public class PersistedBTreeBrowseTest
     /**
      * Check a prev() call
      */
-    private void checkPrev( TupleCursor<Long, String> cursor, long key, String value,
boolean next, boolean prev ) throws EndOfFileExceededException, IOException
+    private void checkPrev( TupleCursor<Long, String> cursor, long key, String value,
boolean next, boolean prev )
+        throws EndOfFileExceededException, IOException
     {
         Tuple<Long, String> tuple = cursor.prev();
         assertNotNull( tuple );
-        assertEquals( key, (long)tuple.getKey() );
+        assertEquals( key, ( long ) tuple.getKey() );
         assertEquals( value, tuple.getValue() );
         assertEquals( next, cursor.hasNext() );
         assertEquals( prev, cursor.hasPrev() );
     }
 
-    
+
     /**
      * Construct a String representation of a number padded with 0 on the left
      */
     private String toString( long value, int size )
     {
         String valueStr = Long.toString( value );
-        
+
         StringBuilder sb = new StringBuilder();
-        
+
         if ( size > valueStr.length() )
         {
             for ( int i = valueStr.length(); i < size; i++ )
@@ -182,14 +185,13 @@ public class PersistedBTreeBrowseTest
                 sb.append( "0" );
             }
         }
-        
+
         sb.append( valueStr );
-        
+
         return sb.toString();
     }
 
 
-    
     //----------------------------------------------------------------------------------------
     // The Browse tests
     //----------------------------------------------------------------------------------------
@@ -200,10 +202,10 @@ public class PersistedBTreeBrowseTest
     public void testBrowseEmptyBTree() throws IOException, BTreeAlreadyManagedException
     {
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         assertFalse( cursor.hasNext() );
         assertFalse( cursor.hasPrev() );
-        
+
         try
         {
             cursor.next();
@@ -213,7 +215,7 @@ public class PersistedBTreeBrowseTest
         {
             // Expected
         }
-        
+
         try
         {
             cursor.prev();
@@ -223,7 +225,7 @@ public class PersistedBTreeBrowseTest
         {
             // Expected
         }
-        
+
         assertEquals( -1L, cursor.getRevision() );
     }
 
@@ -243,13 +245,13 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         checkNext( cursor, 1L, "1", true, false );
         checkNext( cursor, 2L, "2", true, true );
         checkNext( cursor, 3L, "3", true, true );
@@ -273,10 +275,10 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         checkPrev( cursor, 5L, "5", false, true );
         checkPrev( cursor, 4L, "4", true, true );
         checkPrev( cursor, 3L, "3", true, true );
@@ -301,7 +303,7 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // We should not be able to move backward
         try
         {
@@ -319,13 +321,13 @@ public class PersistedBTreeBrowseTest
         Tuple<Long, String> tuple = cursor.next();
         tuple = cursor.next();
         tuple = cursor.next();
-        
+
         // We should be at 3 now
         assertTrue( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        assertEquals( 3L, (long)tuple.getKey() );
+        assertEquals( 3L, ( long ) tuple.getKey() );
         assertEquals( "3", tuple.getValue() );
-        
+
         // Move to the end
         cursor.afterLast();
 
@@ -343,26 +345,25 @@ public class PersistedBTreeBrowseTest
             // Expected
         }
 
-        
         // We should be at 5
         tuple = cursor.prev();
-        assertEquals( 5L, (long)tuple.getKey() );
+        assertEquals( 5L, ( long ) tuple.getKey() );
         assertEquals( "5", tuple.getValue() );
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
 
         // Move back to the origin
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
 
         // We should be at 1
         tuple = cursor.next();
-        assertEquals( 1L, (long)tuple.getKey() );
+        assertEquals( 1L, ( long ) tuple.getKey() );
         assertEquals( "1", tuple.getValue() );
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
     }
@@ -384,7 +385,7 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // We should not be able to move backward
         try
         {
@@ -402,21 +403,21 @@ public class PersistedBTreeBrowseTest
         Tuple<Long, String> tuple = cursor.next();
         tuple = cursor.next();
         tuple = cursor.next();
-        
+
         // We should be at 3 now
         assertTrue( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        assertEquals( 3L, (long)tuple.getKey() );
+        assertEquals( 3L, ( long ) tuple.getKey() );
         assertEquals( "3", tuple.getValue() );
-        
+
         // Now, move to the prev value
         cursor.prev();
-        assertEquals( 2L, (long)tuple.getKey() );
+        assertEquals( 2L, ( long ) tuple.getKey() );
         assertEquals( "2", tuple.getValue() );
-        
+
         // And to the next value
         cursor.next();
-        assertEquals( 3L, (long)tuple.getKey() );
+        assertEquals( 3L, ( long ) tuple.getKey() );
         assertEquals( "3", tuple.getValue() );
     }
 
@@ -435,15 +436,15 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
 
         checkNext( cursor, 1L, "1", true, false );
-        
+
         for ( long i = 2L; i < 999L; i++ )
         {
             checkNext( cursor, i, Long.toString( i ), true, true );
@@ -467,15 +468,15 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
-        
+
         checkPrev( cursor, 999L, "999", false, true );
-        
+
         for ( long i = 998L; i > 1L; i-- )
         {
             checkPrev( cursor, i, Long.toString( i ), true, true );
@@ -500,13 +501,13 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         checkNext( cursor, 1L, "1", true, false );
         checkNext( cursor, 1L, "2", true, true );
         checkNext( cursor, 1L, "3", true, true );
@@ -532,13 +533,13 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         checkNext( cursor, 1L, "1", true, false );
         checkNext( cursor, 1L, "2", true, true );
         checkNext( cursor, 1L, "4", true, true );
@@ -564,13 +565,13 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
-        
+
         checkPrev( cursor, 1L, "5", false, true );
         checkPrev( cursor, 1L, "4", true, true );
         checkPrev( cursor, 1L, "3", true, true );
@@ -596,13 +597,13 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
-        
+
         checkPrev( cursor, 3L, "7", false, true );
         checkPrev( cursor, 3L, "6", true, true );
         checkPrev( cursor, 3L, "5", true, true );
@@ -630,26 +631,26 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
         boolean next = true;
         boolean prev = false;
-        
+
         for ( long i = 1L; i < 1000L; i++ )
         {
             for ( long j = 1L; j < 10L; j++ )
             {
                 checkNext( cursor, i, Long.toString( j ), next, prev );
-                
+
                 if ( ( i == 1L ) && ( j == 1L ) )
                 {
                     prev = true;
                 }
-                
+
                 if ( ( i == 999L ) && ( j == 8L ) )
                 {
                     next = false;
@@ -676,26 +677,26 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
         boolean next = false;
         boolean prev = true;
-        
+
         for ( long i = 999L; i > 0L; i-- )
         {
             for ( long j = 9L; j > 0L; j-- )
             {
                 checkPrev( cursor, i, Long.toString( j ), next, prev );
-                
+
                 if ( ( i == 1L ) && ( j == 2L ) )
                 {
                     prev = false;
                 }
-                
+
                 if ( ( i == 999L ) && ( j == 9L ) )
                 {
                     next = true;
@@ -703,7 +704,7 @@ public class PersistedBTreeBrowseTest
             }
         }
     }
-    
+
 
     /**
      * Test the browse methods on a btree containing just a leaf with duplicate values
@@ -720,23 +721,24 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         checkNext( cursor, 1L, "01", true, false );
-        
+
         for ( long i = 2L; i < 31L; i++ )
         {
             checkNext( cursor, 1L, toString( i, 2 ), true, true );
         }
-        
+
         checkNext( cursor, 1L, "31", false, true );
     }
 
+
     /**
      * Test the browse methods on a btree containing just a leaf with duplicate values
      */
@@ -751,20 +753,20 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
-        
+
         checkPrev( cursor, 1L, "31", false, true );
-        
+
         for ( long i = 30L; i > 1L; i-- )
         {
             checkPrev( cursor, 1L, toString( i, 2 ), true, true );
         }
-        
+
         checkPrev( cursor, 1L, "01", true, false );
     }
 
@@ -779,10 +781,10 @@ public class PersistedBTreeBrowseTest
     public void testBrowseFromEmptyBTree() throws IOException, BTreeAlreadyManagedException
     {
         TupleCursor<Long, String> cursor = btree.browseFrom( 1L );
-        
+
         assertFalse( cursor.hasNext() );
         assertFalse( cursor.hasPrev() );
-        
+
         try
         {
             cursor.next();
@@ -792,7 +794,7 @@ public class PersistedBTreeBrowseTest
         {
             // Expected
         }
-        
+
         try
         {
             cursor.prev();
@@ -802,7 +804,7 @@ public class PersistedBTreeBrowseTest
         {
             // Expected
         }
-        
+
         assertEquals( -1L, cursor.getRevision() );
     }
 
@@ -822,28 +824,28 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor, starting at 5
         TupleCursor<Long, String> cursor = btree.browseFrom( 5L );
-        
+
         assertTrue( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         // Move forward
         checkNext( cursor, 5L, "5", true, true );
         checkNext( cursor, 7L, "7", true, true );
         checkNext( cursor, 9L, "9", false, true );
-        
+
         cursor.close();
-        
+
         // now, start at 5 and move backward
         cursor = btree.browseFrom( 5L );
-        
+
         assertTrue( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
-        
+
         // Move backward
         checkPrev( cursor, 3L, "3", true, true );
         checkPrev( cursor, 1L, "1", true, false );
         cursor.close();
-        
+
         // Start at the first key
         cursor = btree.browseFrom( 1L );
         assertFalse( cursor.hasPrev() );
@@ -851,7 +853,7 @@ public class PersistedBTreeBrowseTest
 
         checkNext( cursor, 1L, "1", true, false );
         checkNext( cursor, 3L, "3", true, true );
-        
+
         // Start before the first key
         cursor = btree.browseFrom( 0L );
         assertFalse( cursor.hasPrev() );
@@ -859,7 +861,7 @@ public class PersistedBTreeBrowseTest
 
         checkNext( cursor, 1L, "1", true, false );
         checkNext( cursor, 3L, "3", true, true );
-        
+
         // Start at the last key
         cursor = btree.browseFrom( 9L );
         assertTrue( cursor.hasPrev() );
@@ -888,8 +890,8 @@ public class PersistedBTreeBrowseTest
 
         checkPrev( cursor, 3L, "3", true, true );
     }
-    
-    
+
+
     /**
      * Test the browseFrom method on a btree containing nodes with duplicate values
      */
@@ -907,14 +909,14 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browseFrom( 500L );
-        
+
         // Move forward
-        
+
         assertTrue( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
         boolean next = true;
         boolean prev = true;
-        
+
         for ( long i = 501L; i < 1000L; i += 2 )
         {
             for ( long j = 1L; j < 10L; j++ )
@@ -928,15 +930,15 @@ public class PersistedBTreeBrowseTest
             }
         }
     }
-    
-    
+
+
     //----------------------------------------------------------------------------------------
     // The TupleCursor.moveToNext/PrevNonDuplicateKey method tests
     //----------------------------------------------------------------------------------------
-   /**
-     * Test the TupleCursor.nextKey method on a btree containing nodes 
-     * with duplicate values.
-     */
+    /**
+      * Test the TupleCursor.nextKey method on a btree containing nodes 
+      * with duplicate values.
+      */
     @Test
     public void testNextKey() throws IOException, BTreeAlreadyManagedException
     {
@@ -951,37 +953,37 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move forward
         cursor.beforeFirst();
-        
+
         assertFalse( cursor.hasPrev() );
         assertTrue( cursor.hasNext() );
         boolean next = true;
         boolean prev = false;
-        
+
         for ( long i = 1L; i < 999L; i++ )
         {
             Tuple<Long, String> tuple = cursor.nextKey();
-            
+
             checkTuple( tuple, i, "1" );
 
-            if ( i == 999L ) 
+            if ( i == 999L )
             {
                 next = false;
             }
 
             assertEquals( next, cursor.hasNext() );
             assertEquals( prev, cursor.hasPrev() );
-            
+
             if ( i == 1L )
             {
                 prev = true;
             }
-       }
+        }
     }
-    
-    
+
+
     /**
      * Test the TupleCursor.moveToPrevNonDuplicateKey method on a btree containing nodes

      * with duplicate values.
@@ -1000,20 +1002,20 @@ public class PersistedBTreeBrowseTest
 
         // Create the cursor
         TupleCursor<Long, String> cursor = btree.browse();
-        
+
         // Move backward
         cursor.afterLast();
-        
+
         assertTrue( cursor.hasPrev() );
         assertFalse( cursor.hasNext() );
         boolean next = true;
         boolean prev = true;
-        
+
         for ( long i = 999L; i > 0L; i-- )
         {
             Tuple<Long, String> tuple = cursor.prevKey();
-            
-            if ( i == 1L ) 
+
+            if ( i == 1L )
             {
                 prev = false;
             }
@@ -1026,6 +1028,6 @@ public class PersistedBTreeBrowseTest
             {
                 next = true;
             }
-       }
+        }
     }
 }
\ No newline at end of file

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
Wed Dec 18 11:12:48 2013
@@ -48,7 +48,7 @@ public class PersistedBTreeBuilderTest
     public void testManagedBTreeBuilding() throws Exception
     {
         List<Tuple<Integer, Integer>> sortedTuple = new ArrayList<Tuple<Integer,
Integer>>();
-        
+
         for ( int i = 1; i < 8; i++ )
         {
             Tuple<Integer, Integer> t = new Tuple<Integer, Integer>( i, i );
@@ -57,20 +57,21 @@ public class PersistedBTreeBuilderTest
 
         File file = File.createTempFile( "managedbtreebuilder", ".data" );
         file.deleteOnExit();
-        
+
         RecordManager rm = new RecordManager( file.getAbsolutePath() );
-        
+
         IntSerializer ser = new IntSerializer();
-        PersistedBTreeBuilder<Integer, Integer> bb = new PersistedBTreeBuilder<Integer,
Integer>( rm, "master", 4, ser, ser );
+        PersistedBTreeBuilder<Integer, Integer> bb = new PersistedBTreeBuilder<Integer,
Integer>( rm, "master", 4, ser,
+            ser );
 
         // contains 1, 2, 3, 4, 5, 6, 7
         BTree<Integer, Integer> btree = bb.build( sortedTuple.iterator() );
 
         rm.close();
-        
+
         rm = new RecordManager( file.getAbsolutePath() );
         btree = rm.getManagedTree( "master" );
-        
+
         assertEquals( 1, btree.getRootPage().getNbElems() );
 
         assertEquals( 7, btree.getRootPage().findRightMost().getKey().intValue() );

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
Wed Dec 18 11:12:48 2013
@@ -72,7 +72,8 @@ public class PersistedBTreeDuplicateKeyT
         try
         {
             // Create a new BTree
-            btree = recordManager1.addBTree( "test", new LongSerializer(), new StringSerializer(),
BTree.ALLOW_DUPLICATES );
+            btree = recordManager1.addBTree( "test", new LongSerializer(), new StringSerializer(),
+                BTree.ALLOW_DUPLICATES );
         }
         catch ( Exception e )
         {
@@ -634,7 +635,7 @@ public class PersistedBTreeDuplicateKeyT
         int i = 32;
         for ( int k = 0; k < i; k++ )
         {
-            btree.insert( (long)k, Long.toString( k ) );
+            btree.insert( ( long ) k, Long.toString( k ) );
         }
 
         // 15 is the last element of the first leaf
@@ -699,7 +700,7 @@ public class PersistedBTreeDuplicateKeyT
 
         for ( int k = 0; k < i; k++ )
         {
-            btree.insert( (long)k, String.valueOf( k ) );
+            btree.insert( ( long ) k, String.valueOf( k ) );
         }
 
         // 15 is the last element of the first leaf
@@ -736,7 +737,7 @@ public class PersistedBTreeDuplicateKeyT
 
         for ( int k = 0; k < i; k++ )
         {
-            btree.insert( (long)k, Long.toString( k ) );
+            btree.insert( ( long ) k, Long.toString( k ) );
         }
 
         // 4 is the last element in the tree
@@ -767,7 +768,7 @@ public class PersistedBTreeDuplicateKeyT
 
         for ( int k = 0; k < i; k++ )
         {
-            btree.insert( (long)k, Long.toString( k ) );
+            btree.insert( ( long ) k, Long.toString( k ) );
         }
 
         // 4 is the last element in the tree
@@ -788,7 +789,7 @@ public class PersistedBTreeDuplicateKeyT
     /**
      * Test that a BTree which forbid duplicate values does not accept them
      */
-    @Test(expected=DuplicateValueNotAllowedException.class)
+    @Test(expected = DuplicateValueNotAllowedException.class)
     public void testBTreeForbidDups() throws IOException, BTreeAlreadyManagedException
     {
         BTree<Long, String> singleValueBtree = recordManager1.addBTree( "test2", new
LongSerializer(),
@@ -796,7 +797,7 @@ public class PersistedBTreeDuplicateKeyT
 
         for ( long i = 0; i < 64; i++ )
         {
-            singleValueBtree.insert( i, Long.toString( i  ) );
+            singleValueBtree.insert( i, Long.toString( i ) );
         }
 
         try

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
Wed Dec 18 11:12:48 2013
@@ -116,7 +116,7 @@ public class PersistedReadTest
 
         // Read it back
         readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 20 );
-        
+
         recordManager.close();
     }
 
@@ -228,7 +228,7 @@ public class PersistedReadTest
 
         // Read it back
         readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 20 );
-        
+
         recordManager.close();
     }
 
@@ -348,13 +348,13 @@ public class PersistedReadTest
         // The byte length
         assertNotNull( readBytes );
         assertEquals( 80, readBytes.limit() );
-        
+
         // The data
         for ( int i = 0; i < 80; i++ )
         {
             assertEquals( i + 1, readBytes.get() );
         }
-        
+
         recordManager.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
Wed Dec 18 11:12:48 2013
@@ -43,6 +43,7 @@ public class PersistedStoreTest
     @Rule
     public TemporaryFolder tempFolder = new TemporaryFolder();
 
+
     /**
      * Test the store( int ) method
      */
@@ -128,7 +129,7 @@ public class PersistedStoreTest
         assertEquals( 0x34, pageIos[1].getData().get( pos++ ) );
         assertEquals( 0x56, pageIos[1].getData().get( pos++ ) );
         assertEquals( 0x78, pageIos[1].getData().get( pos++ ) );
-        
+
         recordManager.close();
     }
 
@@ -306,7 +307,7 @@ public class PersistedStoreTest
         assertEquals( ( byte ) 0xAB, pageIos[1].getData().get( pos++ ) );
         assertEquals( ( byte ) 0xCD, pageIos[1].getData().get( pos++ ) );
         assertEquals( ( byte ) 0xEF, pageIos[1].getData().get( pos++ ) );
-        
+
         recordManager.close();
     }
 
@@ -444,7 +445,7 @@ public class PersistedStoreTest
 
         // The data in the second page
         pos = 8;
-        
+
         for ( int i = 14; i < 38; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[1].getData().get( pos++ ) );
@@ -452,7 +453,7 @@ public class PersistedStoreTest
 
         // The data in the third page
         pos = 8;
-        
+
         for ( int i = 38; i < 62; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[2].getData().get( pos++ ) );
@@ -460,12 +461,12 @@ public class PersistedStoreTest
 
         // The data in the forth page
         pos = 8;
-        
+
         for ( int i = 62; i < 80; i++ )
         {
             assertEquals( ( byte ) ( i + 1 ), pageIos[3].getData().get( pos++ ) );
         }
-        
+
         recordManager.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
Wed Dec 18 11:12:48 2013
@@ -78,20 +78,20 @@ public class RecordManagerFreePageTest
             throw new RuntimeException( e );
         }
     }
-    
-    
+
+
     @After
     public void cleanup() throws IOException
     {
         dataDir = new File( System.getProperty( "java.io.tmpdir" ) + "/recordman" );
-        
+
         btree.close();
 
         if ( dataDir.exists() )
         {
             FileUtils.deleteDirectory( dataDir );
         }
-        
+
         recordManager1.close();
     }
 
@@ -189,7 +189,7 @@ public class RecordManagerFreePageTest
         TupleCursor<Long, String> cursor = btree.browse();
 
         long i = 0;
-        
+
         while ( cursor.hasNext() )
         {
             Tuple<Long, String> t = cursor.next();

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
Wed Dec 18 11:12:48 2013
@@ -87,25 +87,25 @@ public class RecordManagerPrivateMethodT
         Method getFreePageIOsMethod = RecordManager.class.getDeclaredMethod( "getFreePageIOs",
int.class );
         getFreePageIOsMethod.setAccessible( true );
 
-        PageIO[] pages = (org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, 0 );
+        PageIO[] pages = ( org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, 0 );
 
         assertEquals( 0, pages.length );
 
         for ( int i = 1; i < 20; i++ )
         {
-            pages = (org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
+            pages = ( org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
             assertEquals( 1, pages.length );
         }
 
         for ( int i = 21; i < 44; i++ )
         {
-            pages = (org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
+            pages = ( org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
             assertEquals( 2, pages.length );
         }
 
         for ( int i = 45; i < 68; i++ )
         {
-            pages = (org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
+            pages = ( org.apache.directory.mavibot.btree.PageIO[] ) getFreePageIOsMethod.invoke(
recordManager, i );
             assertEquals( 3, pages.length );
         }
 

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
Wed Dec 18 11:12:48 2013
@@ -86,8 +86,8 @@ public class RecordManagerTest
             throw new RuntimeException( e );
         }
     }
-    
-    
+
+
     @After
     public void cleanup() throws IOException
     {
@@ -255,7 +255,7 @@ public class RecordManagerTest
 
         // Now, add some elements in the BTree
         long t0 = System.currentTimeMillis();
-        
+
         for ( Long i = 0L; i < nbElems; i++ )
         {
             String value = "V" + i;
@@ -845,18 +845,19 @@ public class RecordManagerTest
         int pageSize = 16;
         int numKeys = 1;
         String name = "duplicateTree";
-        String[] testValues = new String[]{ "00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10" };
+        String[] testValues = new String[]
+            { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C",
"0D", "0E", "0F", "10" };
 
         BTree<Long, String> dupsTree = BTreeFactory.createPersistedBTree( name, new
LongSerializer(),
             new StringSerializer(), pageSize, true );
 
         recordManager1.manage( dupsTree );
-        
+
         for ( long i = 0; i < numKeys; i++ )
         {
             for ( int k = 0; k < pageSize + 1; k++ )
             {
-                dupsTree.insert( i, testValues[ k ] );
+                dupsTree.insert( i, testValues[k] );
             }
         }
 
@@ -871,7 +872,7 @@ public class RecordManagerTest
 
             for ( int k = 0; k < pageSize + 1; k++ )
             {
-                assertTrue( values.next().equals( testValues[ k ] ) );
+                assertTrue( values.next().equals( testValues[k] ) );
             }
         }
     }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java
Wed Dec 18 11:12:48 2013
@@ -77,8 +77,8 @@ public class RecordManagerWithDuplicates
             throw new RuntimeException( e );
         }
     }
-    
-    
+
+
     @After
     public void cleanup() throws IOException
     {



Mime
View raw message