Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 80665 invoked from network); 18 Jun 2007 17:17:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jun 2007 17:17:58 -0000 Received: (qmail 59152 invoked by uid 500); 18 Jun 2007 17:18:01 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 59124 invoked by uid 500); 18 Jun 2007 17:18:01 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 59113 invoked by uid 99); 18 Jun 2007 17:18:01 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2007 10:18:01 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2007 10:17:57 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 46E231A981C; Mon, 18 Jun 2007 10:17:37 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070618171737.46E231A981C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 ); + } + } +}