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 2010/01/06 19:27:19 UTC

svn commit: r896599 [20/30] - in /directory/apacheds/trunk: ./ avl-partition/ avl-partition/src/ avl-partition/src/main/ avl-partition/src/main/java/ avl-partition/src/main/java/org/ avl-partition/src/main/java/org/apache/ avl-partition/src/main/java/o...

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java Wed Jan  6 18:26:43 2010
@@ -19,29 +19,35 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.directory.server.xdbm.Tuple;
-import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.schema.registries.ComparatorRegistry;
-import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
-import org.apache.directory.shared.ldap.schema.parsers.ComparatorDescription;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.File;
-import java.util.Comparator;
-import java.util.Iterator;
 
 import jdbm.RecordManager;
-import jdbm.helper.IntegerSerializer;
+import jdbm.helper.DefaultSerializer;
 import jdbm.recman.BaseRecordManager;
 
-import javax.naming.NamingException;
+import org.apache.directory.server.xdbm.Tuple;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -55,12 +61,40 @@
     private static final Logger LOG = LoggerFactory.getLogger( NoDupsCursorTest.class.getSimpleName() );
     private static final String TEST_OUTPUT_PATH = "test.output.path";
 
-    transient JdbmTable<Integer,Integer> table;
+    transient JdbmTable<String,String> table;
     transient File dbFile;
+    private static SchemaManager schemaManager;
     transient RecordManager recman;
     private static final int SIZE = 15;
 
 
+    @BeforeClass
+    public static void init() throws Exception
+    {
+        String workingDirectory = System.getProperty( "workingDirectory" );
+
+        if ( workingDirectory == null )
+        {
+            String path = DupsContainerCursorTest.class.getResource( "" ).getPath();
+            int targetPos = path.indexOf( "target" );
+            workingDirectory = path.substring( 0, targetPos + 6 );
+        }
+
+        File schemaRepository = new File( workingDirectory, "schema" );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+        extractor.extractOrCopy( true );
+        LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
+
+        boolean loaded = schemaManager.loadAllEnabled();
+
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
+    }
+
+    
     @Before
     public void createTable() throws Exception
     {
@@ -75,16 +109,12 @@
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         dbFile.deleteOnExit();
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
-
-        // gosh this is a terrible use of a global static variable
-        SerializableComparator.setRegistry( new MockComparatorRegistry() );
-
-        table = new JdbmTable<Integer,Integer>( "test", SIZE, recman,
-                new SerializableComparator<Integer>( "" ),
-                new SerializableComparator<Integer>( "" ),
-                null, new IntegerSerializer() );
+        
+        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() );
         LOG.debug( "Created new table and populated it with data" );
-
     }
 
 
@@ -109,11 +139,15 @@
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
         // gosh this is a terrible use of a global static variable
-        SerializableComparator.setRegistry( new MockComparatorRegistry() );
-        table = new JdbmTable<Integer,Integer>( "test", recman, new SerializableComparator<Integer>( "" ), null, null );
+        //SerializableComparator.setRegistry( 
+        //    new MockComparatorRegistry(
+        //        new OidRegistry() ) );
+        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 );
 
-        Cursor<Tuple<Integer,DupsContainer<Integer>>> cursor =
-            new DupsContainerCursor<Integer,Integer>( table );
+        Cursor<Tuple<String,DupsContainer<String>>> cursor =
+            new DupsContainerCursor<String,String>( table );
         assertNotNull( cursor );
     }
 
@@ -121,21 +155,21 @@
     @Test( expected=InvalidCursorPositionException.class )
     public void testEmptyTable() throws Exception
     {
-        Cursor<Tuple<Integer,DupsContainer<Integer>>> cursor =
-            new DupsContainerCursor<Integer,Integer>( table );
+        Cursor<Tuple<String,DupsContainer<String>>> cursor =
+            new DupsContainerCursor<String,String>( table );
         assertNotNull( cursor );
 
         assertFalse( cursor.available() );
         assertFalse( cursor.isClosed() );
         assertTrue( cursor.isElementReused() );
 
-        cursor = new DupsContainerCursor<Integer,Integer>( table );
+        cursor = new DupsContainerCursor<String,String>( table );
         assertFalse( cursor.previous() );
 
-        cursor = new DupsContainerCursor<Integer,Integer>( table );
+        cursor = new DupsContainerCursor<String,String>( table );
         assertFalse( cursor.next() );
 
-        cursor.after( new Tuple<Integer,DupsContainer<Integer>>( 7, null ) );
+        cursor.after( new Tuple<String,DupsContainer<String>>( "7", null ) );
         cursor.get();
     }
 
