You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 17:15:29 UTC

svn commit: r1235326 [3/28] - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition...

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java Tue Jan 24 16:15:05 2012
@@ -62,7 +62,7 @@ public class DupsCursorTest
     private static final String TEST_OUTPUT_PATH = "test.output.path";
     private static final int SIZE = 15;
 
-    Table<String,String> table;
+    Table<String, String> table;
     File dbFile;
     RecordManager recman;
     private static SchemaManager schemaManager;
@@ -90,16 +90,16 @@ public class DupsCursorTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 
-    
+
     @Before
     public void createTable() throws Exception
     {
         File tmpDir = null;
-        
+
         if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
         {
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
@@ -108,11 +108,12 @@ public class DupsCursorTest
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
-                comparator, comparator, null, new DefaultSerializer() );
+        table = new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+            comparator, comparator, null, new DefaultSerializer() );
         LOG.debug( "Created new table and populated it with data" );
     }
 
@@ -130,7 +131,7 @@ public class DupsCursorTest
         new File( fileToDelete ).delete();
         new File( fileToDelete + ".db" ).delete();
         new File( fileToDelete + ".lg" ).delete();
-        
+
         dbFile = null;
     }
 
@@ -138,9 +139,9 @@ public class DupsCursorTest
     @Test
     public void testEmptyTableOperations() throws Exception
     {
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         assertFalse( cursor.next() );
-        
+
         cursor.afterLast();
         assertFalse( cursor.previous() );
 
@@ -156,19 +157,19 @@ public class DupsCursorTest
     public void testNextNoDups() throws Exception
     {
         // first try without duplicates at all
-        for ( int i = 0; i < SIZE-1; i++ )
+        for ( int i = 0; i < SIZE - 1; i++ )
         {
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
 
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
             assertEquals( i, Integer.parseInt( tuple.getKey() ) );
             assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             i++;
@@ -179,19 +180,19 @@ public class DupsCursorTest
     @Test
     public void testPreviousNoDups() throws Exception
     {
-        for ( int i = 0; i < SIZE-1; i++ )
+        for ( int i = 0; i < SIZE - 1; i++ )
         {
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
 
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+        Cursor<Tuple<String, String>> cursor = table.cursor();
+
+        int i = SIZE - 2;
 
-        int i = SIZE-2;
-        
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
             assertEquals( i, Integer.parseInt( tuple.getKey() ) );
             assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             i--;
@@ -202,10 +203,10 @@ public class DupsCursorTest
     @Test
     public void testNextDups() throws Exception
     {
-        for ( int i = 0; i < SIZE*3; i++ )
+        for ( int i = 0; i < SIZE * 3; i++ )
         {
             String istr = Integer.toString( i );
-            
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 table.put( "13", istr );
@@ -215,15 +216,15 @@ public class DupsCursorTest
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -234,7 +235,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
     }
@@ -243,30 +244,30 @@ public class DupsCursorTest
     @Test
     public void testPreviousDups() throws Exception
     {
-        for ( int i = 0; i < SIZE*3; i++ )
+        for ( int i = 0; i < SIZE * 3; i++ )
         {
             String istr = Integer.toString( i );
-            
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 table.put( "13", Integer.toString( i ) );
             }
             else
             {
-                
+
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         cursor.afterLast();
 
-        int i = SIZE*3 - 1;
-        
+        int i = SIZE * 3 - 1;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -277,7 +278,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
     }
@@ -286,7 +287,7 @@ public class DupsCursorTest
     @Test
     public void testFirstLastUnderDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*2 - 1; i++ )
+        for ( int i = 0; i < SIZE * 2 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -299,14 +300,14 @@ public class DupsCursorTest
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -317,17 +318,17 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         cursor.first();
         i = 0;
-        
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -338,19 +339,19 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        i = SIZE*2-2;
-        
+        i = SIZE * 2 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -361,18 +362,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        i = SIZE*2-2;
-        
+        i = SIZE * 2 - 2;
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -383,7 +384,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
         while ( cursor.previous() );
@@ -391,12 +392,12 @@ public class DupsCursorTest
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        i = SIZE*2-2;
-        
+        i = SIZE * 2 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -407,7 +408,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
     }
@@ -416,7 +417,7 @@ public class DupsCursorTest
     @Test
     public void testFirstLastOverDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*3-1; i++ )
+        for ( int i = 0; i < SIZE * 3 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -424,20 +425,21 @@ public class DupsCursorTest
             {
                 table.put( "0", istr );
             }
-            else // keys with single values
+            else
+            // keys with single values
             {
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -448,18 +450,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // now go back to first and traverse all over again
         cursor.first();
         i = 0;
-        
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -470,18 +472,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
 
             if ( i < 2 + SIZE )
             {
@@ -493,18 +495,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -515,7 +517,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
         while ( cursor.previous() );
@@ -523,12 +525,12 @@ public class DupsCursorTest
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -539,7 +541,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
     }
@@ -548,7 +550,7 @@ public class DupsCursorTest
     @Test
     public void testFirstOverDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*3-1; i++ )
+        for ( int i = 0; i < SIZE * 3 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -556,20 +558,21 @@ public class DupsCursorTest
             {
                 table.put( "0", istr );
             }
-            else // keys with single values
+            else
+            // keys with single values
             {
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -580,7 +583,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
@@ -589,8 +592,8 @@ public class DupsCursorTest
         i = 0;
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -601,18 +604,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
 
             if ( i < 2 + SIZE )
             {
@@ -629,11 +632,11 @@ public class DupsCursorTest
 
         // now advance to last and go backwards again
         cursor.last();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -644,7 +647,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
         while ( cursor.previous() );
@@ -652,12 +655,12 @@ public class DupsCursorTest
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i < 2 + SIZE )
             {
                 assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
@@ -668,7 +671,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
     }
@@ -677,7 +680,7 @@ public class DupsCursorTest
     @Test
     public void testLastOverDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*3-1; i++ )
+        for ( int i = 0; i < SIZE * 3 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -685,20 +688,21 @@ public class DupsCursorTest
             {
                 table.put( Integer.toString( 3 + SIZE ), istr );
             }
-            else // keys with single values
+            else
+            // keys with single values
             {
                 table.put( istr, istr );
             }
         }
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
 
         int i = 0;
-        
+
         while ( cursor.next() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 2 + SIZE )
             {
                 assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
@@ -709,18 +713,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // now go back to first and traverse all over again
         cursor.first();
         i = 0;
-        
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 2 + SIZE )
             {
                 assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
@@ -731,18 +735,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
 
             if ( i > 2 + SIZE )
             {
@@ -754,18 +758,18 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         do
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 2 + SIZE )
             {
                 assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
@@ -776,7 +780,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
         while ( cursor.previous() );
@@ -784,12 +788,12 @@ public class DupsCursorTest
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        i = SIZE*3-2;
-        
+        i = SIZE * 3 - 2;
+
         while ( cursor.previous() )
         {
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 2 + SIZE )
             {
                 assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
@@ -800,7 +804,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i--;
         }
     }
@@ -809,56 +813,56 @@ public class DupsCursorTest
     @Test
     public void testOnEmptyTable() throws Exception
     {
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
-        
+
         cursor.before( new Tuple<String, String>( "1", "2" ) );
         assertFalse( cursor.available() );
     }
 
-    
+
     @Test
     public void testOverDupLimit() throws Exception
     {
         table.put( "5", "5" );
         table.put( "6", "6" );
-        
+
         for ( int i = 0; i < 20; i++ )
         {
             table.put( "7", Integer.toString( i ) );
         }
-        
+
         table.put( "8", "8" );
         table.put( "9", "9" );
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
-        
+
         cursor.before( new Tuple<String, String>( "7", "2" ) );
         assertFalse( cursor.available() );
     }
 
-    
+
     @Test
     public void testUnderDupLimit() throws Exception
     {
         table.put( "5", "5" );
         table.put( "6", "6" );
-        
+
         for ( int i = 0; i < 10; i++ )
         {
             table.put( "7", Integer.toString( i ) );
         }
-        
+
         table.put( "8", "8" );
         table.put( "9", "9" );
-        
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
-        
+
         cursor.before( new Tuple<String, String>( "7", "2" ) );
         assertFalse( cursor.available() );
     }
@@ -867,7 +871,7 @@ public class DupsCursorTest
     @Test
     public void testBeforeAfterBelowDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*2 - 1; i++ )
+        for ( int i = 0; i < SIZE * 2 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -878,7 +882,8 @@ public class DupsCursorTest
             else if ( i > 17 && i < 21 ) // adds hole with no keys for i
             {
             }
-            else // keys with single values
+            else
+            // keys with single values
             {
                 table.put( istr, istr );
             }
@@ -886,9 +891,9 @@ public class DupsCursorTest
 
         // test before to advance just before a key with a single value
         int i = 5;
-        Cursor<Tuple<String,String>> cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "5", "5" ) );
-        
+        Cursor<Tuple<String, String>> cursor = table.cursor();
+        cursor.before( new Tuple<String, String>( "5", "5" ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
@@ -897,8 +902,8 @@ public class DupsCursorTest
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -909,7 +914,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
@@ -917,8 +922,8 @@ public class DupsCursorTest
         // with a null tuple value which should not advance the dupsCursor
         i = 5;
         cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "5", null ) );
-        
+        cursor.before( new Tuple<String, String>( "5", null ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
@@ -927,7 +932,7 @@ public class DupsCursorTest
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
+            Tuple<String, String> tuple = cursor.get();
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -945,8 +950,8 @@ public class DupsCursorTest
         // does not exist - using value so we hit check for key equality
         i = 21;
         cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "18", "18" ) );
-        
+        cursor.before( new Tuple<String, String>( "18", "18" ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
@@ -955,8 +960,8 @@ public class DupsCursorTest
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -967,20 +972,20 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just after the end
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "111", null ) );
+        cursor.after( new Tuple<String, String>( "111", null ) );
         assertFalse( cursor.next() );
 
         // test after to advance just before a key with a single value
         i = 6;
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "5", null ) );
-        
+        cursor.after( new Tuple<String, String>( "5", null ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
@@ -989,8 +994,8 @@ public class DupsCursorTest
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1001,17 +1006,17 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test before to advance just before a key & value with multiple
         // values for the key - we should advance just before the value
         cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "13", "14" ) );
+        cursor.before( new Tuple<String, String>( "13", "14" ) );
 
         cursor.next();
-        Tuple<String,String> tuple = cursor.get();
+        Tuple<String, String> tuple = cursor.get();
         assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 14, Integer.parseInt( tuple.getValue() ) );
         i = 15;
@@ -1020,7 +1025,7 @@ public class DupsCursorTest
         {
             if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
@@ -1041,24 +1046,24 @@ public class DupsCursorTest
         // test after to advance just before a key & value with multiple
         // values for the key - we should advance just before the value
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "13", "14" ) );
+        cursor.after( new Tuple<String, String>( "13", "14" ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 15, Integer.parseInt( tuple.getValue() ) );
-        i=16;
+        i = 16;
 
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1069,30 +1074,30 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just before a key that does not exist
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "18", null ) );
+        cursor.after( new Tuple<String, String>( "18", null ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 21, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 21, Integer.parseInt( tuple.getValue() ) );
-        i=22;
+        i = 22;
 
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1103,31 +1108,31 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just before a key and value where the key
         // does not exist - used to force key comparison in after()
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "18", "18" ) );
+        cursor.after( new Tuple<String, String>( "18", "18" ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 21, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 21, Integer.parseInt( tuple.getValue() ) );
-        i=22;
+        i = 22;
 
         while ( cursor.next() )
         {
             if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1138,7 +1143,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
     }
@@ -1147,7 +1152,7 @@ public class DupsCursorTest
     @Test
     public void testBeforeAfterOverDupLimit() throws Exception
     {
-        for ( int i = 0; i < SIZE*3 - 1; i++ )
+        for ( int i = 0; i < SIZE * 3 - 1; i++ )
         {
             String istr = Integer.toString( i );
 
@@ -1155,10 +1160,11 @@ public class DupsCursorTest
             {
                 table.put( "13", Integer.toString( i ) );
             }
-            else if ( i > 17 + SIZE  && i < 21 + SIZE ) // adds hole with no keys for i
+            else if ( i > 17 + SIZE && i < 21 + SIZE ) // adds hole with no keys for i
             {
             }
-            else // keys with single values
+            else
+            // keys with single values
             {
                 table.put( istr, istr );
             }
@@ -1166,19 +1172,19 @@ public class DupsCursorTest
 
         // test before to advance just before a key with a single value
         int i = 5;
-        Cursor<Tuple<String,String>> cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "5", "5" ) );
-        
+        Cursor<Tuple<String, String>> cursor = table.cursor();
+        cursor.before( new Tuple<String, String>( "5", "5" ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1189,7 +1195,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
@@ -1197,18 +1203,18 @@ public class DupsCursorTest
         // with a null tuple value which should not advance the dupsCursor
         i = 5;
         cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "5", null ) );
-        
+        cursor.before( new Tuple<String, String>( "5", null ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1227,19 +1233,19 @@ public class DupsCursorTest
         i = 21 + SIZE;
         cursor = table.cursor();
         String istr = Integer.toString( 18 + SIZE );
-        
-        cursor.before( new Tuple<String,String>( istr, istr ) );
-        
+
+        cursor.before( new Tuple<String, String>( istr, istr ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1250,30 +1256,30 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just after the end
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "111", null ) );
+        cursor.after( new Tuple<String, String>( "111", null ) );
         assertFalse( cursor.next() );
 
         // test after to advance just before a key with a single value
         i = 6;
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "5", null ) );
-        
+        cursor.after( new Tuple<String, String>( "5", null ) );
+
         while ( cursor.next() )
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<String,String> tuple = cursor.get();
-            
+            Tuple<String, String> tuple = cursor.get();
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1284,17 +1290,17 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test before to advance just before a key & value with multiple
         // values for the key - we should advance just before the value
         cursor = table.cursor();
-        cursor.before( new Tuple<String,String>( "13", "14" ) );
+        cursor.before( new Tuple<String, String>( "13", "14" ) );
 
         cursor.next();
-        Tuple<String,String> tuple = cursor.get();
+        Tuple<String, String> tuple = cursor.get();
         assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 14, Integer.parseInt( tuple.getValue() ) );
         i = 15;
