directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r612357 - in /directory/sandbox/akarasulu/bigbang/apacheds: btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-store/src/...
Date Wed, 16 Jan 2008 05:31:35 GMT
Author: akarasulu
Date: Tue Jan 15 21:31:28 2008
New Revision: 612357

URL: http://svn.apache.org/viewvc?rev=612357&view=rev
Log:
cleaned up some more useless methods which can be handled by callers just as efficiently

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
Tue Jan 15 21:31:28 2008
@@ -193,21 +193,6 @@
 
 
     /**
-     * Puts a set of values into the Table for a specific key.  If the Table
-     * does not support duplicate keys then only the first value found in the
-     * Cursor is added.  If duplicate keys are not supported and there is more
-     * than one element in the Cursor an IllegalStateException will be raised
-     * without putting any values into this Table.
-     *
-     * @param key the key to use for the values
-     * @param values the values supplied as an cursor
-     * @return the replaced object or null if one did not exist
-     * @throws IOException if something goes wrong
-     */
-    V put( K key, Cursor<V> values ) throws IOException;
-
-
-    /**
      * Removes all records with a specified key from this Table.
      *
      * @param key the key of the records to remove
@@ -229,22 +214,6 @@
      * the underlying Db
      */
     V remove( K key, V value ) throws IOException;
-
-
-    /**
-     * Removes a set of values with the same key from this Table.  If this 
-     * table does not allow duplicates the method will attempt to remove the 
-     * first value in the Cursor if one exists.  If there is more than one
-     * value within the Cursor after the first an IllegalStateException is
-     * thrown.
-     *
-     * @param key the key of the records to remove
-     * @param values the values supplied as an enumeration
-     * @return the first value removed
-     * @throws IOException if there is a failure to read or write to
-     * the underlying Db
-     */
-    V remove( K key, Cursor<V> values ) throws IOException;
 
 
     /**

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Tue Jan 15 21:31:28 2008
@@ -599,7 +599,8 @@
         if ( values instanceof BTreeRedirect )
         {
             BTree tree = getBTree( ( BTreeRedirect ) values );
-            if ( insertDupIntoBTree( tree, value ) )
+            
+            if ( value != null insertDupIntoBTree( tree, value ) )
             {
                 count++;
             }
@@ -611,97 +612,6 @@
     
 
     /**
-     * @see Table#put(Object, Cursor
-     */
-    @SuppressWarnings("unchecked")
-    public V put( K key, Cursor<V> values ) throws IOException
-    {
-        /*
-         * If we do not allow duplicates call the single add put using the
-         * first value in the enumeration if it exists.  If it does not we
-         * just return null without doing anything.  If more than one value
-         * is in the enumeration than we blow a UnsupportedOperationException.
-         */
-        if ( !allowsDuplicates )
-        {
-            if ( values.next() )
-            {
-                V value = values.get();
-
-                if ( values.next() )
-                {
-                    throw new IllegalStateException( "Attempting to put duplicate keys into
table " + name
-                        + " which does not support duplicates" );
-                }
-
-                return put( key, value );
-            }
-
-            return null;
-        }
-
-        Object storedValues = getRaw( key );
-        if ( storedValues == null )
-        {
-            storedValues = new TreeSet<V>( comparator.getValueComparator() );
-        }
-        
-        if ( storedValues instanceof TreeSet )
-        {
-            /*
-             * Here the table allows duplicates so we get the TreeSet from the 
-             * Table holding all the duplicate key values or create one if it
-             * does not exist for key.  We check if the value is present and
-             * if it is we add it and increment the table entry counter.
-             */
-            TreeSet<V> set = ( TreeSet<V> ) storedValues;
-            while ( values.next() )
-            {
-                V val = values.get();
-    
-                if ( !set.contains( val ) )
-                {
-                    boolean isAddSuccessful = set.add( val );
-                    if ( isAddSuccessful )
-                    {
-                        count++;
-                    }
-                }
-            }
-    
-            if ( set.size() > numDupLimit )
-            {
-                BTree tree = convertToBTree( set );
-                BTreeRedirect redirect = new BTreeRedirect( tree.getRecid() );
-                return ( V ) bt.insert( key, redirect, true );
-            }
-            else
-            {
-                return ( V ) bt.insert( key, set, true );
-            }
-        }
-        
-        if ( storedValues instanceof BTreeRedirect )
-        {
-            BTree tree = getBTree( ( BTreeRedirect ) storedValues );
-            while ( values.next() )
-            {
-                V val = values.get();
-                
-                if ( insertDupIntoBTree( tree, val ) )
-                {
-                    count++;
-                }
-            }
-
-            return null;
-        }
-        
-        throw new IllegalStateException( "When using duplicate keys either a TreeSet or BTree
is used for values." );
-    }
-
-
-    /**
      * @see Table#remove(java.lang.Object,
      * java.lang.Object)
      */
@@ -735,15 +645,7 @@
             // If removal succeeds then remove if set is empty else replace it
             if ( set.remove( value ) )
             {
-                if ( set.isEmpty() )
-                {
-                }
-                else
-                {
-                    bt.insert( key, set, true );
-                }
-
-                // Decrement counter if removal occurs.
+                bt.insert( key, set, true );
                 count--;
                 return value;
             }
@@ -768,108 +670,6 @@
             }
             
             return null;
