directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From malder...@apache.org
Subject svn commit: r565207 - in /directory/apacheds/trunk/mitosis/src: main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
Date Sun, 12 Aug 2007 23:45:31 GMT
Author: malderson
Date: Sun Aug 12 16:45:30 2007
New Revision: 565207

URL: http://svn.apache.org/viewvc?view=rev&rev=565207
Log:
Fix for DIRSERVER-1013, where an extra OID RDN was being created for new entries when the
replication service was enabled.

Added:
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
Modified:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?view=diff&rev=565207&r1=565206&r2=565207
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
Sun Aug 12 16:45:30 2007
@@ -35,7 +35,6 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 
 /**
@@ -92,12 +91,6 @@
             recursiveDelete( nexus, normalizedName, registry );
         }
 
-        String rdn = normalizedName.get( normalizedName.size() - 1 );
-        // Remove the attribute first in case we're using a buggy 
-        // AttributesImpl which doesn't replace old attributes
-        // when we put a new one.
-        entry.remove( NamespaceTools.getRdnAttribute( rdn ) );
-        entry.put( NamespaceTools.getRdnAttribute( rdn ), NamespaceTools.getRdnValue( rdn
) );
         nexus.add( new AddOperationContext( normalizedName, entry ) );
     }
 

Added: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java?view=auto&rev=565207
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
(added)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
Sun Aug 12 16:45:30 2007
@@ -0,0 +1,61 @@
+/*
+ *  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.mitosis.service;
+
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+
+
+/**
+ * A test case for DIRSERVER-1013: "Extra RDN attribute created".
+ * 
+ * When mitosis is enabled and an entry is added the OID of the RDN
+ * attribute is added as an extra attribute. As an example, if an
+ * entry ou=test,ou=system is added then it will have attributes
+ * ou=test and 2.5.4.11=test.
+ * 
+ * @author The Apache Directory Project Team (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class DIRSERVER1013ITest extends AbstractReplicationServiceTestCase
+{
+    protected void setUp() throws Exception
+    {
+        // Create two replicas as we currently can't have the
+        // replication service enabled without more than one.
+        createReplicas( new String[] { "A", "B" } );
+    }
+    
+    public void testNoRDNOID () throws Exception
+    {
+        LdapContext ctxA = getReplicaContext( "A" );
+        
+        Attributes entry = new AttributesImpl( true );
+        entry.put( "cn", "test" );
+        entry.put( "objectClass", "top" ).add( "extensibleObject" );
+        ctxA.bind( "cn=test,ou=system", null, entry );
+        
+        Attributes attributes = ctxA.getAttributes( "cn=test,ou=system" );
+        assertNull( attributes.get( SchemaConstants.CN_AT_OID ) );
+    }
+}



Mime
View raw message