directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r637708 [2/2] - in /directory/sandbox/akarasulu/bigbang: apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ apacheds/core-integ/src/test/java/org/apache/directory/server/core/jndi/ apacheds/core-integ/s...
Date Mon, 17 Mar 2008 03:20:46 GMT
Added: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexCursor.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/IndexCursor.java?rev=637708&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexCursor.java
(added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexCursor.java
Sun Mar 16 20:20:42 2008
@@ -0,0 +1,157 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.core.partition.impl.btree.jdbm;
+
+
+import org.apache.directory.server.core.partition.impl.btree.IndexEntry;
+import org.apache.directory.server.core.partition.impl.btree.Tuple;
+import org.apache.directory.server.core.partition.impl.btree.ForwardIndexEntry;
+import org.apache.directory.server.core.partition.impl.btree.ReverseIndexEntry;
+import org.apache.directory.server.core.cursor.Cursor;
+
+
+/**
+ * A Cursor which adapts an underlying Tuple based Cursor to one which returns
+ * IndexEntry objects rather than tuples.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $$Rev$$
+ */
+public class IndexCursor<K,O> implements Cursor<IndexEntry<K,O>>
+{
+    final Cursor<Tuple> wrappedCursor;
+    final ForwardIndexEntry<K, O> forwardEntry;
+    final ReverseIndexEntry<K, O> reverseEntry;
+
+
+    /**
+     * Creates an IndexCursor which wraps and adapts a Cursor from a table to
+     * one which returns an IndexEntry.
+     *
+     * @param wrappedCursor the Cursor being adapted
+     * @param forwardIndex true for a cursor over a forward index, false for
+     * one over a reverse index
+     */
+    public IndexCursor( Cursor<Tuple> wrappedCursor, boolean forwardIndex )
+    {
+        this.wrappedCursor = wrappedCursor;
+        if ( forwardIndex )
+        {
+            forwardEntry = new ForwardIndexEntry<K,O>();
+            reverseEntry = null;
+        }
+        else
+        {
+            forwardEntry = null;
+            reverseEntry = new ReverseIndexEntry<K, O>();
+        }
+    }
+
+
+    public boolean available()
+    {
+        return wrappedCursor.available();
+    }
+
+
+    public void before( IndexEntry<K, O> element ) throws Exception
+    {
+        wrappedCursor.before( element.getTuple() );
+    }
+
+
+    public void after( IndexEntry<K, O> element ) throws Exception
+    {
+        wrappedCursor.after( element.getTuple() );
+    }
+
+
+    public void beforeFirst() throws Exception
+    {
+        wrappedCursor.beforeFirst();
+    }
+
+
+    public void afterLast() throws Exception
+    {
+        wrappedCursor.afterLast();
+    }
+
+
+    public boolean first() throws Exception
+    {
+        return wrappedCursor.first();
+    }
+
+
+    public boolean last() throws Exception
+    {
+        return wrappedCursor.last();
+    }
+
+
+    public boolean isClosed() throws Exception
+    {
+        return wrappedCursor.isClosed();
+    }
+
+
+    public boolean previous() throws Exception
+    {
+        return wrappedCursor.previous();
+    }
+
+
+    public boolean next() throws Exception
+    {
+        return wrappedCursor.next();
+    }
+
+
+    public IndexEntry<K, O> get() throws Exception
+    {
+        if ( forwardEntry != null )
+        {
+            //noinspection unchecked
+            Tuple<K,Long> tuple = wrappedCursor.get();
+            forwardEntry.setTuple( tuple, null );
+            return forwardEntry;
+        }
+        else
+        {
+            //noinspection unchecked
+            Tuple<Long,K> tuple = wrappedCursor.get();
+            reverseEntry.setTuple( tuple, null );
+            return reverseEntry;
+        }
+    }
+
+
+    public boolean isElementReused()
+    {
+        return true;
+    }
+
+
+    public void close() throws Exception
+    {
+        wrappedCursor.close();
+    }
+}

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.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/JdbmIndex.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
Sun Mar 16 20:20:42 2008
@@ -29,9 +29,9 @@
 import org.apache.directory.server.schema.SerializableComparator;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.SynchronizedLRUMap;
-import org.apache.directory.shared.ldap.NotImplementedException;
 
 import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
 import java.io.File;
 import java.io.IOException;
 
@@ -460,15 +460,17 @@
     // ------------------------------------------------------------------------
 
 
-    public Cursor<IndexRecord> reverseCursor() throws Exception
+    public Cursor<IndexEntry<K, Attributes>> reverseCursor() throws Exception
     {
-        throw new NotImplementedException();
+        //noinspection unchecked
+        return new IndexCursor<K, Attributes>( ( Cursor ) reverse.cursor(), false );
     }
 
 
-    public Cursor<IndexRecord> cursor() throws IOException
+    public Cursor<IndexEntry<K, Attributes>> forwardCursor() throws Exception
     {
-        throw new NotImplementedException();
+        //noinspection unchecked
+        return new IndexCursor<K, Attributes>( ( Cursor ) forward.cursor(), true );
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.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/JdbmStore.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Sun Mar 16 20:20:42 2008
@@ -28,10 +28,7 @@
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.partition.Oid;
-import org.apache.directory.server.core.partition.impl.btree.Index;
-import org.apache.directory.server.core.partition.impl.btree.IndexAssertion;
-import org.apache.directory.server.core.partition.impl.btree.IndexNotFoundException;
-import org.apache.directory.server.core.partition.impl.btree.IndexRecord;
+import org.apache.directory.server.core.partition.impl.btree.*;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
@@ -885,7 +882,7 @@
      * @param aliasId the id of alias entry to add
      * @throws NamingException if index addition fails, and if the alias is
      * not allowed due to chaining or cycle formation.
-     * @throws Exception if the underlying btrees cannot be altered
+     * @throws Exception if the wrappedCursor btrees cannot be altered
      */
     private void addAliasIndices( Long aliasId, LdapDN aliasDn, String aliasTarget ) throws
Exception
     {
@@ -1167,12 +1164,12 @@
     }
 
 
-    public Cursor<IndexRecord> list( Long id ) throws Exception
+    public Cursor<IndexEntry<Long, Attributes>> list( Long id ) throws Exception
     {
-        Cursor<IndexRecord> cursor = hierarchyIdx.cursor();
-        IndexRecord record = new IndexRecord();
-        record.setEntryId( id );
-        cursor.before( record );
+        Cursor<IndexEntry<Long,Attributes>> cursor = hierarchyIdx.forwardCursor();
+        ForwardIndexEntry recordForward = new ForwardIndexEntry();
+        recordForward.setId( id );
+        cursor.before( recordForward );
         return cursor;
     }
 
@@ -1232,15 +1229,15 @@
         // Get all standard index attribute to value mappings
         for ( Index index:this.userIndices.values() )
         {
-            Cursor<IndexRecord> list = index.reverseCursor();
-            IndexRecord record = new IndexRecord();
-            record.setEntryId( id );
-            list.before( record );
+            Cursor<ForwardIndexEntry> list = index.reverseCursor();
+            ForwardIndexEntry recordForward = new ForwardIndexEntry();
+            recordForward.setId( id );
+            list.before( recordForward );
 
             while ( list.next() )
             {
-                IndexRecord rec = list.get();
-                Object val = rec.getIndexKey();
+                IndexEntry rec = list.get();
+                Object val = rec.getValue();
                 String attrId = index.getAttribute().getName();
                 Attribute attr = attributes.get( attrId );
 
@@ -1256,17 +1253,17 @@
 
         // Get all existance mappings for this id creating a special key
         // that looks like so 'existance[attribute]' and the value is set to id
-        Cursor<IndexRecord> list = existanceIdx.reverseCursor();
-        IndexRecord record = new IndexRecord();
-        record.setEntryId( id );
-        list.before( record );
+        Cursor<IndexEntry<String,Attributes>> list = existanceIdx.reverseCursor();
+        ForwardIndexEntry recordForward = new ForwardIndexEntry();
+        recordForward.setId( id );
+        list.before( recordForward );
         StringBuffer val = new StringBuffer();
         
         while ( list.next() )
         {
-            IndexRecord rec = list.get();
+            IndexEntry rec = list.get();
             val.append( "_existance[" );
-            val.append( rec.getIndexKey() );
+            val.append( rec.getValue() );
             val.append( "]" );
 
             String valStr = val.toString();
@@ -1277,25 +1274,25 @@
                 attr = new AttributeImpl( valStr );
             }
             
-            attr.add( rec.getEntryId() );
+            attr.add( rec.getId() );
             attributes.put( attr );
             val.setLength( 0 );
         }
 
         // Get all parent child mappings for this entry as the parent using the
         // key 'child' with many entries following it.
-        list = hierarchyIdx.cursor();
-        record = new IndexRecord();
-        record.setEntryId( id );
-        list.before( record );
+        Cursor<IndexEntry<Long,Attributes>> children = hierarchyIdx.forwardCursor();
+        recordForward = new ForwardIndexEntry();
+        recordForward.setId( id );
+        children.before( recordForward );
 
         Attribute childAttr = new AttributeImpl( "_child" );
         attributes.put( childAttr );
         
-        while ( list.next() )
+        while ( children.next() )
         {
-            IndexRecord rec = list.get();
-            childAttr.add( rec.getEntryId() );
+            IndexEntry rec = children.get();
+            childAttr.add( rec.getId() );
         }
 
         return attributes;
@@ -1751,12 +1748,12 @@
             }
         }
 
-        Cursor<IndexRecord> children = list( id );
+        Cursor<IndexEntry<Long,Attributes>> children = list( id );
         while ( children.next() )
         {
             // Get the child and its id
-            IndexRecord rec = children.get();
-            Long childId = rec.getEntryId();
+            IndexEntry rec = children.get();
+            Long childId = rec.getId();
 
             /* 
              * Calculate the Dn for the child's new name by copying the parents
@@ -1866,9 +1863,9 @@
         // Find all the aliases from movedBase down
         IndexAssertion isBaseDescendant = new IndexAssertion()
         {
-            public boolean assertCandidate( IndexRecord rec ) throws Exception
+            public boolean assertCandidate( IndexEntry rec ) throws Exception
             {
-                String dn = getEntryDn( rec.getEntryId() );
+                String dn = getEntryDn( rec.getId() );
                 return dn.endsWith( movedBase.toString() );
             }
         };
@@ -1882,13 +1879,13 @@
 
         throw new NotImplementedException( "Fix the code below this line" );
 
-//        NamingEnumeration<IndexRecord> aliases =
+//        NamingEnumeration<ForwardIndexEntry> aliases =
 //                new IndexAssertionEnumeration( aliasIdx.listIndices( movedBase.toString(),
true ), isBaseDescendant );
 //
 //        while ( aliases.hasMore() )
 //        {
-//            IndexRecord entry = aliases.next();
-//            dropAliasIndices( (Long)entry.getEntryId(), movedBase );
+//            ForwardIndexEntry entry = aliases.next();
+//            dropAliasIndices( (Long)entry.getId(), movedBase );
 //        }
     }
 

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=637708&r1=637707&r2=637708&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
Sun Mar 16 20:20:42 2008
@@ -61,7 +61,7 @@
 
     /** the current count of entries in this Table */
     private int count;
-    /** the underlying JDBM btree used in this Table */
+    /** the wrappedCursor JDBM btree used in this Table */
     private BTree bt;
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.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/JdbmIndexTest.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
Sun Mar 16 20:20:42 2008
@@ -24,13 +24,17 @@
 import org.junit.Test;
 import org.junit.After;
 import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 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.partition.impl.btree.Index;
+import org.apache.directory.server.core.partition.impl.btree.IndexEntry;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 
+import javax.naming.directory.Attributes;
 import java.util.Set;
 import java.util.HashSet;
 import java.io.File;
@@ -38,7 +42,7 @@
 
 
 /**
- * TODO doc me!
+ * Tests the JdbmIndex.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
@@ -103,15 +107,15 @@
 
     void initIndex() throws Exception
     {
-        initIndex( new JdbmIndex() );
+        initIndex( new JdbmIndex<String>() );
     }
 
 
-    void initIndex( JdbmIndex jdbmIdx ) throws Exception
+    void initIndex( JdbmIndex<String> jdbmIdx ) throws Exception
     {
         if ( jdbmIdx == null )
         {
-            jdbmIdx = new JdbmIndex();
+            jdbmIdx = new JdbmIndex<String>();
         }
 
         jdbmIdx.init( registry.lookup( SchemaConstants.OU_AT ), dbFileDir );
@@ -148,7 +152,7 @@
         assertEquals( "ou", idx.getAttributeId() );
 
         destroyIndex();
-        initIndex( new JdbmIndex( "foo" ) );
+        initIndex( new JdbmIndex<String>( "foo" ) );
         assertEquals( "foo", idx.getAttributeId() );
     }
 
@@ -179,7 +183,7 @@
     public void testWkDirPath() throws Exception
     {
         // uninitialized index
-        JdbmIndex jdbmIndex = new JdbmIndex();
+        JdbmIndex<String> jdbmIndex = new JdbmIndex<String>();
         jdbmIndex.setWkDirPath( new File( dbFileDir, "foo" ) );
         assertEquals( "foo", jdbmIndex.getWkDirPath().getName() );
 
@@ -196,7 +200,7 @@
         assertEquals( dbFileDir, idx.getWkDirPath() );
 
         destroyIndex();
-        jdbmIndex = new JdbmIndex();
+        jdbmIndex = new JdbmIndex<String>();
         File wkdir = new File( dbFileDir, "foo" );
         wkdir.mkdirs();
         jdbmIndex.setWkDirPath( wkdir );
@@ -325,19 +329,57 @@
         assertNull( idx.forwardLookup( "foo" ) );
         assertNull( idx.forwardLookup( "bar" ) );
         assertNull( idx.reverseLookup( 0L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", 0L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", -24L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", 24L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", 0L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", 24L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", -24L ) );
 
         idx.add( "foo", 0L );
         assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
         assertEquals( "foo", idx.reverseLookup( 0L ) );
+        assertTrue( idx.has( "foo", 0L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", -1L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", 1L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 1L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", -1L ) );
 
         idx.add( "foo", 1L );
         assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
         assertEquals( "foo", idx.reverseLookup( 0L ) );
         assertEquals( "foo", idx.reverseLookup( 1L ) );
+        assertTrue( idx.has( "foo", 0L ) );
+        assertTrue( idx.has( "foo", 1L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", 1L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", -1L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", 2L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 1L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 2L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", -1L ) );
 
         idx.add( "bar", 0L );
         assertEquals( 0L, ( long ) idx.forwardLookup( "bar" ) );
         assertEquals( "bar", idx.reverseLookup( 0L ) );  // reverse lookup returns first
val
+        assertTrue( idx.has( "bar", 0L ) ); 
+        assertTrue( idx.has( "foo", 0L ) );
+        assertTrue( idx.has( "foo", 1L ) );
+        assertTrue( idx.hasGreaterOrEqual( "bar", 0L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", 1L ) );
+        assertTrue( idx.hasGreaterOrEqual( "foo", -1L ) );
+        assertFalse( idx.hasGreaterOrEqual( "foo", 2L ) );
+        assertFalse( idx.hasGreaterOrEqual( "bar", 1L ) );
+        assertTrue( idx.hasLessOrEqual( "bar", 0L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 0L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 1L ) );
+        assertTrue( idx.hasLessOrEqual( "foo", 2L ) );
+        assertFalse( idx.hasLessOrEqual( "foo", -1L ) );
+        assertFalse( idx.hasLessOrEqual( "bar", -1L ) );
     }
 
 
@@ -432,6 +474,61 @@
     // -----------------------------------------------------------------------
     // Miscellaneous Test Methods
     // -----------------------------------------------------------------------
+
+
+    @Test
+    public void testCursors() throws Exception
+    {
+        initIndex();
+        assertEquals( 0, idx.count() );
+
+        idx.add( "foo", 1234L );
+        assertEquals( 1, idx.count() );
+
+        idx.add( "foo", 333L );
+        assertEquals( 2, idx.count() );
+
+        idx.add( "bar", 555L );
+        assertEquals( 3, idx.count() );
+
+        // use forward index's cursor
+        Cursor<IndexEntry<String, Attributes>> cursor = idx.forwardCursor();
+        cursor.beforeFirst();
+
+        cursor.next();
+        IndexEntry<String,Attributes> e1 = cursor.get();
+        assertEquals( 555L, ( long ) e1.getId() );
+        assertEquals( "bar", e1.getValue() );
+
+        cursor.next();
+        IndexEntry<String,Attributes> e2 = cursor.get();
+        assertEquals( 333L, ( long ) e2.getId() );
+        assertEquals( "foo", e2.getValue() );
+
+        cursor.next();
+        IndexEntry<String,Attributes> e3 = cursor.get();
+        assertEquals( 1234L, ( long ) e3.getId() );
+        assertEquals( "foo", e3.getValue() );
+
+        // use reverse index's cursor
+        cursor = idx.reverseCursor();
+        cursor.beforeFirst();
+
+        cursor.next();
+        e1 = cursor.get();
+        assertEquals( 333L, ( long ) e1.getId() );
+        assertEquals( "foo", e1.getValue() );
+
+        cursor.next();
+        e2 = cursor.get();
+        assertEquals( 555L, ( long ) e2.getId() );
+        assertEquals( "bar", e2.getValue() );
+
+        cursor.next();
+        e3 = cursor.get();
+        assertEquals( 1234L, ( long ) e3.getId() );
+        assertEquals( "foo", e3.getValue() );
+    }
 
 
     @Test

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java
Sun Mar 16 20:20:42 2008
@@ -173,8 +173,8 @@
        assertEquals("entry found", true, enm.hasMore());
        while (enm.hasMore()) {
            SearchResult sr = (SearchResult) enm.next();
-           attrs = sr.getAttributes();
-           Attribute cn = sr.getAttributes().get("cn");
+           attrs = sr.getObject();
+           Attribute cn = sr.getObject().get("cn");
            assertNotNull(cn);
            assertTrue(cn.contains("Mackie \"The Knife\" Messer"));
        }
@@ -198,8 +198,8 @@
        assertEquals("entry found", true, enm.hasMore());
        while (enm.hasMore()) {
            SearchResult sr = (SearchResult) enm.next();
-           attrs = sr.getAttributes();
-           Attribute ou = sr.getAttributes().get("ou");
+           attrs = sr.getObject();
+           Attribute ou = sr.getObject().get("ou");
            assertNotNull(ou);
            assertTrue(ou.contains("AC\\DC"));
        }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
Sun Mar 16 20:20:42 2008
@@ -412,7 +412,7 @@
         assertNotNull( org );
   
         // Check values of ou
-        Attribute ou = org.getAttributes( "" ).get( "ou" );
+        Attribute ou = org.getObject( "" ).get( "ou" );
         assertTrue( ou.contains( newOu ) );
         assertTrue( !ou.contains( oldOu ) ); // old value is gone
         assertEquals( 1, ou.size() );
@@ -476,7 +476,7 @@
         assertNotNull( newCtx );
 
         // Check that cn contains the unecnoded value
-        Attribute cn = newCtx.getAttributes( "" ).get( "cn" );
+        Attribute cn = newCtx.getObject( "" ).get( "cn" );
         assertEquals( "Number of cn occurences", 1, cn.size() );
         assertTrue( cn.contains( newCnVal ) );
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchITest.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchITest.java
Sun Mar 16 20:20:42 2008
@@ -272,7 +272,7 @@
             while ( enm.hasMore() )
             {
                 SearchResult sr = ( SearchResult ) enm.next();
-                Attributes attrs = sr.getAttributes();
+                Attributes attrs = sr.getObject();
                 Attribute sn = attrs.get( "sn" );
                 assertNotNull( sn );
                 assertTrue( sn.contains( "Ferry" ) );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
Sun Mar 16 20:20:42 2008
@@ -175,7 +175,7 @@
         InitialContext initialContext = new InitialContext( env );
         DirContext appRoot = ( DirContext ) initialContext.lookup( "" );
         assertNotNull( appRoot );
-        Attributes attributes = appRoot.getAttributes( "" );
+        Attributes attributes = appRoot.getObject( "" );
         assertNotNull( attributes );
         assertEquals( "example", attributes.get( "dc" ).get() );
         Attribute attribute = attributes.get( "objectClass" );
@@ -199,7 +199,7 @@
         InitialContext initialContext = new InitialContext( env );
         DirContext appRoot = ( DirContext ) initialContext.lookup( "" );
         assertNotNull( appRoot );
-        Attributes attributes = appRoot.getAttributes( "" );
+        Attributes attributes = appRoot.getObject( "" );
         assertNotNull( attributes );
         assertEquals( "testing", attributes.get( "ou" ).get() );
         Attribute attribute = attributes.get( "objectClass" );
@@ -223,7 +223,7 @@
         InitialContext initialContext = new InitialContext( env );
         DirContext appRoot = ( DirContext ) initialContext.lookup( "" );
         assertNotNull( appRoot );
-        Attributes attributes = appRoot.getAttributes( "" );
+        Attributes attributes = appRoot.getObject( "" );
         assertNotNull( attributes );
         assertEquals( "MixedCase", attributes.get( "dc" ).get() );
         Attribute attribute = attributes.get( "objectClass" );

Modified: directory/sandbox/akarasulu/bigbang/project/site/src/site/xdoc/projects/providers.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/project/site/src/site/xdoc/projects/providers.xml?rev=637708&r1=637707&r2=637708&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/project/site/src/site/xdoc/projects/providers.xml
(original)
+++ directory/sandbox/akarasulu/bigbang/project/site/src/site/xdoc/projects/providers.xml
Sun Mar 16 20:20:42 2008
@@ -68,8 +68,8 @@
           <td>
             <p> A DNS implementation based on <a
               href="http://www.faqs.org/rfcs/rfc1034.html">RFC 1034</a>. Apache
DNS
-              serves host name to address mappings and other resource record types
-              using resource records stored in the Apache Directory backing store.</p>
+              serves host name to address mappings and other resource recordForward types
+              using resource recordForwards stored in the Apache Directory backing store.</p>
           </td>
         </tr>
         <tr>



Mime
View raw message