-        }
-        
-        throw new IllegalStateException( "When using duplicate keys either a TreeSet or BTree
is used for values." );
-    }
-
-
-    /**
-     * @see Table#remove(Object, Cursor
-     */
-    public V remove( K key, Cursor<V> values ) throws IOException
-    {
-        /*
-         * If we do not allow dupliicates call the single remove using the
-         * first value in the enumeration if it exists.  If it does not we
-         * just return null without doing anything.  If more than one value
-         * is in the enumeration than we blow a UnsupportedOperationException.
-         */
-        if ( !allowsDuplicates )
-        {
-            if ( values.next() )
-            {
-                V value = values.get();
-
-                if ( values.next() )
-                {
-                    throw new IllegalStateException( "Attempting to remove duplicate keys
from table " + name
-                        + " which does not support duplicates" );
-                }
-
-                return remove( key, value );
-            }
-
-            return null;
-        }
-
-        Object storedValues = getRaw( key );
-        
-        if ( storedValues == null )
-        {
-            return null;
-        }
-        
-        if ( storedValues instanceof TreeSet )
-        {
-            /*
-             * Here the table allows duplicates so we get the TreeSet from the 
-             * Table holding all the duplicate key values or return null if it
-             * does not exist for key - nothing to do here.
-             */
-            //noinspection unchecked
-            TreeSet<V> set = ( TreeSet<V> ) storedValues;
-    
-            /*
-             * So we have a valid TreeSet with values in it.  We check if each value
-             * is in the set and remove it if it is present.  We decrement the 
-             * counter while doing so.
-             */
-            V firstValue = null;
-            while ( values.next() )
-            {
-                V val = values.get();
-    
-                // get the first value
-                if ( firstValue == null )
-                {
-                    firstValue = val;
-                }
-
-                if ( set.contains( val ) )
-                {
-                    set.remove( val );
-                    count--;
-                }
-            }
-    
-            // Return the raw TreeSet and put the changed one back.
-            bt.insert( key, set, true );
-            return firstValue;
-        }
-        
-        // TODO might be nice to add code here that reverts to a TreeSet
-        // if the number of duplicates falls below the numDupLimit value
-        if ( storedValues instanceof BTreeRedirect )
-        {
-            BTree tree = getBTree( ( BTreeRedirect ) storedValues );
-            V first = null;
-            while ( values.next() )
-            {
-                V val = values.get();
-                
-                if ( removeDupFromBTree( tree, val ) )
-                {
-                    count--;
-                    
-                    if ( first == null )
-                    {
-                        first = val;
-                    }
-                }
-            }
-            
-            return first;
         }
         
         throw new IllegalStateException( "When using duplicate keys either a TreeSet or BTree
is used for values." );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursor.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursor.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursor.java
Tue Jan 15 21:31:28 2008
@@ -106,22 +106,15 @@
             {
                 // just continue
             }
-            else if ( nextCompared > 0 )
+            else 
             {
                 /*
                  * If we just have values greater than the element argument
-                 * then we are before the first element and cannot backup, and
-                 * the call below to getPrevious() will fail.  In this special
-                 * case we just reset the Cursor's browser and return.
+                 * then we are before the first element and must backup to
+                 * before the first element state for the JDBM browser which 
+                 * apparently the browser supports.
                  */
-                if ( browser.getPrevious( tuple ) )
-                {
-                }
-                else
-                {
-                    browser = btree.browse( element );
-                }
-
+                browser.getPrevious( tuple );
                 clearValue();
                 return;
             }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
Tue Jan 15 21:31:28 2008
@@ -72,7 +72,7 @@
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
         // gosh this is a terrible use of a global static variable
-        SerializableComparator.setRegistry( new TestComparatorRegistry() );
+        SerializableComparator.setRegistry( new MockComparatorRegistry() );
         table = new JdbmTable<String,String>( "test", recman, new SerializableComparator<String>(
"" ), null, null );
         LOG.debug( "Created new table and populated it with data" );
     }
@@ -183,7 +183,7 @@
     }
     
     
