directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r569922 - /directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
Date Sun, 26 Aug 2007 23:29:20 GMT
Author: akarasulu
Date: Sun Aug 26 16:29:19 2007
New Revision: 569922

URL: http://svn.apache.org/viewvc?rev=569922&view=rev
Log:
some test cases for DIRSERVER-925

Modified:
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java?rev=569922&r1=569921&r2=569922&view=diff
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
Sun Aug 26 16:29:19 2007
@@ -28,12 +28,18 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.SchemaViolationException;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.codec.actions.ResultCodeAction;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 
 
 /**
@@ -52,6 +58,48 @@
     }
 
 
+    /**
+     * For <a href="https://issues.apache.org/jira/browse/DIRSERVER-925">DIRSERVER-925</a>.
+     */
+    public void testNoStructuralObjectClass() throws NamingException
+    {
+        Attributes attrs = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC
);
+        attrs.get( SchemaConstants.OBJECT_CLASS_AT ).add( "uidObject" );
+        attrs.put( SchemaConstants.UID_AT, "invalid" );
+        
+        try
+        {
+            sysRoot.createSubcontext( "uid=invalid", attrs );
+        }
+        catch ( LdapSchemaViolationException e )
+        {
+            assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, e.getResultCode() );
+        }
+    }
+    
+    
+    /**
+     * For <a href="https://issues.apache.org/jira/browse/DIRSERVER-925">DIRSERVER-925</a>.
+     */
+    public void testMultipleStructuralObjectClasses() throws NamingException
+    {
+        Attributes attrs = new AttributesImpl( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC
);
+        attrs.get( SchemaConstants.OBJECT_CLASS_AT ).add( SchemaConstants.ORGANIZATIONAL_UNIT_OC
);
+        attrs.get( SchemaConstants.OBJECT_CLASS_AT ).add( SchemaConstants.PERSON_OC );
+        attrs.put( SchemaConstants.OU_AT, "comedy" );
+        attrs.put( SchemaConstants.CN_AT, "Jack Black" );
+        attrs.put( SchemaConstants.SN_AT, "Black" );
+        
+        try
+        {
+            sysRoot.createSubcontext( "cn=Jack Black", attrs );
+        }
+        catch ( LdapSchemaViolationException e )
+        {
+            assertEquals( ResultCodeEnum.OBJECT_CLASS_VIOLATION, e.getResultCode() );
+        }
+    }
+    
     
     /**
      * For <a href="https://issues.apache.org/jira/browse/DIRSERVER-904">DIRSERVER-904</a>.



Mime
View raw message