directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r948568 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/schema/ core-integ/src/test/java/org/apache/directory/server/core/schema/
Date Wed, 26 May 2010 20:17:47 GMT
Author: seelmann
Date: Wed May 26 20:17:47 2010
New Revision: 948568

URL: http://svn.apache.org/viewvc?rev=948568&view=rev
Log:
DIRSHARED-60: added tests and TODOs

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?rev=948568&r1=948567&r2=948568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
Wed May 26 20:17:47 2010
@@ -275,6 +275,7 @@ public class DescriptionParsers
                     I18n.err( I18n.ERR_413, attributeType.getSubstringOid() ) );
             }
 
+            // TODO: DIRSHARED-60: this check is wrong and must be removed
             // if the equality matching rule is null and no super type is specified then
there is
             // definitely no equality matchingRule that can be resolved.  We cannot use an
attribute
             // without a matchingRule for search or for building indices not to mention lookups.
@@ -296,6 +297,7 @@ public class DescriptionParsers
                 }
             }
 
+            // TODO: this check is already by done by the schema parser and can be removed
             // a syntax is mandatory for an attributeType and if not provided by the description

             // must be provided from some ancestor in the attributeType hierarchy; without
either
             // of these the description definitely cannot resolve a syntax and cannot be
allowed.

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java?rev=948568&r1=948567&r2=948568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
Wed May 26 20:17:47 2010
@@ -71,6 +71,41 @@ public class MetaAttributeTypeHandlerIT 
     // ----------------------------------------------------------------------
     // Test Add operation
     // ----------------------------------------------------------------------
+    /**
+     * Test for DIRSHARED-60.
+     * It is allowed to add an attribute type description without any matching rule.
+     * Adding it via ou=schema partition worked. Adding it via the subschema subentry failed.
+     */
+    @Test
+    public void testAddAttributeTypeWithoutMatchingRule() throws Exception
+    {
+        Attributes attrs = LdifUtils.createAttributes( 
+            "objectClass: top",
+            "objectClass: metaTop",
+            "objectClass: metaAttributeType",
+            "m-oid: 2.5.4.58",
+            "m-name: attributeCertificateAttribute",
+            "m-syntax: 1.3.6.1.4.1.1466.115.121.1.8",
+            "m-description: attribute certificate use ;binary"
+         );
+        
+        DN dn = getAttributeTypeContainer( "apachemeta" );
+        dn.add( "m-oid=2.5.4.58" );
+        
+        // Pre-checks
+        assertFalse( isOnDisk( dn ) );
+        assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( "2.5.4.58"
) );
+        
+        // Addition
+        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+        
+        // Post-checks
+        assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "2.5.4.58"
) );
+        assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName(
"2.5.4.58" ), "apachemeta" );
+        assertTrue( isOnDisk( dn ) );
+    }
+
+
     @Test
     public void testAddAttributeTypeToEnabledSchema() throws Exception
     {

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=948568&r1=948567&r2=948568&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
Wed May 26 20:17:47 2010
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.schema;
 
 
+import static org.apache.directory.server.core.integ.IntegrationUtils.getAdminConnection;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
 import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
@@ -56,12 +57,16 @@ import javax.naming.directory.SearchCont
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.ModifyRequest;
+import org.apache.directory.ldap.client.api.message.ModifyResponse;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.LdapSyntax;
@@ -119,7 +124,26 @@ public class SubschemaSubentryIT extends
     private ObjectClassDescriptionSchemaParser objectClassDescriptionSchemaParser =
         new ObjectClassDescriptionSchemaParser();
 
-    
+
+    /**
+     * Test for DIRSHARED-60.
+     * It is allowed to add an attribute type description without any matching rule.
+     * Adding it via ou=schema partition worked. Adding it via the subschema subentry failed.
+     */
+    @Ignore
+    @Test
+    public void testAddAttributeTypeWithoutMatchingRule() throws Exception
+    {
+        LdapConnection conn = getAdminConnection( service );
+
+        ModifyRequest modRequest = new ModifyRequest( new DN( GLOBAL_SUBSCHEMA_DN ) );
+        modRequest.add( "attributeTypes", "( 2.5.4.58 NAME 'attributeCertificateAttribute'
"
+            + " DESC 'attribute certificate use ;binary' SYNTAX 1.3.6.1.4.1.1466.115.121.1.8
)" );
+        ModifyResponse response = conn.modify( modRequest );
+        assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+    }
+
+
     /**
      * Make sure the global subschemaSubentry is where it is expected to be.
      *



Mime
View raw message