-    private class TestComparatorRegistry implements ComparatorRegistry
+    private class MockComparatorRegistry implements ComparatorRegistry
     {
         private StringComparator comparator = new StringComparator();
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
Tue Jan 15 21:31:28 2008
@@ -57,7 +57,8 @@
     private static final Logger LOG = LoggerFactory.getLogger( KeyCursorTest.class.getSimpleName()
);
     private static final String EMPTY_STRING = "";
     private static final String TEST_OUTPUT_PATH = "test.output.path";
-
+    private static final int DUP_LIMIT = 15; // point at which the JDBM table starts using
btrees
+    
     transient Table<String,String> table;
     transient File dbFile;
     transient RecordManager recman;
@@ -71,17 +72,17 @@
             tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
         }
 
-        dbFile = File.createTempFile( "test", "db", tmpDir );
+        dbFile = File.createTempFile( "JdbmTableWithDuplicatesTest", "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
         // gosh this is a terrible use of a global static variable
-        SerializableComparator.setRegistry( new TestComparatorRegistry() );
+        SerializableComparator.setRegistry( new MockComparatorRegistry() );
 
         TupleComparator<String,String> comparator = 
                 new DefaultTupleComparator<String,String>(
                         new SerializableComparator<String>( "" ),
                         new SerializableComparator<String>( "" ) );
-        table = new JdbmTable<String,String>( "test", true, 100, recman, comparator,
null, null );
+        table = new JdbmTable<String,String>( "test", true, DUP_LIMIT, recman, comparator,
null, null );
         LOG.debug( "Created new table and populated it with data" );
     }
 
@@ -98,38 +99,6 @@
     }
 
 
-    public void loadDataNoDupKeys() throws IOException
-    {
-        // add some data to it
-        table.put( "0", EMPTY_STRING );
-        table.put( "1", EMPTY_STRING );
-        table.put( "2", EMPTY_STRING );
-        table.put( "3", EMPTY_STRING );
-        table.put( "4", EMPTY_STRING );
-        table.put( "5", EMPTY_STRING );
-        table.put( "6", EMPTY_STRING );
-        table.put( "7", EMPTY_STRING );
-        table.put( "8", EMPTY_STRING );
-        table.put( "9", EMPTY_STRING );
-    }
-
-    
-    public void loadDataWithDupKeys() throws IOException
-    {
-        // add some data to it
-        table.put( "0", "0" );
-        table.put( "1", "0" );
-        table.put( "1", "1" );
-        table.put( "1", "2" );
-        table.put( "4", "4" );
-        table.put( "5", "5" );
-        table.put( "6", "6" );
-        table.put( "7", "7" );
-        table.put( "8", "8" );
-        table.put( "9", "9" );
-    }
-
-    
     @Test
     public void testCloseReopen() throws Exception
     {
@@ -139,8 +108,9 @@
             new DefaultTupleComparator<String,String>(
                     new SerializableComparator<String>( "" ),
                     new SerializableComparator<String>( "" ) );
-        table = new JdbmTable<String,String>( "test", true, 100, recman, comparator,
null, null );
-        assertEquals( "value", table.get( "key" ) );
+        table = new JdbmTable<String,String>( "test", true, DUP_LIMIT, recman, comparator,
null, null );
+        Object storedValue = table.get( "key" );
+        assertEquals( "value", storedValue );
     }
 
     
@@ -189,8 +159,154 @@
         assertFalse( table.has( "1", "0", false ) );
     }
 
+    
+    @Test
+    public void testLoadData() throws Exception
+    {
+        // add some data to it
+        table.put( "0", "zero" );
+        table.put( "1", "one" );
+        table.put( "2", "two" );
+        table.put( "3", "three" );
+        table.put( "4", "four" );
+        table.put( "5", "five" );
+        table.put( "6", "six" );
+        table.put( "7", "seven" );
+        table.put( "8", "eight" );
+        table.put( "9", "nine" );
+
+        assertEquals( 10, table.count() );
+        assertEquals( 1, table.count( "0" ) );
+        
+        /*
+         * If counts are exact then we can test for exact values.  Again this 
+         * is not a critical function but one used for optimization so worst 
+         * case guesses are allowed.
+         */
+        
+        if ( table.isCountExact() )
+        {
+            assertEquals( 5, table.lessThanCount( "5" ) );
+            assertEquals( 4, table.greaterThanCount( "5" ) );
+        }
+        else
+        {
+            assertEquals( 10, table.lessThanCount( "5" ) );
+            assertEquals( 10, table.greaterThanCount( "5" ) );
+        }
+    }
+    
 
