You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by el...@apache.org on 2013/07/21 08:44:20 UTC
svn commit: r1505287 -
/labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java
Author: elecharny
Date: Sun Jul 21 06:44:20 2013
New Revision: 1505287
URL: http://svn.apache.org/r1505287
Log:
Added a test injecting 128 values with duplicates
Modified:
labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java
Modified: labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java?rev=1505287&r1=1505286&r2=1505287&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java (original)
+++ labs/mavibot/trunk/mavibot/src/test/java/org/apache/mavibot/btree/RecordManagerWithDuplicatesTest.java Sun Jul 21 06:44:20 2013
@@ -88,10 +88,7 @@ public class RecordManagerWithDuplicates
recordManager = new RecordManager( dataDir.getAbsolutePath() );
// load the last created btree
- if ( btree != null )
- {
- btree = recordManager.getManagedTree( btree.getName() );
- }
+ btree = recordManager.getManagedTree( "test" );
}
catch ( Exception e )
{
@@ -132,12 +129,62 @@ public class RecordManagerWithDuplicates
* Test the creation of a RecordManager with a BTree containing data.
*/
@Test
- public void testRecordManagerWithBTree() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException
+ public void testRecordManagerWithBTreeSameValue() throws IOException, BTreeAlreadyManagedException,
+ KeyNotFoundException
{
// Now, add some elements in the BTree
btree.insert( 3L, "V3" );
+ btree.insert( 3L, "V5" );
+
+ assertTrue( btree.contains( 3L, "V3" ) );
+ assertTrue( btree.contains( 3L, "V5" ) );
// Now, try to reload the file back
openRecordManagerAndBtree();
+ assertNotNull( btree );
+
+ assertTrue( btree.contains( 3L, "V3" ) );
+ assertTrue( btree.contains( 3L, "V5" ) );
+ }
+
+
+ /**
+ * Test the creation of a RecordManager with a BTree containing data.
+ */
+ @Test
+ public void testRecordManagerWithBTreeVariousValues() throws IOException, BTreeAlreadyManagedException,
+ KeyNotFoundException
+ {
+ // Now, add some elements in the BTree
+ for ( long i = 1; i < 128; i++ )
+ {
+ String v1 = "V" + i;
+ btree.insert( i, v1 );
+
+ String v2 = "V" + i + 1;
+ btree.insert( i, v2 );
+ }
+
+ for ( long i = 1; i < 128; i++ )
+ {
+ String v1 = "V" + i;
+ String v2 = "V" + i + 1;
+ assertTrue( btree.contains( i, v1 ) );
+ assertTrue( btree.contains( i, v2 ) );
+
+ }
+
+ // Now, try to reload the file back
+ openRecordManagerAndBtree();
+ assertNotNull( btree );
+
+ for ( long i = 1; i < 128; i++ )
+ {
+ String v1 = "V" + i;
+ String v2 = "V" + i + 1;
+ assertTrue( btree.contains( i, v1 ) );
+ assertTrue( btree.contains( i, v2 ) );
+
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org