directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1659194 - /directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
Date Thu, 12 Feb 2015 10:07:15 GMT
Author: elecharny
Date: Thu Feb 12 10:07:15 2015
New Revision: 1659194

URL: http://svn.apache.org/r1659194
Log:
Fixed the test which was failing

Modified:
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java

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=1659194&r1=1659193&r2=1659194&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
Thu Feb 12 10:07:15 2015
@@ -1184,15 +1184,6 @@ public class PersistedBTreeBrowseTest
             values.add( i );
         }
 
-        long sum = 0L;
-
-        for ( int i = 0; i < 500; i++ )
-        {
-            sum += values.get( i );
-        }
-
-        assertEquals( ( 500 * 499 ) / 2, sum );
-
         for ( int i = 0; i < 500; i++ )
         {
             int index = r.nextInt( 500 - i );
@@ -1200,7 +1191,7 @@ public class PersistedBTreeBrowseTest
             values.remove( index );
         }
 
-        sum = 0L;
+        long sum = 0L;
 
         for ( int i = 0; i < 500; i++ )
         {
@@ -1218,43 +1209,23 @@ public class PersistedBTreeBrowseTest
         // Now, browse the BTree starting from 0 to the end
         for ( long i = 0L; i < 500L; i++ )
         {
-            System.out.println( "Browsing from " + i );
+            //System.out.println( "Browsing from " + i );
             // Create the cursor
             TupleCursor<Long, String> cursor = btree.browseFrom( i );
 
             assertTrue( cursor.hasNext() );
             Long expected = i;
-            boolean error = false;
+            Long key = 0L;
 
             while ( cursor.hasNext() )
             {
                 Tuple<Long, String> tuple = cursor.next();
+                key = tuple.getKey();
 
-                if ( expected != tuple.getKey() )
-                {
-                    System.out.println( "Error on " + expected );
-                    error = true;
-                    break;
-                }
-                assertEquals( expected, tuple.getKey() );
+                assertEquals( expected, key );
                 expected++;
             }
 
-            expected = i;
-
-            if ( error )
-            {
-                cursor.close();
-                cursor = btree.browseFrom( i );
-
-                while ( cursor.hasNext() )
-                {
-                    Tuple<Long, String> tuple = cursor.next();
-                    assertEquals( expected, tuple.getKey() );
-                    expected++;
-                }
-            }
-
             cursor.close();
         }
     }



Mime
View raw message