@@ -143,14 +177,14 @@
     @Test
     public void testOnTableWithSingleEntry() throws Exception
     {
-        table.put( 1, 1 );
-        Cursor<Tuple<Integer,DupsContainer<Integer>>> cursor =
-            new DupsContainerCursor<Integer,Integer>( table );
+        table.put( "1", "1" );
+        Cursor<Tuple<String,DupsContainer<String>>> cursor =
+            new DupsContainerCursor<String,String>( table );
         assertTrue( cursor.first() );
 
-        Tuple<Integer,DupsContainer<Integer>> tuple = cursor.get();
-        assertTrue( tuple.getKey().equals( 1 ) );
-        assertEquals( 1, ( int ) tuple.getValue().getArrayTree().getFirst() );
+        Tuple<String,DupsContainer<String>> tuple = cursor.get();
+        assertEquals( "1", tuple.getKey() );
+        assertEquals( "1", tuple.getValue().getArrayTree().getFirst() );
 
         cursor.beforeFirst();
         assertFalse( cursor.previous() );
@@ -163,24 +197,25 @@
     {
         for( int i=1; i < 10; i++ )
         {
-            table.put( i, i );
+            String istr = Integer.toString( i );
+            table.put( istr, istr );
         }
 
-        Cursor<Tuple<Integer,DupsContainer<Integer>>> cursor =
-            new DupsContainerCursor<Integer,Integer>( table );
+        Cursor<Tuple<String,DupsContainer<String>>> cursor =
+            new DupsContainerCursor<String,String>( table );
 
-        cursor.after( new Tuple<Integer,DupsContainer<Integer>>( 2, null ) );
+        cursor.after( new Tuple<String,DupsContainer<String>>( "2", null ) );
         assertTrue( cursor.next() );
 
-        Tuple<Integer,DupsContainer<Integer>> tuple = cursor.get();
-        assertTrue( tuple.getKey().equals( 3 ) );
-        assertEquals( 3, ( int ) tuple.getValue().getArrayTree().getFirst() );
+        Tuple<String,DupsContainer<String>> tuple = cursor.get();
+        assertEquals( "3", tuple.getKey() );
+        assertEquals( "3", tuple.getValue().getArrayTree().getFirst() );
 
-        cursor.before( new Tuple<Integer,DupsContainer<Integer>>( 7, null ) );
+        cursor.before( new Tuple<String,DupsContainer<String>>( "7", null ) );
         cursor.next();
         tuple = cursor.get();
-        assertTrue( tuple.getKey().equals( 7 ) );
-        assertEquals( 7, ( int ) tuple.getValue().getArrayTree().getFirst() );
+        assertEquals( "7", tuple.getKey() );
+        assertEquals( "7", tuple.getValue().getArrayTree().getFirst() );
 
         cursor.last();
         cursor.next();
@@ -192,8 +227,8 @@
         cursor.beforeFirst();
         cursor.next();
         tuple = cursor.get();
-        assertTrue( tuple.getKey().equals( 1 ) );
-        assertEquals( 1, ( int ) tuple.getValue().getArrayTree().getFirst() );
+        assertEquals( "1", tuple.getKey() );
+        assertEquals( "1", tuple.getValue().getArrayTree().getFirst() );
 
         cursor.afterLast();
         assertFalse( cursor.next() );
@@ -203,13 +238,13 @@
 
         // just to clear the jdbmTuple value so that line 127 inside after(tuple) method
         // can be executed as part of the below after(tuple) call
-        cursor.before(new Tuple<Integer,DupsContainer<Integer>>( 1, null ) );
-        cursor.after( new Tuple<Integer,DupsContainer<Integer>>( 0, null ) ); // this positions on tuple with key 1
+        cursor.before(new Tuple<String,DupsContainer<String>>( "1", null ) );
+        cursor.after( new Tuple<String,DupsContainer<String>>( "0", null ) ); // this positions on tuple with key 1
 
         cursor.next(); // this moves onto tuple with key 2
         tuple = cursor.get();
-        assertTrue( tuple.getKey().equals( 2 ) );
-        assertEquals( 2, ( int ) tuple.getValue().getArrayTree().getFirst() );
+        assertEquals( "2", tuple.getKey() );
+        assertEquals( "2", tuple.getValue().getArrayTree().getFirst() );
     }
 
 
@@ -217,65 +252,4 @@
     public void testMiscellaneous() throws Exception
     {
     }
-
-
-    private class MockComparatorRegistry implements ComparatorRegistry
-    {
-        private Comparator<Integer> comparator = new Comparator<Integer>()
-        {
-            public int compare( Integer i1, Integer i2 )
-            {
-                return i1.compareTo( i2 );
-            }
-        };
-
-        public String getSchemaName( String oid ) throws NamingException
-        {
-            return null;
-        }
-
-
-        public void register( ComparatorDescription description, Comparator comparator ) throws NamingException
-        {
-        }
-
-
-        public Comparator lookup( String oid ) throws NamingException
-        {
-            return comparator;
-        }
-
-
-        public boolean hasComparator( String oid )
-        {
-            return true;
-        }
-
-
-        public Iterator<String> iterator()
-        {
-            return null;
-        }
-
-
-        public Iterator<ComparatorDescription> comparatorDescriptionIterator()
-        {
-            return null;
-        }
-
-
-        public void unregister( String oid ) throws NamingException
-        {
-        }
-
-
-        public void unregisterSchemaElements( String schemaName )
-        {
-        }
-
-
-        public void renameSchema( String originalSchemaName, String newSchemaName )
-        {
-        }
-    }
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java Wed Jan  6 18:26:43 2010
@@ -19,24 +19,36 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import jdbm.RecordManager;
+import jdbm.helper.DefaultSerializer;
+import jdbm.recman.BaseRecordManager;
+
 import org.apache.directory.server.xdbm.Table;
 import org.apache.directory.server.xdbm.Tuple;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
-import org.junit.Before;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
 import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-
-import jdbm.RecordManager;
-import jdbm.helper.IntegerSerializer;
-import jdbm.recman.BaseRecordManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -52,15 +64,44 @@
     private static final String TEST_OUTPUT_PATH = "test.output.path";
     private static final int SIZE = 15;
 
-    transient Table<Integer,Integer> table;
+    transient Table<String,String> table;
     transient File dbFile;
     transient RecordManager recman;
+    private static SchemaManager schemaManager;
+
+
+    @BeforeClass
+    public static void init() throws Exception
+    {
+        String workingDirectory = System.getProperty( "workingDirectory" );
 
+        if ( workingDirectory == null )
+        {
+            String path = DupsContainerCursorTest.class.getResource( "" ).getPath();
+            int targetPos = path.indexOf( "target" );
+            workingDirectory = path.substring( 0, targetPos + 6 );
+        }
+
+        File schemaRepository = new File( workingDirectory, "schema" );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+        extractor.extractOrCopy( true );
+        LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
 
+        boolean loaded = schemaManager.loadAllEnabled();
+
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.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 ) );
@@ -69,13 +110,11 @@
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        // gosh this is a terrible use of a global static variable
-        SerializableComparator.setRegistry( new MockComparatorRegistry() );
+        SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+        comparator.setSchemaManager( schemaManager );
 
