Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 7204 invoked from network); 25 Jan 2007 10:36:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jan 2007 10:36:51 -0000 Received: (qmail 40786 invoked by uid 500); 25 Jan 2007 10:36:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 40731 invoked by uid 500); 25 Jan 2007 10:36:56 -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 40717 invoked by uid 99); 25 Jan 2007 10:36:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jan 2007 02:36:56 -0800 X-ASF-Spam-Status: No, hits=-9.4 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; Thu, 25 Jan 2007 02:36:49 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id DD0FF1A981A; Thu, 25 Jan 2007 02:36:29 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r499723 - /directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java Date: Thu, 25 Jan 2007 10:36:29 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070125103629.DD0FF1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Thu Jan 25 02:36:29 2007 New Revision: 499723 URL: http://svn.apache.org/viewvc?view=rev&rev=499723 Log: Added a test for DIRSERVER-758 Added: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java Added: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java?view=auto&rev=499723 ============================================================================== --- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java (added) +++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java Thu Jan 25 02:36:29 2007 @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.server.core.jndi; + + +import org.apache.directory.server.core.unit.AbstractAdminTestCase; +import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; +import org.apache.directory.shared.ldap.message.AttributeImpl; +import org.apache.directory.shared.ldap.message.AttributesImpl; + +import javax.naming.directory.Attributes; +import javax.naming.directory.Attribute; + + +/** + * Contributed by Luke Taylor to fix DIRSERVER-169. + * + * @author Apache Directory Project + * @version $Rev$ + */ +public class AddITest extends AbstractAdminTestCase +{ + protected void setUp() throws Exception + { + super.setUp(); + } + + /** + * Test that we can't add an entry with an attribute type not within + * any of the MUST or MAY of any of its objectClasses + */ + public void testAddAttributesNotInObjectClasses() throws Exception + { + Attributes attrs = new AttributesImpl( true ); + Attribute oc = new AttributeImpl( "ObjectClass", "top" ); + Attribute cn = new AttributeImpl( "cn", "kevin Spacey" ); + Attribute dc = new AttributeImpl( "dc", "ke" ); + attrs.put( oc ); + attrs.put( cn ); + attrs.put( dc); + + String base = "uid=kevin"; + + //create subcontext + try + { + sysRoot.createSubcontext( base, attrs ); + fail( "Should not reach this state" ); + } + catch ( LdapSchemaViolationException e ) + { + assertTrue( true ); + } + } +}