You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/12/12 23:41:49 UTC
svn commit: r603758 -
/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
Author: seelmann
Date: Wed Dec 12 14:41:48 2007
New Revision: 603758
URL: http://svn.apache.org/viewvc?rev=603758&view=rev
Log:
Uncommented test for DIRSERVER-1086
Modified:
directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java?rev=603758&r1=603757&r2=603758&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java (original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java Wed Dec 12 14:41:48 2007
@@ -23,10 +23,13 @@
import java.util.Hashtable;
import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
@@ -371,30 +374,31 @@
/**
* Test for DIRSERVER-1086.
* Modify Rdn of an entry that has a child entry, delete its old rdn value.
+ * Ensure that the tree is not broken.
*
* @throws NamingException
*/
- /*
- @Test public void testModifyRdnAndDeleteOldWithChild() throws NamingException
+ @Test
+ public void testModifyRdnAndDeleteOldWithChild() throws NamingException
{
// Create an organizational unit, ou value is rdn
String oldOu = "Writers";
String oldRdn = "ou=" + oldOu;
Attributes attributes = this.getOrganizationalUnitAttributes( oldOu );
DirContext createdCtx = ctx.createSubcontext( oldRdn, attributes );
-
+
// Create a child
String childCn = "Tori Amos";
String childRdn = "cn=" + childCn;
Attributes childAttributes = this.getPersonAttributes( "Amos", childCn );
createdCtx.createSubcontext( childRdn, childAttributes );
-
+
// modify Rdn
String newOu = "Singers";
String newRdn = "ou=" + newOu;
ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "true" );
ctx.rename( oldRdn, newRdn );
-
+
// Check, whether old Entry does not exists
try
{
@@ -406,34 +410,35 @@
// expected behaviour
assertTrue( true );
}
-
+
// Check, whether new Entry exists
DirContext org = ( DirContext ) ctx.lookup( newRdn );
assertNotNull( org );
-
+
// Check values of ou
Attribute ou = org.getAttributes( "" ).get( "ou" );
assertTrue( ou.contains( newOu ) );
assertTrue( !ou.contains( oldOu ) ); // old value is gone
assertEquals( 1, ou.size() );
-
+
// Perform a search under renamed ou and check whether exactly one child entry exist
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- searchControls.setReturningAttributes( new String[]{"objectClass"} );
+ searchControls.setReturningAttributes( new String[]
+ { "objectClass" } );
NamingEnumeration<SearchResult> results = org.search( "", "(objectClass=*)", searchControls );
assertTrue( results.hasMore() );
results.next();
assertTrue( !results.hasMore() );
-
+
// Check whether Tori exists
DirContext tori = ( DirContext ) org.lookup( childRdn );
assertNotNull( tori );
-
+
// Remove entry (use new rdn)
+ ctx.unbind( childRdn + "," + newRdn );
ctx.unbind( newRdn );
}
- */
/**