-        table = new JdbmTable<Integer,Integer>( "test", SIZE, recman,
-                new SerializableComparator<Integer>( "" ),
-                new SerializableComparator<Integer>( "" ),
-                null, new IntegerSerializer() );
+        table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
+                comparator, comparator, null, new DefaultSerializer() );
         LOG.debug( "Created new table and populated it with data" );
     }
 
@@ -101,7 +140,7 @@
     @Test
     public void testEmptyTableOperations() throws Exception
     {
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         assertFalse( cursor.next() );
         
         cursor.afterLast();
@@ -119,19 +158,22 @@
     public void testNextNoDups() throws Exception
     {
         // first try without duplicates at all
-        for ( int ii = 0; ii < SIZE-1; ii++ )
+        for ( int i = 0; i < SIZE-1; i++ )
         {
-            table.put( ii, ii );
+            String istr = Integer.toString( i );
+            table.put( istr, istr );
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
 
-        int ii = 0;
+        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
-            ii++;
+            Tuple<String,String> tuple = cursor.get();
+            assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+            assertEquals( i, Integer.parseInt( tuple.getValue() ) );
+            i++;
         }
     }
 
@@ -139,19 +181,22 @@
     @Test
     public void testPreviousNoDups() throws Exception
     {
-        for ( int ii = 0; ii < SIZE-1; ii++ )
+        for ( int i = 0; i < SIZE-1; i++ )
         {
-            table.put( ii, ii );
+            String istr = Integer.toString( i );
+            table.put( istr, istr );
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
 
-        int ii = SIZE-2;
+        Cursor<Tuple<String,String>> cursor = table.cursor();
+
+        int i = SIZE-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            assertEquals( ii, ( int ) tuple.getKey() );
-            assertEquals( ii, ( int ) tuple.getValue() );
-            ii--;
+            Tuple<String,String> tuple = cursor.get();
+            assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+            assertEquals( i, Integer.parseInt( tuple.getValue() ) );
+            i--;
         }
     }
 
@@ -159,34 +204,40 @@
     @Test
     public void testNextDups() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3; ii++ )
