You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/01/03 01:04:02 UTC
svn commit: r895314 - in /directory/apacheds/branches/apacheds-schema:
core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java
Author: elecharny
Date: Sun Jan 3 00:04:01 2010
New Revision: 895314
URL: http://svn.apache.org/viewvc?rev=895314&view=rev
Log:
Fixed an error in the rename operation
Modified:
directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=895314&r1=895313&r2=895314&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sun Jan 3 00:04:01 2010
@@ -1144,7 +1144,7 @@
// Substitute the RDN and check if the new entry is correct
tmpEntry.setDn( opContext.getNewDn() );
- check( oldDn, tmpEntry );
+ check( opContext.getNewDn(), tmpEntry );
// Check that no operational attributes are removed
for ( AttributeTypeAndValue atav : oldRDN )
@@ -1356,6 +1356,7 @@
// - all the MUST are present
// - all the attribute are in MUST and MAY, except fo the extensibleObeject OC
// is present
+ // - We haven't removed a part of the RDN
check( dn, tempEntry );
}
@@ -1409,7 +1410,9 @@
return;
}
- checkModifyEntry( dn, opContext.getEntry(), opContext.getModItems() );
+ ServerEntry entry = opContext.getEntry();
+ List<Modification> modifications = opContext.getModItems();
+ checkModifyEntry( dn, entry, modifications );
next.modify( opContext );
}
@@ -1602,6 +1605,8 @@
// Now check the syntaxes
assertSyntaxes( entry );
+
+ assertRdn ( dn, entry );
}
@@ -1933,6 +1938,20 @@
}
}
}
+
+
+ private void assertRdn( LdapDN dn, ServerEntry entry ) throws Exception
+ {
+ for ( AttributeTypeAndValue atav : dn.getRdn() )
+ {
+ if ( !entry.containsAttribute( atav.getNormType() ) )
+ {
+ String message = "Entry " + dn + " does not have the " + atav.getUpType() + " attributeType, which is part of the RDN";
+ LOG.error( message );
+ throw new LdapSchemaViolationException( message, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
+ }
+ }
+ }
/**
Modified: directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java?rev=895314&r1=895313&r2=895314&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/ModifyRdnIT.java Sun Jan 3 00:04:01 2010
@@ -45,6 +45,7 @@
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -1029,14 +1030,12 @@
{
DirContext ctx = ( DirContext ) getWiredContext( ldapServer ).lookup( BASE );
- Attributes attributes = new BasicAttributes( true );
- Attribute attribute = new BasicAttribute( "objectClass" );
- attribute.add( "top" );
- attribute.add( "person" );
- attributes.put( attribute );
- attributes.put( "cn", "Tori Amos" );
- attributes.put( "sn", "Amos" );
- attributes.put( "description", "Tori Amos is a person." );
+ Attributes attributes = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn: Tori Amos",
+ "sn: Amos",
+ "description: Tori Amos is a person." );
String rdn = getRdn( attributes, rdnTypes );