@@ -1303,12 +1309,12 @@ public class DupsCursorTest
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1319,31 +1325,31 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just before a key & value with multiple
         // values for the key - we should advance just before the value
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( "13", "14" ) );
+        cursor.after( new Tuple<String, String>( "13", "14" ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 15, Integer.parseInt( tuple.getValue() ) );
-        i=16;
+        i = 16;
 
         while ( cursor.next() )
         {
             if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( Integer.toString(  i ) ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1354,19 +1360,19 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
 
         // test after to advance just before a key that does not exist
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( Integer.toString( 18 + SIZE ), null ) );
+        cursor.after( new Tuple<String, String>( Integer.toString( 18 + SIZE ), null ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 21 + SIZE, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 21 + SIZE, Integer.parseInt( tuple.getValue() ) );
-        i=22 + SIZE;
+        i = 22 + SIZE;
 
         while ( cursor.next() )
         {
@@ -1393,13 +1399,13 @@ public class DupsCursorTest
         // test after to advance just before a key and value where the key
         // does not exist - used to force key comparison in after()
         cursor = table.cursor();
-        cursor.after( new Tuple<String,String>( istr, istr ) );
+        cursor.after( new Tuple<String, String>( istr, istr ) );
 
         cursor.next();
         tuple = cursor.get();
         assertEquals( 21 + SIZE, Integer.parseInt( tuple.getKey() ) );
         assertEquals( 21 + SIZE, Integer.parseInt( tuple.getValue() ) );
-        i=22+ SIZE;
+        i = 22 + SIZE;
 
         while ( cursor.next() )
         {
@@ -1410,7 +1416,7 @@ public class DupsCursorTest
             }
 
             tuple = cursor.get();
-            
+
             if ( i > 12 && i < 17 + SIZE )
             {
                 assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
@@ -1421,7 +1427,7 @@ public class DupsCursorTest
                 assertEquals( i, Integer.parseInt( tuple.getKey() ) );
                 assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            
+
             i++;
         }
     }
@@ -1430,7 +1436,7 @@ public class DupsCursorTest
     @Test
     public void testMiscellaneous() throws Exception
     {
-        Cursor<Tuple<String,String>> cursor = table.cursor();
+        Cursor<Tuple<String, String>> cursor = table.cursor();
         assertNotNull( cursor );
 
         try
@@ -1438,7 +1444,7 @@ public class DupsCursorTest
             cursor.get();
             fail( "Should never get here due to invalid cursor position exception." );
         }
-        catch( InvalidCursorPositionException e )
+        catch ( InvalidCursorPositionException e )
         {
         }
     }

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java Tue Jan 24 16:15:05 2012
@@ -55,19 +55,20 @@ public class JdbmBrowserBugTest
     private File dbFile = null;
     private RecordManager recman = null;
 
+
     @Before
     public void createTree() throws Exception
     {
         comparator = new Comparator<Integer>()
         {
-          public int compare( Integer i1, Integer i2 )
-          {
-              return i1.compareTo( i2 );
-          }
+            public int compare( Integer i1, Integer i2 )
+            {
+                return i1.compareTo( i2 );
+            }
         };
 
         File tmpDir = null;
-        
+
         if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
         {
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
@@ -75,7 +76,8 @@ public class JdbmBrowserBugTest
 
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
-        bt = new BTree<Integer, Integer>( recman, new IntegerComparator(), new IntegerSerializer(), new IntegerSerializer() );
+        bt = new BTree<Integer, Integer>( recman, new IntegerComparator(), new IntegerSerializer(),
+            new IntegerSerializer() );
         LOG.debug( "created new BTree" );
     }
 
@@ -86,7 +88,7 @@ public class JdbmBrowserBugTest
         recman.close();
         recman = null;
         bt = null;
-        
+
         if ( dbFile.exists() )
         {
             String fileToDelete = dbFile.getAbsolutePath();
@@ -96,7 +98,7 @@ public class JdbmBrowserBugTest
 
             dbFile.delete();
         }
-        
+
         dbFile = null;
     }
 

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Tue Jan 24 16:15:05 2012
@@ -82,7 +82,7 @@ public class JdbmIndexTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 
@@ -124,7 +124,7 @@ public class JdbmIndexTest
 
             // created by TransactionManager, if transactions are not disabled
             File logFile = new File( idx.getWkDirPath().getPath(), idx.getAttribute().getOid() + ".lg" );
-            
+
             if ( logFile.exists() )
             {
                 assertTrue( logFile.delete() );
@@ -149,7 +149,7 @@ public class JdbmIndexTest
         {
             jdbmIdx = new JdbmIndex<String, Entry>();
         }
-        
+
         AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OU_AT );
 
         jdbmIdx.init( schemaManager, attributeType );
@@ -183,7 +183,7 @@ public class JdbmIndexTest
         catch ( Exception e )
         {
         }
-        
+
         assertEquals( "ou", idx.getAttributeId() );
 
         destroyIndex();
@@ -228,7 +228,7 @@ public class JdbmIndexTest
 
         // initialized index
         initIndex();
-        
+
         try
         {
             idx.setWkDirPath( wkdir.toURI() );
@@ -237,7 +237,7 @@ public class JdbmIndexTest
         catch ( Exception e )
         {
         }
-        
+
         assertEquals( dbFileDir.toURI(), idx.getWkDirPath() );
 
         destroyIndex();

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java Tue Jan 24 16:15:05 2012
@@ -80,7 +80,7 @@ public class JdbmMasterTableTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java Tue Jan 24 16:15:05 2012
@@ -81,7 +81,7 @@ public class JdbmRdnIndexTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 
@@ -123,7 +123,7 @@ public class JdbmRdnIndexTest
 
             // created by TransactionManager, if transactions are not disabled
             File logFile = new File( idx.getWkDirPath().getPath(), idx.getAttribute().getOid() + ".lg" );
-            
+
             if ( logFile.exists() )
             {
                 assertTrue( logFile.delete() );
@@ -149,7 +149,8 @@ public class JdbmRdnIndexTest
             jdbmIdx = new JdbmRdnIndex<Long>();
         }
 
-        jdbmIdx.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( ApacheSchemaConstants.APACHE_RDN_AT_OID ) );
+        jdbmIdx.init( schemaManager,
+            schemaManager.lookupAttributeTypeRegistry( ApacheSchemaConstants.APACHE_RDN_AT_OID ) );
         this.idx = jdbmIdx;
     }
 
@@ -176,10 +177,10 @@ public class JdbmRdnIndexTest
         catch ( Exception e )
         {
         }
-        
+
         destroyIndex();
         initIndex();
-        
+
         assertEquals( Index.DEFAULT_INDEX_CACHE_SIZE, idx.getCacheSize() );
     }
 