+        for ( int i = 0; i < SIZE*3; i++ )
         {
-            if ( ii > 12 && ii < 17 + SIZE )
+            String istr = Integer.toString( i );
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                table.put( 13, ii );
+                table.put( "13", istr );
             }
             else
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
 
-        int ii = 0;
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
     }
 
@@ -194,35 +245,42 @@
     @Test
     public void testPreviousDups() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3; ii++ )
+        for ( int i = 0; i < SIZE*3; i++ )
         {
-            if ( ii > 12 && ii < 17 + SIZE )
+            String istr = Integer.toString( i );
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                table.put( 13, ii );
+                table.put( "13", Integer.toString( i ) );
             }
             else
             {
-                table.put( ii, ii );
+                
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         cursor.afterLast();
 
-        int ii = SIZE*3 - 1;
+        int i = SIZE*3 - 1;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
     }
 
@@ -230,112 +288,129 @@
     @Test
     public void testFirstLastUnderDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*2 - 1; ii++ )
+        for ( int i = 0; i < SIZE*2 - 1; i++ )
         {
-            if ( ii > 12 && ii < 17 )
+            String istr = Integer.toString( i );
+
+            if ( i > 12 && i < 17 )
             {
-                table.put( 13, ii );
+                table.put( "13", istr );
             }
             else
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
 
-        int ii = 0;
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         cursor.first();
-        ii = 0;
+        i = 0;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        ii = SIZE*2-2;
+        i = SIZE*2-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        ii = SIZE*2-2;
+        i = SIZE*2-2;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
         while ( cursor.previous() );
 
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        ii = SIZE*2-2;
+        i = SIZE*2-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
     }
 
@@ -343,114 +418,131 @@
     @Test
     public void testFirstLastOverDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3-1; ii++ )
+        for ( int i = 0; i < SIZE*3-1; i++ )
         {
-            if ( ii < 2 + SIZE ) // keys with multiple values
+            String istr = Integer.toString( i );
+
+            if ( i < 2 + SIZE ) // keys with multiple values
             {
-                table.put( 0, ii );
+                table.put( "0", istr );
             }
             else // keys with single values
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
 
-        int ii = 0;
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // now go back to first and traverse all over again
         cursor.first();
-        ii = 0;
+        i = 0;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
+            Tuple<String,String> tuple = cursor.get();
 
-            if ( ii < 2 + SIZE )
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
         while ( cursor.previous() );
 
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
     }
 
@@ -458,231 +550,260 @@
     @Test
     public void testFirstOverDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3-1; ii++ )
+        for ( int i = 0; i < SIZE*3-1; i++ )
         {
-            if ( ii < 2 + SIZE ) // keys with multiple values
+            String istr = Integer.toString( i );
+
+            if ( i < 2 + SIZE ) // keys with multiple values
             {
-                table.put( 0, ii );
+                table.put( "0", istr );
             }
             else // keys with single values
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
 
-        int ii = 0;
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // now go back to first and traverse all over again
         cursor.first();
-        ii = 0;
+        i = 0;
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
+            Tuple<String,String> tuple = cursor.get();
 
-            if ( ii < 2 + SIZE )
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
         while ( cursor.previous() );
 
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii < 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i < 2 + SIZE )
             {
-                assertEquals( 0, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 0, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
     }
 
 
-
-
     @Test
     public void testLastOverDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3-1; ii++ )
