directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1601331 - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java
Date Mon, 09 Jun 2014 09:23:08 GMT
Author: elecharny
Date: Mon Jun  9 09:23:07 2014
New Revision: 1601331

URL: http://svn.apache.org/r1601331
Log:
o Added a test that we can read an Entry with some attributeType containing underscores
o Added a test that checks we can't injected an AttributeType with underscore in the name

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=1601331&r1=1601330&r2=1601331&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
Mon Jun  9 09:23:07 2014
@@ -45,6 +45,8 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.ModificationOperation;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeTypeException;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.message.ModifyRequest;
 import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
 import org.apache.directory.api.ldap.model.message.ModifyResponse;
@@ -1428,6 +1430,26 @@ public class SubschemaSubentryIT extends
 
 
     /**
+     * Tests the addition of a new attributeType with some
+     * underscores via a modify ADD on the SSSE to enabled schema.
+     *
+     * @throws Exception on error
+     */
+    @Test( expected=LdapInvalidAttributeValueException.class )
+    public void testAddAttributeTypeWithUnderscoresOnEnabledSchema() throws Exception
+    {
+        enableSchema( "nis" );
+        Dn dn = new Dn( subschemaSubentryDn );
+        String substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10000 NAME ( 'bogus' 'bogus_microsoft_name'
) "
+            + "DESC 'bogus description' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SUP name SINGLE-VALUE
X-SCHEMA 'nis' )";
+        Modification mod = new DefaultModification(
+            ModificationOperation.ADD_ATTRIBUTE, new DefaultAttribute( "attributeTypes",
substrate ) );
+
+        connection.modify( dn, mod );
+    }
+
+
+    /**
      * Tests the addition of a new attributeType where the DESC contains only spaces
      */
     @Test

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java?rev=1601331&r1=1601330&r2=1601331&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java
Mon Jun  9 09:23:07 2014
@@ -2354,4 +2354,30 @@ public class LdifReaderTest
         assertEquals( "cn=test3", entry.getDn().getName() );
         assertEquals( 0, entry.size() );
     }
+
+
+    @Test
+    public void testLdifParserWithUnderscoresAT() throws Exception, Exception
+    {
+        String ldif =
+            "version: 1\n" +
+            "# Add a new entry\n" +
+            "dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com\n" +
+            "changetype: add\n" +
+            "objectclass: top\n" +
+            "objectclass: person\n" +
+            "objectclass: organizationalPerson\n" +
+            "cn: Fiona Jensen\n" +
+            "sn: Jensen\n" +
+            "uid: fiona\n" +
+            "telephonenumber: +1 408 555 1212\n" +
+            "An_idiot_Attribute: thanks M$ for that";
+
+        LdifReader reader = new LdifReader();
+        List<LdifEntry> entries = reader.parseLdif( ldif );
+        LdifEntry entry = entries.get( 0 );
+        assertEquals( entry.get( "An_idiot_Attribute" ).getString(), "thanks M$ for that"
);
+        reader.close();
+
+    }
 }



Mime
View raw message