directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1550050 - in /directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree: managed/ memory/
Date Wed, 11 Dec 2013 04:42:57 GMT
Author: elecharny
Date: Wed Dec 11 04:42:56 2013
New Revision: 1550050

URL: http://svn.apache.org/r1550050
Log:
o Fixed some warnings
o @Ignore a debug test

Modified:
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ManagedBTreeBuilderTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ReadTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/RecordManagerTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeDuplicateKeyTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeFlushTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeTest.java

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ManagedBTreeBuilderTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ManagedBTreeBuilderTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ManagedBTreeBuilderTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ManagedBTreeBuilderTest.java
Wed Dec 11 04:42:56 2013
@@ -24,7 +24,6 @@ package org.apache.directory.mavibot.btr
 import static org.junit.Assert.assertEquals;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ReadTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ReadTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ReadTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/ReadTest.java
Wed Dec 11 04:42:56 2013
@@ -265,7 +265,6 @@ public class ReadTest
         ByteBuffer readBytes = ( ByteBuffer ) readBytesMethod.invoke( recordManager, pageIos,
0L );
 
         // The byte length
-        int pos = 0;
         assertNotNull( readBytes );
         assertEquals( 4, readBytes.limit() );
         // The data
@@ -281,7 +280,6 @@ public class ReadTest
         readBytes = ( ByteBuffer ) readBytesMethod.invoke( recordManager, pageIos, 12L );
 
         // The byte length
-        pos = 0;
         assertNotNull( readBytes );
         assertEquals( 4, readBytes.limit() );
         // The data
@@ -304,7 +302,6 @@ public class ReadTest
         readBytes = ( ByteBuffer ) readBytesMethod.invoke( recordManager, pageIos, 0L );
 
         // The byte length
-        pos = 0;
         assertNotNull( readBytes );
         assertEquals( 16, readBytes.limit() );
 
@@ -321,7 +318,6 @@ public class ReadTest
         readBytes = ( ByteBuffer ) readBytesMethod.invoke( recordManager, pageIos, 15L );
 
         // The byte length
-        pos = 0;
         assertNotNull( readBytes );
         assertEquals( 16, readBytes.limit() );
         // The data
@@ -344,9 +340,9 @@ public class ReadTest
         readBytes = ( ByteBuffer ) readBytesMethod.invoke( recordManager, pageIos, 2L );
 
         // The byte length
-        pos = 0;
         assertNotNull( readBytes );
         assertEquals( 80, readBytes.limit() );
+        
         // The data
         for ( int i = 0; i < 80; i++ )
         {

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/RecordManagerTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/RecordManagerTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/RecordManagerTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/managed/RecordManagerTest.java
Wed Dec 11 04:42:56 2013
@@ -224,7 +224,7 @@ public class RecordManagerTest
      * Test the creation of a RecordManager with a BTree containing 100 000 elements
      */
     @Test
-    //@Ignore("This is a performance test")
+    @Ignore("This is a performance test")
     public void testRecordManagerWithBTreeLeafNode100K() throws IOException, BTreeAlreadyManagedException,
         KeyNotFoundException
     {

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeDuplicateKeyTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeDuplicateKeyTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeDuplicateKeyTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeDuplicateKeyTest.java
Wed Dec 11 04:42:56 2013
@@ -289,6 +289,7 @@ public class BTreeDuplicateKeyTest
 
         assertEquals( ( 'a' - 1 ), ch );
         cursor.close();
+        btree.close();
     }
 
 
@@ -376,6 +377,7 @@ public class BTreeDuplicateKeyTest
         }
         
         assertEquals( 25, i );
+        btree.close();
     }
 
 
@@ -412,8 +414,10 @@ public class BTreeDuplicateKeyTest
 
         cursor.afterLast();
         assertFalse( cursor.hasNext() );
+        
         // make sure it throws NoSuchElementException
         cursor.next();
+        btree.close();
     }
 
 
@@ -513,6 +517,7 @@ public class BTreeDuplicateKeyTest
         assertFalse( cursor.hasPrev() );
         // make sure it throws NoSuchElementException
         cursor.prev();
+        btree.close();
     }
 
 
@@ -565,12 +570,11 @@ public class BTreeDuplicateKeyTest
         assertEquals( Integer.valueOf( 3 ), tuple.getKey() );
         assertEquals( Integer.valueOf( 3 ), tuple.getValue() );
 