+        for ( int i = 0; i < SIZE*3-1; i++ )
         {
-            if ( ii > 2 + SIZE ) // keys with multiple values
+            String istr = Integer.toString( i );
+
+            if ( i > 2 + SIZE ) // keys with multiple values
             {
-                table.put( 3 + SIZE, ii );
+                table.put( Integer.toString( 3 + SIZE ), istr );
             }
             else // keys with single values
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
 
-        int ii = 0;
+        int i = 0;
+        
         while ( cursor.next() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 2 + SIZE )
             {
-                assertEquals( 3 + SIZE, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // now go back to first and traverse all over again
         cursor.first();
-        ii = 0;
+        i = 0;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 2 + SIZE )
             {
-                assertEquals( 3 + SIZE, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
         while ( cursor.next() );
 
         // now go backwards
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
+            Tuple<String,String> tuple = cursor.get();
 
-            if ( ii > 2 + SIZE )
+            if ( i > 2 + SIZE )
             {
-                assertEquals( 3 + SIZE, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
 
         // now advance to last and go backwards again
         cursor.last();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         do
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 2 + SIZE )
             {
-                assertEquals( 3 + SIZE, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
         while ( cursor.previous() );
 
         // advance to first then last and go backwards again
         cursor.beforeFirst();
         cursor.afterLast();
-        ii = SIZE*3-2;
+        i = SIZE*3-2;
+        
         while ( cursor.previous() )
         {
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 2 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 2 + SIZE )
             {
-                assertEquals( 3 + SIZE, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 3 + SIZE, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii--;
+            
+            i--;
         }
     }
 
@@ -690,11 +811,11 @@
     @Test
     public void testOnEmptyTable() throws Exception
     {
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
         
-        cursor.before( new Tuple<Integer, Integer>( 1, 2 ) );
+        cursor.before( new Tuple<String, String>( "1", "2" ) );
         assertFalse( cursor.available() );
     }
 
@@ -702,20 +823,22 @@
     @Test
     public void testOverDupLimit() throws Exception
     {
-        table.put( 5, 5 );
-        table.put( 6, 6 );
-        for ( int ii = 0; ii < 20; ii++ )
+        table.put( "5", "5" );
+        table.put( "6", "6" );
+        
+        for ( int i = 0; i < 20; i++ )
         {
-            table.put( 7, ii );
+            table.put( "7", Integer.toString( i ) );
         }
-        table.put( 8, 8 );
-        table.put( 9, 9 );
         
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        table.put( "8", "8" );
+        table.put( "9", "9" );
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
         
-        cursor.before( new Tuple<Integer, Integer>( 7, 2 ) );
+        cursor.before( new Tuple<String, String>( "7", "2" ) );
         assertFalse( cursor.available() );
     }
 
@@ -723,20 +846,22 @@
     @Test
     public void testUnderDupLimit() throws Exception
     {
-        table.put( 5, 5 );
-        table.put( 6, 6 );
-        for ( int ii = 0; ii < 10; ii++ )
+        table.put( "5", "5" );
+        table.put( "6", "6" );
+        
+        for ( int i = 0; i < 10; i++ )
         {
-            table.put( 7, ii );
+            table.put( "7", Integer.toString( i ) );
         }
-        table.put( 8, 8 );
-        table.put( 9, 9 );
         
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        table.put( "8", "8" );
+        table.put( "9", "9" );
+        
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertFalse( cursor.isClosed() );
         
-        cursor.before( new Tuple<Integer, Integer>( 7, 2 ) );
+        cursor.before( new Tuple<String, String>( "7", "2" ) );
         assertFalse( cursor.available() );
     }
 
@@ -744,261 +869,279 @@
     @Test
     public void testBeforeAfterBelowDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*2 - 1; ii++ )
+        for ( int i = 0; i < SIZE*2 - 1; i++ )
         {
-            if ( ii > 12 && ii < 17 ) // keys with multiple values
+            String istr = Integer.toString( i );
+
+            if ( i > 12 && i < 17 ) // keys with multiple values
             {
-                table.put( 13, ii );
+                table.put( "13", Integer.toString( i ) );
             }
-            else if ( ii > 17 && ii < 21 ) // adds hole with no keys for ii
+            else if ( i > 17 && i < 21 ) // adds hole with no keys for i
             {
             }
             else // keys with single values
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
 
         // test before to advance just before a key with a single value
-        int ii = 5;
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 5, 5 ) );
+        int i = 5;
+        Cursor<Tuple<String,String>> cursor = table.cursor();
+        cursor.before( new Tuple<String,String>( "5", "5" ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test before to advance just before a key with a single value but
         // with a null tuple value which should not advance the dupsCursor
-        ii = 5;
+        i = 5;
         cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 5, null ) );
+        cursor.before( new Tuple<String,String>( "5", null ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            i++;
         }
 
         // test before to advance just before a key value pair where the key
         // does not exist - using value so we hit check for key equality
-        ii = 21;
+        i = 21;
         cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 18, 18 ) );
+        cursor.before( new Tuple<String,String>( "18", "18" ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test after to advance just after the end
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 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
-        ii = 6;
+        i = 6;
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 5, null ) );
+        cursor.after( new Tuple<String,String>( "5", null ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            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<Integer,Integer>( 13, 14 ) );
+        cursor.before( new Tuple<String,String>( "13", "14" ) );
 
         cursor.next();
-        Tuple<Integer,Integer> tuple = cursor.get();
-        assertEquals( 13, ( int ) tuple.getKey() );
-        assertEquals( 14, ( int ) tuple.getValue() );
-        ii = 15;
+        Tuple<String,String> tuple = cursor.get();
+        assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 14, Integer.parseInt( tuple.getValue() ) );
+        i = 15;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            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<Integer,Integer>( 13, 14 ) );
+        cursor.after( new Tuple<String,String>( "13", "14" ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 13, ( int ) tuple.getKey() );
-        assertEquals( 15, ( int ) tuple.getValue() );
-        ii=16;
+        assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 15, Integer.parseInt( tuple.getValue() ) );
+        i=16;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test after to advance just before a key that does not exist
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 18, null ) );
+        cursor.after( new Tuple<String,String>( "18", null ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 21, ( int ) tuple.getKey() );
-        assertEquals( 21, ( int ) tuple.getValue() );
-        ii=22;
+        assertEquals( 21, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 21, Integer.parseInt( tuple.getValue() ) );
+        i=22;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            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<Integer,Integer>( 18, 18 ) );
+        cursor.after( new Tuple<String,String>( "18", "18" ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 21, ( int ) tuple.getKey() );
-        assertEquals( 21, ( int ) tuple.getValue() );
-        ii=22;
+        assertEquals( 21, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 21, Integer.parseInt( tuple.getValue() ) );
+        i=22;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 && ii < 21 )
+            if ( i > 17 && i < 21 )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 )
+            
+            if ( i > 12 && i < 17 )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
     }
 
