directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1160053 - in /directory/apacheds/trunk: jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/
Date Sun, 21 Aug 2011 20:24:18 GMT
Author: kayyagari
Date: Sun Aug 21 20:24:18 2011
New Revision: 1160053

URL: http://svn.apache.org/viewvc?rev=1160053&view=rev
Log:
o fetch original entry from master table before performing rename operation
o closed an open cursor
o added few assertions and fixed a typo in DN

Modified:
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1160053&r1=1160052&r2=1160053&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Sun Aug 21 20:24:18 2011
@@ -35,6 +35,7 @@ import java.util.UUID;
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.xdbm.GenericIndex;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -714,7 +715,7 @@ public class JdbmStoreTest
     @Test
     public void testRename() throws Exception
     {
-        Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
+        Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn );
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "ou", "Engineering" );
@@ -728,13 +729,18 @@ public class JdbmStoreTest
         Rdn rdn = new Rdn( "sn=James" );
 
         store.rename( dn, rdn, true, null );
+        
+        dn = new Dn( schemaManager, "sn=James,ou=Engineering,o=Good Times Co." );
+        Entry renamed = store.lookup( new LookupOperationContext( null, dn ) );
+        assertNotNull( renamed );
+        assertEquals( "James", renamed.getDn().getRdn().getUpValue().getString() );
     }
 
 
     @Test
     public void testRenameEscaped() throws Exception
     {
-        Dn dn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co." );
+        Dn dn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times Co."
);
         Entry entry = new DefaultEntry( schemaManager, dn );
         entry.add( "objectClass", "top", "person", "organizationalPerson" );
         entry.add( "ou", "Engineering" );
@@ -760,7 +766,7 @@ public class JdbmStoreTest
     @Test
     public void testMove() throws Exception
     {
-        Dn childDn = new Dn( schemaManager, "cn=Pivate Ryan,ou=Engineering,o=Good Times Co."
);
+        Dn childDn = new Dn( schemaManager, "cn=Private Ryan,ou=Engineering,o=Good Times
Co." );
         Entry childEntry = new DefaultEntry( schemaManager, childDn );
         childEntry.add( "objectClass", "top", "person", "organizationalPerson" );
         childEntry.add( "ou", "Engineering" );

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1160053&r1=1160052&r2=1160053&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
Sun Aug 21 20:24:18 2011
@@ -1655,9 +1655,9 @@ public abstract class AbstractBTreeParti
 
         if ( entry == null )
         {
-            entry = lookup( id );
+            entry = master.get( id );
         }
-
+        
         Dn updn = entry.getDn();
 
         newRdn.apply( schemaManager );
@@ -1858,6 +1858,8 @@ public abstract class AbstractBTreeParti
             childIds.add( cursor.get().getId() );
         }
 
+        cursor.close();
+        
         // detach the childId and all its children from oldParentId and all it parents excluding
the root
         for ( ID pid : parentIds )
         {



Mime
View raw message