-    private class TestComparatorRegistry implements ComparatorRegistry
+    @Test
+    public void testDuplicateLimit() throws Exception
+    {
+        for ( int ii = 0; ii < DUP_LIMIT-1; ii++ )
+        {
+            table.put( "key", String.valueOf( ii ) );
+        }
+        assertEquals( DUP_LIMIT-1, table.count() );
+        
+        table.put( "key", String.valueOf( DUP_LIMIT-1 ) );
+        assertEquals( DUP_LIMIT, table.count() );
+        
+        // this switches to B+Trees in JDBM implementations
+        table.put( "key", String.valueOf( DUP_LIMIT ) );
+        assertEquals( DUP_LIMIT+1, table.count() );
+        
+        table.put( "key", String.valueOf( DUP_LIMIT+1 ) );
+        assertEquals( DUP_LIMIT+2, table.count() );
+        
+        
+        // now start removing and see what happens 
+
+        table.remove( "key", String.valueOf( DUP_LIMIT+1 ) );
+        assertFalse( table.has( "key", String.valueOf( DUP_LIMIT+1 ) ) );
+        assertEquals( DUP_LIMIT+1, table.count() );
+    
+        table.remove( "key", String.valueOf( DUP_LIMIT ) );
+        assertFalse( table.has( "key", String.valueOf( DUP_LIMIT ) ) );
+        assertEquals( DUP_LIMIT, table.count() );
+    
+        for ( int ii = DUP_LIMIT-1; ii >= 0; ii-- )
+        {
+            table.remove( "key", String.valueOf( ii ) );
+        }
+        assertEquals( 0, table.count() );
+    }
+    
+    
+    /**
+     * Let's test keys with a null or lack of any values.
+     */
+    @Test
+    public void testNullOrEmptyValueAfterDuplicateLimit() throws Exception
+    {
+        testDuplicateLimit();
+        assertEquals( 0, table.count() );
+        table.put( "key", null );
+        assertEquals( 1, table.count() );
+        assertEquals( null, table.get( "key" ) );
+        
+        // Let's add the key with two valid values and remove all values
+        table.remove( "key" );
+        table.put( "key", "1" );
+        table.put( "key", "2" );
+        assertEquals( 2, table.count( "key" ) );
+        table.remove( "key", "1" );
+        assertEquals( 1, table.count( "key" ) );
+        assertEquals( "2", table.get( "key" ) );
+
+        
+        table.remove( "key", "2" );
+        String remainingValue = table.get( "key" );
+        assertNull( remainingValue );
+        assertEquals( 0, table.count( "key" ) );
+        assertTrue( table.has( "key" ) );
+        
+        table.remove( "key", "1" );
+        remainingValue = table.get( "key" );
+        assertNull( remainingValue );
+        assertEquals( 0, table.count( "key" ) );
+        assertTrue( table.has( "key" ) );
+    }
+    
+    
+    /**
+     * Let's test keys with a null or lack of any values.
+     */
+    @Test
+    public void testNullOrEmptyValue() throws Exception
+    {
+        assertEquals( 0, table.count() );
+        table.put( "key", null );
+        assertEquals( 1, table.count() );
+        assertEquals( null, table.get( "key" ) );
+        
+        // Let's add the key with two valid values and remove all values
+        table.remove( "key" );
+        table.put( "key", "1" );
+        table.put( "key", "2" );
+        assertEquals( 2, table.count( "key" ) );
+        table.remove( "key", "1" );
+        assertEquals( 1, table.count( "key" ) );
+        assertEquals( "2", table.get( "key" ) );
+
+        
+        table.remove( "key", "2" );
+        String remainingValue = table.get( "key" );
+        assertNull( remainingValue );
+        assertEquals( 0, table.count( "key" ) );
+        assertTrue( table.has( "key" ) );
+        
+        table.remove( "key", "1" );
+        remainingValue = table.get( "key" );
+        assertNull( remainingValue );
+        assertEquals( 0, table.count( "key" ) );
+        assertTrue( table.has( "key" ) );
+    }
+    
+    
+    private class MockComparatorRegistry implements ComparatorRegistry
     {
         private StringComparator comparator = new StringComparator();
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java?rev=612357&r1=612356&r2=612357&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
Tue Jan 15 21:31:28 2008
@@ -182,7 +182,7 @@
         assertFalse( cursor.previous() );
         assertTrue( cursor.next() );
         assertEquals( "0", cursor.get() );
-
+        
         bt.remove( "0" );
         bt.remove( "1" );
         bt.remove( "2" );
@@ -266,6 +266,27 @@
         assertEquals( "1", tuple.getKey() );
     }
 
+    
+    @Test
+    public void testMiscelleneous() throws IOException
+    {
+        // Test available()
+        
+        assertFalse( cursor.available() );
+        cursor.beforeFirst();
+        assertFalse( cursor.available() );
+        cursor.afterLast();
+        assertFalse( cursor.available() );
+        cursor.first();
+        assertTrue( cursor.available() );
+        cursor.last();
+        assertTrue( cursor.available() );
+        
+        // Test isElementReused()
+        
+        assertFalse( cursor.isElementReused() );
+    }
+    
 
     private void assertInvalidCursor()
     {



Mime
View raw message