@@ -1006,261 +1149,282 @@
     @Test
     public void testBeforeAfterOverDupLimit() throws Exception
     {
-        for ( int ii = 0; ii < SIZE*3 - 1; ii++ )
+        for ( int i = 0; i < SIZE*3 - 1; i++ )
         {
-            if ( ii > 12 && ii < 17 + SIZE ) // keys with multiple values
+            String istr = Integer.toString( i );
+
+            if ( i > 12 && i < 17 + SIZE ) // keys with multiple values
             {
-                table.put( 13, ii );
+                table.put( "13", Integer.toString( i ) );
             }
-            else if ( ii > 17 + SIZE  && ii < 21 + SIZE ) // adds hole with no keys for ii
+            else if ( i > 17 + SIZE  && i < 21 + SIZE ) // adds hole with no keys for i
             {
             }
             else // keys with single values
             {
-                table.put( ii, ii );
+                table.put( istr, istr );
             }
         }
 
         // test before to advance just before a key with a single value
-        int ii = 5;
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 5, 5 ) );
+        int i = 5;
+        Cursor<Tuple<String,String>> cursor = table.cursor();
+        cursor.before( new Tuple<String,String>( "5", "5" ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test before to advance just before a key with a single value but
         // with a null tuple value which should not advance the dupsCursor
-        ii = 5;
+        i = 5;
         cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 5, null ) );
