directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1778697 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
Date Sat, 14 Jan 2017 01:43:42 GMT
Author: elecharny
Date: Sat Jan 14 01:43:42 2017
New Revision: 1778697

URL: http://svn.apache.org/viewvc?rev=1778697&view=rev
Log:
Added a test

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java?rev=1778697&r1=1778696&r2=1778697&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/delete/DeleteIT.java
Sat Jan 14 01:43:42 2017
@@ -26,12 +26,15 @@ import static org.apache.directory.serve
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
 import javax.naming.NameNotFoundException;
 import javax.naming.ReferralException;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.api.ldap.model.cursor.EntryCursor;
+import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapContextNotEmptyException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.Control;
@@ -39,6 +42,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
 import org.apache.directory.api.ldap.model.message.DeleteResponse;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaITImpl;
 import org.apache.directory.api.ldap.model.name.Dn;
@@ -46,6 +50,10 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.junit.Test;
@@ -148,6 +156,58 @@ public class DeleteIT extends AbstractLd
     }
 
 
+    /**
+     * Tests normal delete operation on normal non-referral entries without
+     * the ManageDsaIT control.
+     */
+    @Test
+    @CreateDS(
+        name = "MethodDSWithPartition",
+        partitions =
+            {
+                @CreatePartition(
+                    name = "example",
+                    suffix = "dc=example,dc=com",
+                    contextEntry = @ContextEntry(
+                        entryLdif =
+                        "dn: dc=example,dc=com\n" +
+                            "dc: example\n" +
+                            "objectClass: top\n" +
+                            "objectClass: domain\n\n"),
+                    indexes =
+                        {
+                            @CreateIndex(attribute = "objectClass"),
+                            @CreateIndex(attribute = "dc"),
+                            @CreateIndex(attribute = "ou")
+                    })
+        })
+    public void testDeleteContextEntry() throws Exception
+    {
+        getService().shutdown();
+        getService().startup();
+
+        LdapConnection conn = getAdminConnection( getLdapServer() );
+
+        // delete success
+        conn.delete( "dc=example,dc=com" );
+        
+        // Check that the context entry has been deleted
+        Entry contextEntry = conn.lookup( "dc=example,dc=com" );
+        
+        assertNull( contextEntry );
+
+        getService().shutdown();
+        getService().startup();
+
+        conn = getAdminConnection( getLdapServer() );
+
+        // Check that the context entry has been deleted
+        EntryCursor cursor = conn.search( "dc=example,dc=com", "(objectClass=*)", SearchScope.SUBTREE,
"*" );
+        
+        assertFalse( cursor.available() );
+    }
+
+
     /**
      * Tests normal delete operation on non-existent entries without
      * the ManageDsaIT control.



Mime
View raw message