directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r432087 - in /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server: AddITest.java ModifyAddTest.java
Date Thu, 17 Aug 2006 00:49:54 GMT
Author: ersiner
Date: Wed Aug 16 17:49:54 2006
New Revision: 432087

URL: http://svn.apache.org/viewvc?rev=432087&view=rev
Log:
Test cases for DIRSERVER-614

Modified:
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java?rev=432087&r1=432086&r2=432087&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/AddITest.java
Wed Aug 16 17:49:54 2006
@@ -325,4 +325,34 @@
         con.delete( dn );
         con.disconnect();
     }
+    
+    /**
+     * Try to add entry with invalid number of values for a single-valued atribute
+     * @see http://issues.apache.org/jira/browse/DIRSERVER-614
+     */
+    public void testAddWithInvalidNumberOfAttributeValues() throws NamingException
+    {
+        // add inetOrgPerson with two displayNames
+        Attributes attrs = new BasicAttributes();
+        Attribute ocls = new BasicAttribute( "objectClass" );
+        ocls.add( "top" );
+        ocls.add( "inetOrgPerson" );
+        attrs.put( ocls );
+        attrs.put( "cn", "Fiona Apple" );
+        attrs.put( "sn", "Apple" );
+        Attribute displayName = new BasicAttribute( "displayName" );
+        displayName.add( "Fiona" );
+        displayName.add( "Fiona A." );
+        attrs.put( displayName );
+
+        try
+        {
+            ctx.createSubcontext( "cn=Fiona Apple", attrs );
+            fail( "creation of entry should fail" );
+        }
+        catch ( InvalidAttributeValueException e )
+        {
+            
+        }
+    }
 }

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java?rev=432087&r1=432086&r2=432087&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java
Wed Aug 16 17:49:54 2006
@@ -29,6 +29,7 @@
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeIdentifierException;
+import javax.naming.directory.InvalidAttributeValueException;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
@@ -508,4 +509,37 @@
         fail();
     }
     */
+    
+    /**
+     * Try to modify an entry adding invalid number of values for a single-valued atribute
+     * @see http://issues.apache.org/jira/browse/DIRSERVER-614
+     */
+    public void testModifyAddWithInvalidNumberOfAttributeValues() throws NamingException
+    {
+        Attributes attrs = new BasicAttributes();
+        Attribute ocls = new BasicAttribute( "objectClass" );
+        ocls.add( "top" );
+        ocls.add( "inetOrgPerson" );
+        attrs.put( ocls );
+        attrs.put( "cn", "Fiona Apple" );
+        attrs.put( "sn", "Apple" );
+        ctx.createSubcontext( "cn=Fiona Apple", attrs );
+        
+        // add two displayNames to an inetOrgPerson
+        attrs = new BasicAttributes();
+        Attribute displayName = new BasicAttribute( "displayName" );
+        displayName.add( "Fiona" );
+        displayName.add( "Fiona A." );
+        attrs.put( displayName );
+        
+        try
+        {
+            ctx.modifyAttributes( "cn=Fiona Apple", DirContext.ADD_ATTRIBUTE, attrs );
+            fail( "modification of entry should fail" );
+        }
+        catch ( InvalidAttributeValueException e )
+        {
+            
+        }
+    }
 }



Mime
View raw message