@@ -196,7 +197,7 @@ public class JdbmRdnIndexTest
 
         // initialized index
         initIndex();
-        
+
         try
         {
             idx.setWkDirPath( wkdir.toURI() );
@@ -205,11 +206,11 @@ public class JdbmRdnIndexTest
         catch ( Exception e )
         {
         }
-        
+
         assertEquals( dbFileDir.toURI(), idx.getWkDirPath() );
 
         destroyIndex();
-        
+
         jdbmRdnIndex = new JdbmRdnIndex<Long>();
         wkdir.mkdirs();
         jdbmRdnIndex.setWkDirPath( wkdir.toURI() );
@@ -226,7 +227,8 @@ public class JdbmRdnIndexTest
         assertNull( rdnIndex.getAttribute() );
 
         initIndex();
-        assertEquals( schemaManager.lookupAttributeTypeRegistry( ApacheSchemaConstants.APACHE_RDN_AT ), idx.getAttribute() );
+        assertEquals( schemaManager.lookupAttributeTypeRegistry( ApacheSchemaConstants.APACHE_RDN_AT ),
+            idx.getAttribute() );
     }
 
 
@@ -247,14 +249,14 @@ public class JdbmRdnIndexTest
 
         // setting a different parentId should make this key a different key
         key = new ParentIdAndRdn<Long>( 1L, new Rdn( "cn=key" ) );
