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 2007/04/12 17:23:48 UTC
svn commit: r527978 -
/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
Author: elecharny
Date: Thu Apr 12 08:23:47 2007
New Revision: 527978
URL: http://svn.apache.org/viewvc?view=rev&rev=527978
Log:
Added a test to check that a modifyDN without deleting the old rdn is working
Modified:
directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java?view=diff&rev=527978&r1=527977&r2=527978
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java Thu Apr 12 08:23:47 2007
@@ -150,6 +150,52 @@
ctx.unbind( newRdn );
}
+ /**
+ * Modify Rdn of an entry, without deleting its old rdn value.
+ *
+ * The JNDI property is set with 'False'
+ *
+ * @throws NamingException
+ */
+ public void testModifyRdnAndDontDeleteOldFalse() throws NamingException
+ {
+ // Create a person, cn value is rdn
+ String oldCn = "Myra Ellen Amos";
+ String oldRdn = "cn=" + oldCn;
+ Attributes attributes = this.getPersonAttributes( "Amos", oldCn );
+ ctx.createSubcontext( oldRdn, attributes );
+
+ // modify Rdn
+ String newCn = "Tori Amos";
+ String newRdn = "cn=" + newCn;
+ ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "False" );
+ ctx.rename( oldRdn, newRdn );
+
+ // Check, whether old Entry does not exists
+ try
+ {
+ ctx.lookup( oldRdn );
+ fail( "Entry must not exist" );
+ }
+ catch ( NameNotFoundException ignored )
+ {
+ // expected behaviour
+ assertTrue( true );
+ }
+
+ // Check, whether new Entry exists
+ DirContext tori = ( DirContext ) ctx.lookup( newRdn );
+ assertNotNull( tori );
+
+ // Check values of cn
+ Attribute cn = tori.getAttributes( "" ).get( "cn" );
+ assertTrue( cn.contains( newCn ) );
+ assertTrue( cn.contains( oldCn ) ); // old value is gone
+ assertEquals( 2, cn.size() );
+
+ // Remove entry (use new rdn)
+ ctx.unbind( newRdn );
+ }
/**
* Modify Rdn of an entry, keep its old rdn value.