directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1591763 - /directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
Date Thu, 01 May 2014 20:19:24 GMT
Author: seelmann
Date: Thu May  1 20:19:24 2014
New Revision: 1591763

URL: http://svn.apache.org/r1591763
Log:
Added tests to demonstrate issue with moddn/moveAndRename operation and deleteOldRdn flag
(DIRSERVER-1974)

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java?rev=1591763&r1=1591762&r2=1591763&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientModifyDnRequestTest.java
Thu May  1 20:19:24 2014
@@ -47,6 +47,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.shared.client.api.LdapApiIntegrationUtils;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -69,7 +70,11 @@ import org.junit.runner.RunWith;
         "objectClass: inetorgPerson",
         "cn: modDn",
         "employeeNumber: test",
-        "sn: snModDn"
+        "sn: snModDn",
+        "",
+        "dn: ou=container,ou=system", 
+        "objectClass: organizationalUnit", 
+        "ou: container"
     })
 @CreateLdapServer(transports =
     { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
@@ -77,6 +82,7 @@ public class ClientModifyDnRequestTest e
 {
     private static final String DN = "cn=modDn,ou=system";
     private static final String DN_EMPLOYEE = "employeeNumber=test,ou=system";
+    private static final String DN_CONTAINER = "ou=container,ou=system";
     private LdapNetworkConnection connection;
     private CoreSession session;
 
@@ -194,4 +200,45 @@ public class ClientModifyDnRequestTest e
 
         assertTrue( session.exists( new Dn( "cn=modifyDnWithString,ou=system" ) ) );
     }
+
+
+    @Ignore
+    @Test
+    public void testMoveAndRenameShouldDeleteOldRdn() throws Exception
+    {
+        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
+        connection.moveAndRename( new Dn( DN ), newDn );
+
+        assertTrue( session.exists( newDn ) );
+        Entry entry = session.lookup( newDn, "*" );
+        assertTrue( entry.contains( "cn", "modifiedDn" ) );
+        assertFalse( entry.contains( "cn", "modDn" ) );
+    }
+
+
+    @Ignore
+    @Test
+    public void testMoveAndRenameWithDeleteOldRdnShouldDeleteOldRdn() throws Exception
+    {
+        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
+        connection.moveAndRename( new Dn( DN ), newDn, true );
+
+        assertTrue( session.exists( newDn ) );
+        Entry entry = session.lookup( newDn, "*" );
+        assertTrue( entry.contains( "cn", "modifiedDn" ) );
+        assertFalse( entry.contains( "cn", "modDn" ) );
+    }
+
+
+    @Test
+    public void testMoveAndRenameWithoutDeleteOldRdnShouldNotDeleteOldRdn() throws Exception
+    {
+        Dn newDn = new Dn( "cn=modifiedDn", DN_CONTAINER );
+        connection.moveAndRename( new Dn( DN ), newDn, false );
+
+        assertTrue( session.exists( newDn ) );
+        Entry entry = session.lookup( newDn, "*" );
+        assertTrue( entry.contains( "cn", "modifiedDn" ) );
+        assertTrue( entry.contains( "cn", "modDn" ) );
+    }
 }



Mime
View raw message