+        cursor.before( new Tuple<String,String>( "5", null ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            i++;
         }
 
         // test before to advance just before a key value pair where the key
         // does not exist - using value so we hit check for key equality
-        ii = 21 + SIZE;
+        i = 21 + SIZE;
         cursor = table.cursor();
-        cursor.before( new Tuple<Integer,Integer>( 18 + SIZE, 18 + SIZE ) );
+        String istr = Integer.toString( 18 + SIZE );
+        
+        cursor.before( new Tuple<String,String>( istr, istr ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test after to advance just after the end
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 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
-        ii = 6;
+        i = 6;
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 5, null ) );
+        cursor.after( new Tuple<String,String>( "5", null ) );
+        
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
-            Tuple<Integer,Integer> tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            Tuple<String,String> tuple = cursor.get();
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            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<Integer,Integer>( 13, 14 ) );
+        cursor.before( new Tuple<String,String>( "13", "14" ) );
 
         cursor.next();
-        Tuple<Integer,Integer> tuple = cursor.get();
-        assertEquals( 13, ( int ) tuple.getKey() );
-        assertEquals( 14, ( int ) tuple.getValue() );
-        ii = 15;
+        Tuple<String,String> tuple = cursor.get();
+        assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 14, Integer.parseInt( tuple.getValue() ) );
+        i = 15;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            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<Integer,Integer>( 13, 14 ) );
+        cursor.after( new Tuple<String,String>( "13", "14" ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 13, ( int ) tuple.getKey() );
-        assertEquals( 15, ( int ) tuple.getValue() );
-        ii=16;
+        assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 15, Integer.parseInt( tuple.getValue() ) );
+        i=16;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString(  i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
 
         // test after to advance just before a key that does not exist
         cursor = table.cursor();
-        cursor.after( new Tuple<Integer,Integer>( 18 + SIZE, null ) );
+        cursor.after( new Tuple<String,String>( Integer.toString( 18 + SIZE ), null ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 21 + SIZE, ( int ) tuple.getKey() );
-        assertEquals( 21 + SIZE, ( int ) tuple.getValue() );
-        ii=22 + SIZE;
+        assertEquals( 21 + SIZE, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 21 + SIZE, Integer.parseInt( tuple.getValue() ) );
+        i=22 + SIZE;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            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<Integer,Integer>( 18 + SIZE , 18 + SIZE ) );
+        cursor.after( new Tuple<String,String>( istr, istr ) );
 
         cursor.next();
         tuple = cursor.get();
-        assertEquals( 21 + SIZE, ( int ) tuple.getKey() );
-        assertEquals( 21 + SIZE, ( int ) tuple.getValue() );
-        ii=22+ SIZE;
+        assertEquals( 21 + SIZE, Integer.parseInt( tuple.getKey() ) );
+        assertEquals( 21 + SIZE, Integer.parseInt( tuple.getValue() ) );
+        i=22+ SIZE;
 
         while ( cursor.next() )
         {
-            if ( ii > 17 + SIZE && ii < 21 + SIZE )
+            if ( i > 17 + SIZE && i < 21 + SIZE )
             {
-                assertFalse( table.has( ii ) );
+                assertFalse( table.has( Integer.toString( i ) ) );
                 continue;
             }
 
             tuple = cursor.get();
-            if ( ii > 12 && ii < 17 + SIZE )
+            
+            if ( i > 12 && i < 17 + SIZE )
             {
-                assertEquals( 13, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( 13, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
             else
             {
-                assertEquals( ii, ( int ) tuple.getKey() );
-                assertEquals( ii, ( int ) tuple.getValue() );
+                assertEquals( i, Integer.parseInt( tuple.getKey() ) );
+                assertEquals( i, Integer.parseInt( tuple.getValue() ) );
             }
-            ii++;
+            
+            i++;
         }
     }
 
@@ -1268,7 +1432,7 @@
     @Test
     public void testMiscellaneous() throws Exception
     {
-        Cursor<Tuple<Integer,Integer>> cursor = table.cursor();
+        Cursor<Tuple<String,String>> cursor = table.cursor();
         assertNotNull( cursor );
         assertTrue( cursor.isElementReused() );
 

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java Wed Jan  6 18:26:43 2010
@@ -68,6 +68,7 @@
         };
 
         File tmpDir = null;
+        
         if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
         {
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );

Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Wed Jan  6 18:26:43 2010
@@ -20,29 +20,32 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.After;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.commons.io.FileUtils;
-import org.apache.directory.server.schema.bootstrap.*;
-import org.apache.directory.server.schema.registries.*;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.io.File;
-import java.io.IOException;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 
 /**
@@ -53,27 +56,41 @@
  */
 public class JdbmIndexTest
 {
-    AttributeTypeRegistry registry;
-    File dbFileDir;
+    private static File dbFileDir;
     Index<String,ServerEntry> idx;
+    private static SchemaManager schemaManager;
+
+
+    @BeforeClass
+    public static void init() throws Exception
+    {
+    	String workingDirectory = System.getProperty( "workingDirectory" );
+
+        if ( workingDirectory == null )
+        {
+            String path = JdbmIndexTest.class.getResource( "" ).getPath();
+            int targetPos = path.indexOf( "target" );
+            workingDirectory = path.substring( 0, targetPos + 6 );
+        }
 
+        File schemaRepository = new File( workingDirectory, "schema" );
+        SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+        extractor.extractOrCopy( true );
+        LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+        schemaManager = new DefaultSchemaManager( loader );
 
+        boolean loaded = schemaManager.loadAllEnabled();
+
+        if ( !loaded )
+        {
+            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
+        }
+    }
+    
+    
     @Before
-    public void setup() throws Exception
+    public void setup() throws IOException
     {
-        BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        OidRegistry oidRegistry = new DefaultOidRegistry();
-        Registries registries = new DefaultRegistries( "bootstrap", loader, oidRegistry );
-        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
-        // load essential bootstrap schemas
-        Set<Schema> bootstrapSchemas = new HashSet<Schema>();
-        bootstrapSchemas.add( new ApachemetaSchema() );
-        bootstrapSchemas.add( new ApacheSchema() );
-        bootstrapSchemas.add( new CoreSchema() );
-        bootstrapSchemas.add( new SystemSchema() );
-        loader.loadWithDependencies( bootstrapSchemas, registries );
-        this.registry = registries.getAttributeTypeRegistry();
 
         File tmpIndexFile = File.createTempFile( JdbmIndexTest.class.getSimpleName(), "db" );
         tmpIndexFile.deleteOnExit();
@@ -87,7 +104,6 @@
     @After
     public void teardown() throws Exception
     {
-        registry = null;
         destroyIndex();
         
         if ( ( dbFileDir != null ) && dbFileDir.exists() )
@@ -130,7 +146,7 @@
             jdbmIdx = new JdbmIndex<String,ServerEntry>();
         }
 
-        jdbmIdx.init( registry.lookup( SchemaConstants.OU_AT ), dbFileDir );
+        jdbmIdx.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OU_AT ), dbFileDir );
         this.idx = jdbmIdx;
     }
 
@@ -153,6 +169,7 @@
 
         // initialized index
         initIndex();
+        
         try
         {
             idx.setAttributeId( "foo" );
@@ -251,7 +268,7 @@
         assertNull( jdbmIndex.getAttribute() );
 
         initIndex();
-        assertEquals( registry.lookup( "ou" ), idx.getAttribute() );
+        assertEquals( schemaManager.lookupAttributeTypeRegistry( "ou" ), idx.getAttribute() );
     }
 
 
@@ -550,7 +567,9 @@
 
         try
         {
-            jdbmIndex.init( new NoEqMatchAttribute(), dbFileDir );
+            AttributeType noEqMatchAttribute = new AttributeType( "1.1" );
+            
+            jdbmIndex.init( schemaManager, noEqMatchAttribute, dbFileDir );
             fail( "should not get here" );
         }
         catch( IOException e )
@@ -568,7 +587,7 @@
     public void testSingleValuedAttribute() throws Exception
     {
         JdbmIndex jdbmIndex = new JdbmIndex();
-        jdbmIndex.init( registry.lookup( SchemaConstants.CREATORS_NAME_AT ), dbFileDir );
+        jdbmIndex.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATORS_NAME_AT ), dbFileDir );
         jdbmIndex.close();
     }
 }