directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r548418 - /directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateTest.java
Date Mon, 18 Jun 2007 17:17:37 GMT
Author: elecharny
Date: Mon Jun 18 10:17:36 2007
New Revision: 548418

URL: http://svn.apache.org/viewvc?view=rev&rev=548418
Log:
Added a test case for ObjectClass creation into the schema

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

Added: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateTest.java?view=auto&rev=548418
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateTest.java
(added)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateTest.java
Mon Jun 18 10:17:36 2007
@@ -0,0 +1,59 @@
+package org.apache.directory.server.core.schema;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+public class ObjectClassCreateTest extends AbstractAdminTestCase
+{
+    private String testOID                               =
+        "1.3.6.1.4.1.18060.0.4.0.3.1.555555.5555.5555555";
+    
+    /**
+     * Gets relative DN to ou=schema.
+     */
+    private final LdapDN getObjectClassContainer( String schemaName ) throws NamingException
+    {
+        return new LdapDN( "ou=objectClasses,cn=" + schemaName );
+    }
+
+    /*
+     * Test that I can create an ObjectClass entry with an invalid
+     */
+    public void testCreateObjectClassWithInvalidNameAttribute() 
+    throws NamingException
+    {
+        Attributes attributes = new BasicAttributes();
+        Attribute  objectClassAttribute = new BasicAttribute( "objectClass" );
+        
+        objectClassAttribute.add( "top" );
+        objectClassAttribute.add( "metaTop" );
+        objectClassAttribute.add( "metaObjectClass" );
+        
+        attributes.put( objectClassAttribute );
+        
+        attributes.put( "m-oid", "testOID" );
+        
+        // This name is invalid
+        attributes.put( "m-name", "http://example.com/users/accounts/L0" );
+        
+        LdapDN dn = getObjectClassContainer( "apachemeta" );
+        dn.add( MetaSchemaConstants.M_OID_AT + "=" + testOID );
+        
+        try
+        {
+            schemaRoot.createSubcontext( dn, attributes );
+            fail(); // Should not reach this point
+        }
+        catch ( NamingException ne )
+        {
+            assertTrue( true );
+        }
+    }
+}



Mime
View raw message