-        
+
         idx.add( key, 1l );
         assertEquals( 2, idx.count() );
 
         //count shouldn't get affected cause of inserting the same key
         idx.add( key, 2l );
         assertEquals( 2, idx.count() );
-        
+
         key = new ParentIdAndRdn<Long>( 2L, new Rdn( "cn=key" ) );
         idx.add( key, 3l );
         assertEquals( 3, idx.count() );
@@ -265,9 +267,9 @@ public class JdbmRdnIndexTest
     public void testCountOneArg() throws Exception
     {
         initIndex();
-        
+
         ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
-        
+
         assertEquals( 0, idx.count( key ) );
 
         idx.add( key, 0l );
@@ -283,15 +285,15 @@ public class JdbmRdnIndexTest
     public void testLookups() throws Exception
     {
         initIndex();
-        
+
         ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( schemaManager, "cn=key" ) );
-        
+
         assertNull( idx.forwardLookup( key ) );
 
         idx.add( key, 0l );
         assertEquals( 0, ( long ) idx.forwardLookup( key ) );
         assertEquals( key, idx.reverseLookup( 0l ) );
-        
+
         // check with the different case in UP name, this ensures that the custom
         // key comparator is used
         key = new ParentIdAndRdn<Long>( 0L, new Rdn( schemaManager, "cn=KEY" ) );
@@ -304,15 +306,15 @@ public class JdbmRdnIndexTest
     public void testAddDropById() throws Exception
     {
         initIndex();
-        
+
         ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
-        
+
         assertNull( idx.forwardLookup( key ) );
 
         // test add/drop without adding any duplicates
         idx.add( key, 0l );
         assertEquals( 0, ( long ) idx.forwardLookup( key ) );
-        
+
         idx.drop( key, 0l );
         assertNull( idx.forwardLookup( key ) );
         assertNull( idx.reverseLookup( 0l ) );
@@ -327,23 +329,23 @@ public class JdbmRdnIndexTest
     public void testCursors() throws Exception
     {
         initIndex();
-        
+
         ParentIdAndRdn<Long> key = new ParentIdAndRdn<Long>( 0L, new Rdn( "cn=key" ) );
-        
+
         assertEquals( 0, idx.count() );
 
         idx.add( key, 0l );
         assertEquals( 1, idx.count() );
-        
-        for( long i=1; i< 5; i++ )
+
+        for ( long i = 1; i < 5; i++ )
         {
             key = new ParentIdAndRdn<Long>( i, new Rdn( "cn=key" + i ) );
-            
+
             idx.add( key, ( long ) i );
         }
 
         assertEquals( 5, idx.count() );
-        
+
         // use forward index's cursor
         Cursor<IndexEntry<ParentIdAndRdn<Long>, Long>> cursor = idx.forwardCursor();
         cursor.beforeFirst();
@@ -359,7 +361,7 @@ public class JdbmRdnIndexTest
         assertEquals( 1, ( long ) e2.getId() );
         assertEquals( "cn=key1", e2.getValue().getRdns()[0].getName() );
         assertEquals( 1, e2.getValue().getParentId().longValue() );
-        
+
         cursor.next();
         IndexEntry<ParentIdAndRdn<Long>, Long> e3 = cursor.get();
         assertEquals( 2, ( long ) e3.getId() );
@@ -367,22 +369,21 @@ public class JdbmRdnIndexTest
         assertEquals( 2, e3.getValue().getParentId().longValue() );
     }
 
-
-//    @Test
-//    public void testStoreRdnWithTwoATAVs() throws Exception
-//    {
-//        initIndex();
-//        
-//        Dn dn = new Dn( "dc=example,dc=com" );
-//        dn.normalize( schemaManager.getNormalizerMapping() );
-//        
-//        Rdn rdn = new Rdn( dn.getName() );
-//        rdn._setParentId( 1 );
-//        idx.add( rdn, 0l );
-//        
-//        Rdn rdn2 = idx.reverseLookup( 0l );
-//        System.out.println( rdn2 );
-//        InternalRdnComparator rdnCom = new InternalRdnComparator( "" );
-//        assertEquals( 0, rdnCom.compare( rdn, rdn2 ) );
-//    }
+    //    @Test
+    //    public void testStoreRdnWithTwoATAVs() throws Exception
+    //    {
+    //        initIndex();
+    //        
+    //        Dn dn = new Dn( "dc=example,dc=com" );
+    //        dn.normalize( schemaManager.getNormalizerMapping() );
+    //        
+    //        Rdn rdn = new Rdn( dn.getName() );
+    //        rdn._setParentId( 1 );
+    //        idx.add( rdn, 0l );
+    //        
+    //        Rdn rdn2 = idx.reverseLookup( 0l );
+    //        System.out.println( rdn2 );
+    //        InternalRdnComparator rdnCom = new InternalRdnComparator( "" );
+    //        assertEquals( 0, rdnCom.compare( rdn, rdn2 ) );
+    //    }
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Tue Jan 24 16:15:05 2012
@@ -99,6 +99,7 @@ public class JdbmStoreTest
     /** The SN AttributeType instance */
     private static AttributeType SN_AT;
 
+
     @BeforeClass
     public static void setup() throws Exception
     {
@@ -121,7 +122,7 @@ public class JdbmStoreTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
 
         EXAMPLE_COM = new Dn( schemaManager, "dc=example,dc=com" );
@@ -151,7 +152,7 @@ public class JdbmStoreTest
         JdbmIndex ouIndex = new JdbmIndex( SchemaConstants.OU_AT_OID );
         ouIndex.setWkDirPath( wkdir.toURI() );
         store.addIndex( ouIndex );
-        
+
         JdbmIndex uidIndex = new JdbmIndex( SchemaConstants.UID_AT_OID );
         uidIndex.setWkDirPath( wkdir.toURI() );
         store.addIndex( uidIndex );
@@ -237,7 +238,7 @@ public class JdbmStoreTest
 
         assertNull( jdbmPartition.getAliasIndex() );
         Index<String, Entry, Long> index = new JdbmIndex<String, Entry>( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
-        ((Store<Entry, Long>)jdbmPartition).addIndex( index );
+        ( ( Store<Entry, Long> ) jdbmPartition ).addIndex( index );
         assertNotNull( jdbmPartition.getAliasIndex() );
 
         assertEquals( JdbmPartition.DEFAULT_CACHE_SIZE, jdbmPartition.getCacheSize() );
@@ -249,11 +250,13 @@ public class JdbmStoreTest
         assertNotNull( jdbmPartition.getPresenceIndex() );
 
         assertNull( jdbmPartition.getOneLevelIndex() );
-        ((Store<Entry, Long>)jdbmPartition).addIndex( new JdbmIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
+        ( ( Store<Entry, Long> ) jdbmPartition ).addIndex( new JdbmIndex<Long, Entry>(
+            ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) );
         assertNotNull( jdbmPartition.getOneLevelIndex() );
 
         assertNull( jdbmPartition.getSubLevelIndex() );
-        ((Store<Entry, Long>)jdbmPartition).addIndex( new JdbmIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
+        ( ( Store<Entry, Long> ) jdbmPartition ).addIndex( new JdbmIndex<Long, Entry>(
+            ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
         assertNotNull( jdbmPartition.getSubLevelIndex() );
 
         assertNull( jdbmPartition.getId() );
@@ -265,7 +268,8 @@ public class JdbmStoreTest
         assertNotNull( jdbmPartition.getRdnIndex() );
 
         assertNull( jdbmPartition.getOneAliasIndex() );
-        ((Store<Entry, Long>)jdbmPartition).addIndex( new JdbmIndex<Long, Entry>( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
+        ( ( Store<Entry, Long> ) jdbmPartition ).addIndex( new JdbmIndex<Long, Entry>(
+            ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) );
         assertNotNull( jdbmPartition.getOneAliasIndex() );
 
         assertNull( jdbmPartition.getSubAliasIndex() );
@@ -433,13 +437,13 @@ public class JdbmStoreTest
 
         Iterator<String> userIndices = store.getUserIndices();
         int count = 0;
-        
+
         while ( userIndices.hasNext() )
         {
             userIndices.next();
             count++;
         }
-        
+
         assertEquals( 2, count );
         assertFalse( store.hasUserIndexOn( DC_AT ) );
         assertTrue( store.hasUserIndexOn( OU_AT ) );
@@ -530,7 +534,7 @@ public class JdbmStoreTest
         entry.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
         entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
         entry.add( "entryUUID", UUID.randomUUID().toString() );
-        
+
         AddOperationContext addContext = new AddOperationContext( null, entry );
         store.add( addContext );
 
@@ -727,7 +731,7 @@ public class JdbmStoreTest
         Rdn rdn = new Rdn( "sn=James" );
 
         store.rename( dn, rdn, true, null );
-        
+
         dn = new Dn( schemaManager, "sn=James,ou=Engineering,o=Good Times Co." );
         Entry renamed = store.lookup( new LookupOperationContext( null, dn ) );
         assertNotNull( renamed );

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java Tue Jan 24 16:15:05 2012
@@ -58,7 +58,7 @@ public class JdbmTableNoDuplicatesTest
     private static final Logger LOG = LoggerFactory.getLogger( JdbmTableNoDuplicatesTest.class.getSimpleName() );
     private static final String TEST_OUTPUT_PATH = "test.output.path";
 
-    Table<String,String> table;
+    Table<String, String> table;
     File dbFile;
     RecordManager recman;
     private static SchemaManager schemaManager;
@@ -86,17 +86,17 @@ public class JdbmTableNoDuplicatesTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 
-    
+
     @Before
     public void createTable() throws Exception
     {
         destroyTable();
         File tmpDir = null;
-        
+
         if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
         {
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
@@ -105,9 +105,10 @@ public class JdbmTableNoDuplicatesTest
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
-        table = new JdbmTable<String,String>( schemaManager, "test", recman, comparator, null, null );
+        table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
         LOG.debug( "Created new table and populated it with data" );
     }
 
@@ -137,24 +138,25 @@ public class JdbmTableNoDuplicatesTest
 
             dbFile.delete();
         }
-        
+
         dbFile = null;
     }
-    
+
 
     @Test
     public void testCloseReopen() throws Exception
     {
         table.put( "1", "2" );
         table.close();
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
-        table = new JdbmTable<String,String>( schemaManager, "test", recman, comparator, null, null );
+        table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
         assertEquals( "2", table.get( "1" ) );
     }
 
-    
-    @Test 
+
+    @Test
     public void testConfigMethods() throws Exception
     {
         assertFalse( table.isDupsEnabled() );
@@ -162,7 +164,7 @@ public class JdbmTableNoDuplicatesTest
         assertNotNull( table.getKeyComparator() );
     }
 
-    
+
     @Test
     public void testWhenEmpty() throws Exception
     {
@@ -172,11 +174,11 @@ public class JdbmTableNoDuplicatesTest
 
         // Test get method
         assertNull( table.get( "0" ) );
-        
+
         // Test remove methods
         table.remove( "1" );
         assertNull( table.get( "1" ) );
-        
+
         // Test has operations
         assertFalse( table.has( "1" ) );
         assertFalse( table.has( "1", "0" ) );
@@ -202,7 +204,7 @@ public class JdbmTableNoDuplicatesTest
         }
     }
 
-    
+
     @Test
     public void testLoadData() throws Exception
     {
@@ -212,21 +214,21 @@ public class JdbmTableNoDuplicatesTest
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
-        
+
         assertEquals( 10, table.count() );
         assertEquals( 1, table.count( "0" ) );
-        
+
         /*
          * If counts are exact then we can test for exact values.  Again this 
          * is not a critical function but one used for optimization so worst 
          * case guesses are allowed.
          */
-        
+
         assertEquals( 10, table.lessThanCount( "5" ) );
         assertEquals( 10, table.greaterThanCount( "5" ) );
     }
-    
-    
+
+
     /**
      * Let's test keys with a null or lack of any values.
      * @throws Exception on error
@@ -235,30 +237,30 @@ public class JdbmTableNoDuplicatesTest
     public void testNullOrEmptyKeyValue() throws Exception
     {
         assertEquals( 0, table.count() );
-        
+
         try
         {
             table.put( "1", null );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         try
         {
             table.put( null, "2" );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         assertEquals( 0, table.count() );
         assertEquals( null, table.get( "1" ) );
-        
+
         // Let's add the key with a valid value and remove just the value
         assertEquals( 0, table.count( "1" ) );
         table.remove( "1" );
@@ -270,7 +272,7 @@ public class JdbmTableNoDuplicatesTest
         assertNull( table.get( "1" ) );
         assertFalse( table.has( "1" ) );
     }
-    
+
 
     @Test
     public void testRemove() throws Exception
@@ -280,12 +282,12 @@ public class JdbmTableNoDuplicatesTest
         assertNull( table.get( "1" ) );
 
         table.put( "10", "10" );
-        
+
         table.remove( "10", "11" );
         assertFalse( table.has( "10", "11" ) );
-        
-//        assertNull( table.remove( null ) );
-//        assertNull( table.remove( null, null ) );
+
+        //        assertNull( table.remove( null ) );
+        //        assertNull( table.remove( null, null ) );
     }
 
 
@@ -299,19 +301,19 @@ public class JdbmTableNoDuplicatesTest
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
-        
+
         assertEquals( SIZE, table.count() );
         table.put( "0", "0" );
         assertTrue( table.has( "0", "0" ) );
     }
-    
+
 
     @Test
     public void testHas() throws Exception
     {
         assertFalse( table.has( "1" ) );
         final int SIZE = 15;
-        
+
         for ( int i = 0; i < SIZE; i++ )
         {
             String istr = Integer.toString( i );
@@ -322,22 +324,22 @@ public class JdbmTableNoDuplicatesTest
         assertFalse( table.has( "-1" ) );
         assertTrue( table.hasGreaterOrEqual( "-1" ) );
         assertFalse( table.hasLessOrEqual( "-1" ) );
-        
+
         assertTrue( table.has( "0" ) );
         assertTrue( table.hasGreaterOrEqual( "0" ) );
         assertTrue( table.hasLessOrEqual( "0" ) );
-        
+
         assertTrue( table.has( Integer.toString( SIZE - 1 ) ) );
         assertTrue( table.hasGreaterOrEqual( Integer.toString( SIZE - 1 ) ) );
         assertTrue( table.hasLessOrEqual( Integer.toString( SIZE - 1 ) ) );
-        
+
         assertFalse( table.has( Integer.toString( SIZE ) ) );
         assertFalse( table.hasGreaterOrEqual( Integer.toString( SIZE ) ) );
         assertTrue( table.hasLessOrEqual( Integer.toString( SIZE ) ) );
         table.remove( "10" );
         table.remove( "11" );
         assertTrue( table.hasLessOrEqual( "11" ) );
-        
+
         try
         {
             assertFalse( table.hasGreaterOrEqual( "1", "1" ) );
@@ -360,8 +362,8 @@ public class JdbmTableNoDuplicatesTest
         {
             assertTrue( table.hasLessOrEqual( "1", "2" ) );
             fail( "Should never get here since no dups tables " +
-                  "freak when they cannot find a value comparator" );
-        } 
+                "freak when they cannot find a value comparator" );
+        }
         catch ( UnsupportedOperationException e )
         {
             assertNotNull( e );

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java Tue Jan 24 16:15:05 2012
@@ -70,8 +70,8 @@ public class JdbmTableWithDuplicatesTest
     private static final String SIZE2_MINUS_ONE_STR = "29";
     private static final String SIZE2_STR = "30";
     private static final String SIZE2_PLUS_ONE_STR = "31";
-    
-    JdbmTable<String,String> table;
+
+    JdbmTable<String, String> table;
     File dbFile;
     RecordManager recman;
     private static SchemaManager schemaManager;
@@ -99,17 +99,17 @@ public class JdbmTableWithDuplicatesTest
 
         if ( !loaded )
         {
-            fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+            fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
     }
 
-    
-    @Before 
+
+    @Before
     public void createTable() throws Exception
     {
         destroyTable();
         File tmpDir = null;
-        
+
         if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
         {
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
@@ -118,11 +118,12 @@ public class JdbmTableWithDuplicatesTest
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
-                comparator, comparator, new DefaultSerializer(), new DefaultSerializer() );
+        table = new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+            comparator, comparator, new DefaultSerializer(), new DefaultSerializer() );
         LOG.debug( "Created new table and populated it with data" );
     }
 
@@ -161,7 +162,7 @@ public class JdbmTableWithDuplicatesTest
     public void testSerializers() throws Exception
     {
         assertNotNull( table.getKeySerializer() );
-        assertNotNull( ( ( JdbmTable<?,?> ) table ).getValueSerializer() );
+        assertNotNull( ( ( JdbmTable<?, ?> ) table ).getValueSerializer() );
     }
 
 
@@ -173,28 +174,30 @@ public class JdbmTableWithDuplicatesTest
     }
 
 
-    @Test( expected = IllegalArgumentException.class )
+    @Test(expected = IllegalArgumentException.class)
     public void testNullKeyComparator() throws Exception
     {
         assertNotNull( table.getKeyComparator() );
 
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
+        new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
             null, comparator, null, new IntegerSerializer() );
     }
 
 
-    @Test( expected = IllegalArgumentException.class )
+    @Test(expected = IllegalArgumentException.class)
     public void testNullValueComparator() throws Exception
     {
         assertNotNull( table.getValueComparator() );
 
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
+        new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
             comparator, null, null, new IntegerSerializer() );
     }
 
@@ -205,16 +208,17 @@ public class JdbmTableWithDuplicatesTest
         table.put( "1", "2" );
         assertEquals( "2", table.get( "1" ) );
         table.close();
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
-                comparator, comparator, new DefaultSerializer(), new DefaultSerializer() );
+        table = new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+            comparator, comparator, new DefaultSerializer(), new DefaultSerializer() );
         assertEquals( "2", table.get( "1" ) );
     }
 
-    
-    @Test 
+
+    @Test
     public void testConfigMethods() throws Exception
     {
         assertTrue( table.isDupsEnabled() );
@@ -222,7 +226,7 @@ public class JdbmTableWithDuplicatesTest
         assertNotNull( table.getKeyComparator() );
     }
 
-    
+
     @Test
     public void testWhenEmpty() throws Exception
     {
@@ -237,7 +241,7 @@ public class JdbmTableWithDuplicatesTest
         // Test remove methods
         table.remove( "1" );
         assertFalse( table.has( "1" ) );
-        
+
         // Test has operations
         assertFalse( table.has( "1" ) );
         assertFalse( table.has( "1", "0" ) );
@@ -258,23 +262,23 @@ public class JdbmTableWithDuplicatesTest
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
-        
+
         assertEquals( SIZE, table.count() );
         table.put( "0", "0" );
         assertTrue( table.has( "0", "0" ) );
 
         // add some duplicates
-        for ( int i = 0; i < SIZE*2; i++ )
+        for ( int i = 0; i < SIZE * 2; i++ )
         {
             String istr = Integer.toString( i );
             table.put( SIZE2_STR, istr );
         }
-        
-        assertEquals( SIZE*3, table.count() );
-        
+
+        assertEquals( SIZE * 3, table.count() );
+
         table.put( "0", "0" );
         assertTrue( table.has( "0", "0" ) );
-        
+
         table.put( SIZE2_STR, "0" );
         assertTrue( table.has( SIZE2_STR, "0" ) );
     }
@@ -284,13 +288,13 @@ public class JdbmTableWithDuplicatesTest
     public void testHas() throws Exception
     {
         assertFalse( table.has( "1" ) );
-        
-        for ( int i = 0; i < SIZE*2; i++ )
+
+        for ( int i = 0; i < SIZE * 2; i++ )
         {
             String istr = Integer.toString( i );
             table.put( "1", istr );
         }
-        
+
         assertEquals( SIZE2, table.count() );
 
         assertTrue( table.has( "1" ) );
@@ -328,7 +332,7 @@ public class JdbmTableWithDuplicatesTest
         assertTrue( table.hasLessOrEqual( "1", SIZE2_STR ) );
         assertFalse( table.hasGreaterOrEqual( "1", SIZE2_PLUS_ONE_STR ) );
         assertFalse( table.has( "1", SIZE2_PLUS_ONE_STR ) );
-        
+
         // now do not add duplicates and check has( key, boolean )
         for ( int i = 0; i < SIZE; i++ )
         {
@@ -336,19 +340,19 @@ public class JdbmTableWithDuplicatesTest
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
-        
+
         assertFalse( table.has( "-1" ) );
         assertTrue( table.hasGreaterOrEqual( "-1" ) );
         assertFalse( table.hasLessOrEqual( "-1" ) );
-        
+
         assertTrue( table.has( "0" ) );
         assertTrue( table.hasGreaterOrEqual( "0" ) );
         assertTrue( table.hasLessOrEqual( "0" ) );
-        
+
         assertTrue( table.has( SIZE_MINUS_ONE_STR ) );
         assertTrue( table.hasGreaterOrEqual( SIZE_MINUS_ONE_STR ) );
         assertTrue( table.hasLessOrEqual( SIZE_MINUS_ONE_STR ) );
-        
+
         assertFalse( table.has( SIZE_STR ) );
         assertFalse( table.hasGreaterOrEqual( SIZE_STR ) );
         assertTrue( table.hasLessOrEqual( SIZE_STR ) );
@@ -359,11 +363,11 @@ public class JdbmTableWithDuplicatesTest
             {
                 continue;
             }
-            
+
             String istr = Integer.toString( i );
             table.remove( istr, istr );
         }
-        
+
         // delete all values of the duplicate key one by one
         for ( int i = 0; i < SIZE * 2 + 1; i++ )
         {
@@ -374,7 +378,7 @@ public class JdbmTableWithDuplicatesTest
         Cursor<Tuple<String, String>> cursor = table.cursor();
 
         cursor.beforeFirst();
-        
+
         while ( cursor.next() )
         {
             //System.out.println( cursor.get() );
@@ -389,7 +393,7 @@ public class JdbmTableWithDuplicatesTest
 
     }
 
-    
+
     @Test
     public void testRemove() throws Exception
     {
@@ -412,22 +416,22 @@ public class JdbmTableWithDuplicatesTest
         assertEquals( 0, table.count() );
 
         // add duplicates
-        for ( int i = 0; i < SIZE*2; i++ )
+        for ( int i = 0; i < SIZE * 2; i++ )
         {
             String istr = Integer.toString( i );
             table.put( "0", istr );
         }
 
-        assertEquals( SIZE*2, table.count() );
+        assertEquals( SIZE * 2, table.count() );
         table.remove( "0", "100" );
         assertFalse( table.has( "0", "100" ) );
-        assertEquals( SIZE*2, table.count() );
-        
+        assertEquals( SIZE * 2, table.count() );
+
         table.remove( "0" );
         assertNull( table.get( "0" ) );
     }
-    
-    
+
+
     @Test
     public void testLoadData() throws Exception
     {
@@ -437,26 +441,26 @@ public class JdbmTableWithDuplicatesTest
             String istr = Integer.toString( i );
             table.put( istr, istr );
         }
-        
+
         assertEquals( 15, table.count() );
         assertEquals( 1, table.count( "0" ) );
-        
+
         /*
          * If counts are exact then we can test for exact values.  Again this 
          * is not a critical function but one used for optimization so worst 
          * case guesses are allowed.
          */
-        
+
         assertEquals( SIZE, table.lessThanCount( "5" ) );
         assertEquals( SIZE, table.greaterThanCount( "5" ) );
     }
-    
+
 
     @Test
     public void testDuplicateLimit() throws Exception
     {
         assertFalse( table.isKeyUsingBTree( "1" ) );
-        
+
         for ( int i = 0; i < SIZE; i++ )
         {
             String istr = Integer.toString( i );
@@ -465,7 +469,7 @@ public class JdbmTableWithDuplicatesTest
         assertEquals( SIZE, table.count() );
         assertEquals( SIZE, table.count( "1" ) );
         assertFalse( table.isKeyUsingBTree( "1" ) );
-        
+
         // this switches to B+Trees from AvlTree
         table.put( "1", SIZE_STR );
         assertEquals( SIZE + 1, table.count() );
@@ -478,7 +482,7 @@ public class JdbmTableWithDuplicatesTest
         assertEquals( SIZE + 2, table.count( "1" ) );
         assertEquals( "0", table.get( "1" ) );
         assertTrue( table.isKeyUsingBTree( "1" ) );
-        
+
         // now start removing and see what happens 
         table.remove( "1", SIZE_PLUS_ONE_STR );
         assertFalse( table.has( "1", SIZE_PLUS_ONE_STR ) );
@@ -494,14 +498,14 @@ public class JdbmTableWithDuplicatesTest
         assertEquals( SIZE, table.count( "1" ) );
         assertEquals( "0", table.get( "1" ) );
         assertFalse( table.isKeyUsingBTree( "1" ) );
-    
+
         for ( int i = SIZE - 1; i >= 0; i-- )
         {
             String istr = Integer.toString( i );
             table.remove( "1", istr );
             assertFalse( table.isKeyUsingBTree( "1" ) );
         }
-        
+
         assertEquals( 0, table.count() );
 
         for ( int i = 0; i < SIZE - 1; i++ )
@@ -510,18 +514,18 @@ public class JdbmTableWithDuplicatesTest
             table.put( "1", istr );
             assertFalse( table.isKeyUsingBTree( "1" ) );
         }
-        
+
         // this switches back to using B+Trees from AvlTree
-        table.put( "1", SIZE_STR ) ;
+        table.put( "1", SIZE_STR );
         table.put( "1", SIZE_PLUS_ONE_STR );
         assertTrue( table.isKeyUsingBTree( "1" ) );
-        
+
         assertEquals( SIZE + 1, table.count() );
         table.remove( "1" );
         assertEquals( 0, table.count() );
     }
-    
-    
+
+
     /**
      * Let's test keys with a null or lack of any values.
      * @throws Exception on error
@@ -531,30 +535,30 @@ public class JdbmTableWithDuplicatesTest
     {
         testDuplicateLimit();
         assertEquals( 0, table.count() );
-        
+
         try
         {
             table.put( "1", null );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         try
         {
             table.put( null, "1" );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         assertEquals( 0, table.count() );
         assertEquals( null, table.get( "1" ) );
-        
+
         // Let's add the key with two valid values and remove all values
         table.remove( "1" );
         table.put( "1", "1" );
@@ -578,24 +582,25 @@ public class JdbmTableWithDuplicatesTest
         table.close();
 
         // test value btree creation without serializer
-        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        SerializableComparator<String> comparator = new SerializableComparator<String>(
+            SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
         comparator.setSchemaManager( schemaManager );
 
-        table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
-                comparator, comparator, new DefaultSerializer(), null );
+        table = new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+            comparator, comparator, new DefaultSerializer(), null );
         assertNull( table.getValueSerializer() );
-        
+
         for ( int i = 0; i < SIZE + 1; i++ )
         {
             String istr = Integer.toString( i );
             table.put( "0", istr );
         }
-        
+
         table.remove( "0" );
         assertFalse( table.has( "0" ) );
     }
 
-    
+
     /**
      * Let's test keys with a null or lack of any values.
      * @throws Exception on error
@@ -604,30 +609,30 @@ public class JdbmTableWithDuplicatesTest
     public void testNullOrEmptyKeyValue() throws Exception
     {
         assertEquals( 0, table.count() );
-        
+
         try
         {
             table.put( "1", null );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         try
         {
             table.put( null, "2" );
             fail( "should never get here due to IllegalArgumentException" );
         }
-        catch( IllegalArgumentException e )
+        catch ( IllegalArgumentException e )
         {
             assertNotNull( e );
         }
-        
+
         assertEquals( 0, table.count() );
         assertEquals( null, table.get( "1" ) );
-        
+
         // Let's add the key with two valid values and remove all values
         table.remove( "1" );
         table.put( "1", "1" );