directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1051605 - in /directory/apacheds/branches/apacheds-AP: core-integ/src/test/java/org/apache/directory/server/core/admin/ core-integ/src/test/java/org/apache/directory/server/core/authz/ core/src/main/java/org/apache/directory/server/core/no...
Date Tue, 21 Dec 2010 18:39:23 GMT
Author: elecharny
Date: Tue Dec 21 18:39:23 2010
New Revision: 1051605

URL: http://svn.apache.org/viewvc?rev=1051605&view=rev
Log:
o Fixed a check done on a DN to avoid a NPE later
o Using the LdifUtils.crateNetry() method
o Added a test : creation of an AP in the rootDN

Modified:
    directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
    directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
    directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java

Modified: directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=1051605&r1=1051604&r2=1051605&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
Tue Dec 21 18:39:23 2010
@@ -22,8 +22,8 @@ package org.apache.directory.server.core
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.annotations.CreateDS;
@@ -42,7 +42,6 @@ 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;
 
@@ -54,7 +53,6 @@ import org.junit.runner.RunWith;
  */
 @RunWith(FrameworkRunner.class)
 @CreateDS(name = "AdministrativePointServiceIT")
-@Ignore
 public class AdministrativePointServiceIT extends AbstractLdapTestUnit
 {
     // The shared LDAP connection
@@ -89,6 +87,26 @@ public class AdministrativePointServiceI
     // Test the Add operation
     // -------------------------------------------------------------------
     /**
+     * Test the addition of an autonomous area in the rootDN
+     */
+    @Test
+    public void testAddAutonomousAreaRootDN() throws Exception
+    {
+        Entry autonomousArea = LdifUtils.createEntry( 
+            "", 
+            "ObjectClass: top",
+            "ObjectClass: organizationalUnit", 
+            "ou: autonomousArea", 
+            "administrativeRole: autonomousArea" );
+
+        // It should succeed
+        AddResponse response = connection.add( autonomousArea );
+
+        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, response.getLdapResult().getResultCode()
);
+    }
+
+
+    /**
      * Test the addition of an autonomous area
      * @throws Exception
      */
@@ -111,10 +129,10 @@ public class AdministrativePointServiceI
         Entry entry = getAdminRole( "ou=autonomousArea, ou=system" );
 
         assertTrue( entry.contains( "administrativeRole", "autonomousArea" ) );
-        assertFalse( entry.contains( "administrativeRole", "accessControlSpecificArea" )
);
-        assertFalse( entry.contains( "administrativeRole", "collectiveAttributeSpecificArea"
) );
-        assertFalse( entry.contains( "administrativeRole", "2.5.23.4" ) );
-        assertFalse( entry.contains( "administrativeRole", "triggerExecutionSpecificArea"
) );
+        assertTrue( entry.contains( "administrativeRole", "accessControlSpecificArea" ) );
+        assertTrue( entry.contains( "administrativeRole", "collectiveAttributeSpecificArea"
) );
+        assertTrue( entry.contains( "administrativeRole", "subschemaSpecificArea" ) );
+        assertTrue( entry.contains( "administrativeRole", "triggerExecutionSpecificArea"
) );
 
         autonomousArea = LdifUtils.createEntry( 
             "ou=autonomousArea2, ou=system", 
@@ -124,7 +142,7 @@ public class AdministrativePointServiceI
             "administrativeRole: autonomousArea",
             "administrativeRole: accessControlSpecificArea", 
             "administrativeRole: collectiveAttributeInnerArea",
-            "administrativeRole: 2.5.23.4", // This is the subSchemaSpecificArea OID
+            "administrativeRole: subschemaSpecificArea", 
             "administrativeRole: TRIGGEREXECUTIONSPECIFICAREA" );
 
         // It should fail, as an autonomous area is already defining the specific areas

Modified: directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=1051605&r1=1051604&r2=1051605&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
Tue Dec 21 18:39:23 2010
@@ -28,6 +28,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.message.AddResponse;
 import org.apache.directory.shared.ldap.message.ModifyRequest;
 import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
@@ -249,11 +250,13 @@ public class AutzIntegUtils
         }
 
         // now add the A/C subentry below ou=system
-        Entry subEntry = new DefaultEntry( new DN( "cn=" + cn + "," + ServerDNConstants.SYSTEM_DN
) );
-        subEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC,
-            SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC );
-        subEntry.add( SchemaConstants.SUBTREE_SPECIFICATION_AT, subtree );
-        subEntry.add( SchemaConstants.PRESCRIPTIVE_ACI_AT, aciItem );
+        Entry subEntry = LdifUtils.createEntry( 
+            new DN( "cn=" + cn + ",ou=system" ),
+            "objectClass: top",
+            "objectClass: subentry",
+            "objectClass: accessControlSubentry",
+            "subtreeSpecification: ", subtree,
+            "prescriptiveACI:", aciItem );
 
         AddResponse addResp = connection.add( subEntry );
 

Modified: directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1051605&r1=1051604&r2=1051605&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
(original)
+++ directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Tue Dec 21 18:39:23 2010
@@ -394,7 +394,7 @@ public class NormalizationInterceptor ex
      */
     private void addRdnAttributesToEntry( DN dn, Entry entry ) throws LdapException
     {
-        if ( dn == null || entry == null )
+        if ( DN.isNullOrEmpty( dn ) || entry == null )
         {
             return;
         }



Mime
View raw message