directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From malder...@apache.org
Subject svn commit: r562578 - in /directory/apacheds/trunk/mitosis/src: main/java/org/apache/directory/mitosis/operation/OperationFactory.java test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
Date Fri, 03 Aug 2007 20:50:10 GMT
Author: malderson
Date: Fri Aug  3 13:50:08 2007
New Revision: 562578

URL: http://svn.apache.org/viewvc?view=rev&rev=562578
Log:
Fix for DIRSERVER-1011, where renaming an entry with mitosis enabled would give an LdapNameNotFoundException.

Modified:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?view=diff&rev=562578&r1=562577&r2=562578
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Fri Aug  3 13:50:08 2007
@@ -39,6 +39,7 @@
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -84,6 +85,7 @@
     private final PartitionNexus nexus;
     private final UUIDFactory uuidFactory;
     private final CSNFactory csnFactory;
+    private final AttributeTypeRegistry attributeRegistry;
 
 
     public OperationFactory( DirectoryServiceConfiguration serviceCfg, ReplicationConfiguration
cfg )
@@ -93,6 +95,7 @@
         this.nexus = serviceCfg.getPartitionNexus();
         this.uuidFactory = cfg.getUuidFactory();
         this.csnFactory = cfg.getCsnFactory();
+        this.attributeRegistry = serviceCfg.getRegistries().getAttributeTypeRegistry();
     }
 
 
@@ -264,6 +267,7 @@
 
             // Get the name of the old entry
             LdapDN oldEntryName = new LdapDN( sr.getName() );
+            oldEntryName.normalize( attributeRegistry.getNormalizerMapping() );
 
             // Delete the old entry
             result.add( new ReplaceAttributeOperation( csn, oldEntryName, new AttributeImpl(
Constants.ENTRY_DELETED,
@@ -284,9 +288,10 @@
             {
                 newEntryName.add( oldEntryName.get( oldEntryName.size() - i ) );
             }
+            newEntryName.normalize( attributeRegistry.getNormalizerMapping() );
 
             // Add the new entry
-            result.add( newAdd( csn, new LdapDN( newEntryName.getUpName() ), entry ) );
+            result.add( newAdd( csn, newEntryName, entry ) );
 
             // Add default operations to the old entry.
             // Please note that newAdd() already added default operations

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?view=diff&rev=562578&r1=562577&r2=562578
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
Fri Aug  3 13:50:08 2007
@@ -81,11 +81,11 @@
     public void testOneWay() throws Exception
     {
         String dn1 = "cn=test,ou=system";
-//        String dn2 = "cn=test2,ou=system";
+        String dn2 = "cn=test2,ou=system";
         testOneWayBind( dn1 );
         testOneWayModify( dn1 );
-//        testOneWayRename( dn1, dn2 );
-        testOneWayUnbind( dn1 );
+        testOneWayRename( dn1, dn2 );
+        testOneWayUnbind( dn2 );
     }
     
     /**
@@ -171,25 +171,25 @@
         Assert.assertEquals( newValue, getAttributeValue( ctxC, dn, "ou" ) );
     }
 
-//    private void testOneWayRename( String dn1, String dn2 ) throws Exception
-//    {
-//        LdapContext ctxA = getReplicaContext( "A" );
-//        LdapContext ctxB = getReplicaContext( "B" );
-//        LdapContext ctxC = getReplicaContext( "C" );
-//        
-//        ctxA.rename( dn1, dn2 );
-//        
-//        replicationServices.get( "A" ).replicate();
-//
-//        Thread.sleep( 5000 );
-//        
-//        assertNotExists( ctxA, dn1 );
-//        assertNotExists( ctxB, dn1 );
-//        assertNotExists( ctxC, dn1 );
-//        Assert.assertNotNull( ctxA.lookup( dn2 ) );
-//        Assert.assertNotNull( ctxB.lookup( dn2 ) );
-//        Assert.assertNotNull( ctxC.lookup( dn2 ) );
-//    }
+    private void testOneWayRename( String dn1, String dn2 ) throws Exception
+    {
+        LdapContext ctxA = getReplicaContext( "A" );
+        LdapContext ctxB = getReplicaContext( "B" );
+        LdapContext ctxC = getReplicaContext( "C" );
+        
+        ctxA.rename( dn1, dn2 );
+        
+        replicationServices.get( "A" ).replicate();
+
+        Thread.sleep( 5000 );
+        
+        assertNotExists( ctxA, dn1 );
+        assertNotExists( ctxB, dn1 );
+        assertNotExists( ctxC, dn1 );
+        Assert.assertNotNull( ctxA.lookup( dn2 ) );
+        Assert.assertNotNull( ctxB.lookup( dn2 ) );
+        Assert.assertNotNull( ctxC.lookup( dn2 ) );
+    }
     
     private void testOneWayUnbind( String dn ) throws Exception
     {



Mime
View raw message