-        // the below assertion won't work cause of the index position
-        // issue when prev() and next() are called subsequently (in any order) 
-        //        assertTrue( cursor.hasNext() );
-        //        tuple = cursor.next();
-        //        assertEquals( Integer.valueOf( 4 ), tuple.getKey() );
-        //        assertEquals( Integer.valueOf( 4 ), tuple.getValue() );
+        assertTrue( cursor.hasNext() );
+        tuple = cursor.next();
+        assertEquals( Integer.valueOf( 4 ), tuple.getKey() );
+        assertEquals( Integer.valueOf( 4 ), tuple.getValue() );
+
         cursor.close();
 
         // test the extremes of the BTree instead of that of leaves
@@ -593,6 +597,7 @@ public class BTreeDuplicateKeyTest
         assertEquals( Integer.valueOf( 0 ), tuple.getKey() );
         assertEquals( Integer.valueOf( 0 ), tuple.getValue() );
         cursor.close();
+        btree.close();
     }
 
 
@@ -633,6 +638,7 @@ public class BTreeDuplicateKeyTest
         assertEquals( Integer.valueOf( 4 ), tuple.getValue() );
         cursor.close();
 
+        btree.close();
     }
 
 
@@ -671,6 +677,7 @@ public class BTreeDuplicateKeyTest
         }
 
         cursor.close();
+        btree.close();
     }
 
 
@@ -710,5 +717,6 @@ public class BTreeDuplicateKeyTest
         }
 
         cursor.close();
+        btree.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeFlushTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeFlushTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeFlushTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/BTreeFlushTest.java
Wed Dec 11 04:42:56 2013
@@ -148,6 +148,7 @@ public class BTreeFlushTest
                 System.out.println( btree );
                 System.out.println( "Error while adding " + value );
                 nbError++;
+                btree.close();
 
                 return null;
             }
@@ -293,5 +294,6 @@ public class BTreeFlushTest
             new LongSerializer(),
             new StringSerializer() );
         btree.setPageSize( 32 );
+        btree.close();
     }
 }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeTest.java?rev=1550050&r1=1550049&r2=1550050&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeTest.java
Wed Dec 11 04:42:56 2013
@@ -193,6 +193,8 @@ public class InMemoryBTreeTest
                     System.out.println( btree );
                     System.out.println( "Error while adding " + value );
                     nbError++;
+                    btree.close();
+
                     return;
                 }
             }
@@ -293,6 +295,8 @@ public class InMemoryBTreeTest
                     System.out.println( btree );
                     System.out.println( "Error while adding " + value );
                     nbError++;
+                    btree.close();
+
                     return;
                 }
             }
@@ -400,6 +404,8 @@ public class InMemoryBTreeTest
                 e.printStackTrace();
                 System.out.println( btree );
                 System.out.println( "Error while adding " + value );
+                btree.close();
+
                 return;
             }
         }
@@ -460,6 +466,8 @@ public class InMemoryBTreeTest
                 e.printStackTrace();
                 System.out.println( btree );
                 System.out.println( "Error while adding " + value );
+                btree.close();
+
                 return;
             }
         }
@@ -479,6 +487,8 @@ public class InMemoryBTreeTest
                 e.printStackTrace();
                 System.out.println( btree );
                 System.out.println( "Error while deleting " + key );
+                btree.close();
+
                 return;
             }
 
@@ -494,7 +504,7 @@ public class InMemoryBTreeTest
      * We don't run it except to check a special condition
      */
     @Test
-    @Ignore
+    @Ignore("This is a debug test")
     public void testPageInsertDebug() throws Exception
     {
         BTree<Long, String> btree = new BTree<Long, String>( "test", new LongSerializer(),
new StringSerializer() );
@@ -1025,6 +1035,7 @@ public class InMemoryBTreeTest
 
         TupleCursor<Integer, String> cursor = btree.browseFrom( 11 );
         assertFalse( cursor.hasNext() );
+        btree.close();
     }
 
 
@@ -1757,6 +1768,8 @@ public class InMemoryBTreeTest
                 System.out.println( btree );
                 System.out.println( "Error while adding " + value );
                 nbError++;
+                btree.close();
+
                 return;
             }
 
@@ -1926,6 +1939,7 @@ public class InMemoryBTreeTest
         assertEquals( Integer.valueOf( 4 ), tuple.getKey() );
         assertEquals( Integer.valueOf( 4 ), tuple.getValue() );
         cursor.close();
+        btree.close();
     }
 
     



Mime
View raw message