directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r528627 - /directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
Date Fri, 13 Apr 2007 19:43:05 GMT
Author: elecharny
Date: Fri Apr 13 12:43:04 2007
New Revision: 528627

URL: http://svn.apache.org/viewvc?view=rev&rev=528627
Log:
Added a test with a bad telephone number, to check that the SyntaxChecker is working

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

Modified: 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=diff&rev=528627&r1=528626&r2=528627
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
Fri Apr 13 12:43:04 2007
@@ -21,6 +21,7 @@
 
 
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -114,6 +115,36 @@
             fail( "Should not reach this state" );
         }
         catch ( LdapSchemaViolationException e )
+        {
+            assertTrue( true );
+        }
+    }
+
+    /**
+     * Test that we can't add an entry with an attribute with a bad syntax
+     */
+    public void testAddAttributesBadSyntax() throws Exception
+    {
+        Attributes attrs = new AttributesImpl( true );
+        Attribute oc = new AttributeImpl( "ObjectClass", "top" );
+        oc.add( "person" );
+        Attribute cn = new AttributeImpl( "cn", "kevin Spacey" );
+        Attribute sn = new AttributeImpl( "sn", "ke" );
+        Attribute telephone = new AttributeImpl( "telephoneNumber", "0123456abc" );
+        attrs.put( oc );
+        attrs.put( cn );
+        attrs.put( sn );
+        attrs.put( telephone );
+
+        String base = "sn=kevin";
+
+        //create subcontext
+        try
+        {
+            sysRoot.createSubcontext( base, attrs );
+            fail( "Should not reach this state" );
+        }
+        catch ( LdapInvalidAttributeValueException e )
         {
             assertTrue( true );
         }



Mime
View raw message