directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r980741 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
Date Fri, 30 Jul 2010 11:37:52 GMT
Author: elecharny
Date: Fri Jul 30 11:37:51 2010
New Revision: 980741

URL: http://svn.apache.org/viewvc?rev=980741&view=rev
Log:
o Added tests for modifications of administrative roles

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=980741&r1=980740&r2=980741&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
Fri Jul 30 11:37:51 2010
@@ -42,6 +42,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -366,6 +367,183 @@ public class AdministrativePointServiceI
 
 
     /**
+     * Test the deletion of all the roles
+     * @throws Exception
+     */
+    @Test
+    public void testModifyDeleteAll() throws Exception
+    {
+        // Inject an CASA
+        Entry caArea = LdifUtils.createEntry(
+            "ou=caArea, ou=system",
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit",
+            "ou: caArea",
+            "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea"
+            );
+
+        connection.add( caArea );
+
+        // Add another specific area
+        Modification modification = new DefaultModification(
+                                            ModificationOperation.REMOVE_ATTRIBUTE,
+                                            new DefaultEntryAttribute( "administrativeRole"
) );
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification
);
+
+        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+        Entry entry = getAdminRole( "ou=caArea, ou=system" );
+
+        assertFalse( entry.contains( "administrativeRole" ) );
+    }
+
+
+    /**
+     * Test the deletion of all the roles
+     * @throws Exception
+     */
+    @Test
+    public void testModifyDeleteAll2() throws Exception
+    {
+        // Inject an CASA
+        Entry caArea = LdifUtils.createEntry(
+            "ou=caArea, ou=system",
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit",
+            "ou: caArea",
+            "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea"
+            );
+
+        connection.add( caArea );
+
+        // Add another specific area
+        Modification modification = new DefaultModification(
+                                            ModificationOperation.REMOVE_ATTRIBUTE,
+                                            new DefaultEntryAttribute(
+                                                "administrativeRole",
+                                                    "collectiveAttributeSpecificArea", "accessControlSpecificArea"
) );
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification
);
+
+        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+        Entry entry = getAdminRole( "ou=caArea, ou=system" );
+
+        assertFalse( entry.contains( "administrativeRole" ) );
+    }
+
+
+    /**
+     * Test the deletion of some role
+     * @throws Exception
+     */
+    @Test
+    public void testModifyDeleteSomeRole() throws Exception
+    {
+        // Inject an CASA
+        Entry caArea = LdifUtils.createEntry(
+            "ou=caArea, ou=system",
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit",
+            "ou: caArea",
+            "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea"
+            );
+
+        connection.add( caArea );
+
+        // Add another specific area
+        Modification modification = new DefaultModification(
+                                            ModificationOperation.REMOVE_ATTRIBUTE,
+                                            new DefaultEntryAttribute(
+                                                "administrativeRole",
+                                                    "accessControlSpecificArea" ) );
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification
);
+
+        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+        Entry entry = getAdminRole( "ou=caArea, ou=system" );
+
+        assertTrue( entry.contains( "administrativeRole" ) );
+        assertTrue( entry.contains( "administrativeRole", "collectiveAttributeSpecificArea"
) );
+        assertFalse( entry.contains( "administrativeRole", "accessControlSpecificArea" )
);
+    }
+
+
+    /**
+     * Test the deletion of some role
+     * @throws Exception
+     */
+    @Test
+    public void testModifyDeleteSomeInexistingRole() throws Exception
+    {
+        // Inject an CASA
+        Entry caArea = LdifUtils.createEntry(
+            "ou=caArea, ou=system",
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit",
+            "ou: caArea",
+            "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea"
+            );
+
+        connection.add( caArea );
+
+        // Add another specific area
+        Modification modification = new DefaultModification(
+                                            ModificationOperation.REMOVE_ATTRIBUTE,
+                                            new DefaultEntryAttribute(
+                                                "administrativeRole",
+                                                    "triggerExecutionSpecificArea" ) );
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification
);
+
+        assertEquals( ResultCodeEnum.NO_SUCH_ATTRIBUTE, response.getLdapResult().getResultCode()
);
+    }
+
+
+    /**
+     * Test the a combined operation
+     * @throws Exception
+     */
+    @Test
+    @Ignore // Until the ExceptionInterceptor to be fixed
+    public void testModifyCombined() throws Exception
+    {
+        // Inject an CASA
+        Entry caArea = LdifUtils.createEntry(
+            "ou=caArea, ou=system",
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit",
+            "ou: caArea",
+            "administrativeRole: collectiveAttributeSpecificArea",
+            "administrativeRole: accessControlSpecificArea"
+            );
+
+        connection.add( caArea );
+
+        // Add another specific area
+        Modification modification1 = new DefaultModification(
+            ModificationOperation.ADD_ATTRIBUTE,
+            new DefaultEntryAttribute(
+                "administrativeRole",
+                    "triggerExecutionSpecificArea" ) );
+        Modification modification2 = new DefaultModification(
+            ModificationOperation.REMOVE_ATTRIBUTE,
+            new DefaultEntryAttribute(
+                "administrativeRole",
+                    "triggerExecutionSpecificArea" ) );
+
+        ModifyResponse response = connection.modify( "ou=caArea, ou=system", modification1,
modification2, modification1);
+
+        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+        Entry entry = getAdminRole( "ou=caArea, ou=system" );
+
+        assertTrue( entry.contains( "administrativeRole" ) );
+        assertTrue( entry.contains( "administrativeRole", "collectiveAttributeSpecificArea"
) );
+        assertTrue( entry.contains( "administrativeRole", "accessControlSpecificArea" ) );
+        assertTrue( entry.contains( "administrativeRole", "triggerExecutionSpecificArea"
) );
+    }
+
+
+    /**
      * Test the replace modification : it's not supported
      * @throws Exception
      */



Mime
View raw message