directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r321356 - /directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java
Date Sat, 15 Oct 2005 15:38:22 GMT
Author: elecharny
Date: Sat Oct 15 08:38:18 2005
New Revision: 321356

URL: http://svn.apache.org/viewcvs?rev=321356&view=rev
Log:
Added a test with turk characters

Modified:
    directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java

Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java
URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java?rev=321356&r1=321355&r2=321356&view=diff
==============================================================================
--- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java
(original)
+++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java
Sat Oct 15 08:38:18 2005
@@ -53,6 +53,50 @@
         super.tearDown();
     }
 
+    /**
+     * Checks that an entry with non-ASCII chars can be added
+     * 
+     * @throws NamingException
+     */
+    public void testAddEntryTurkish() throws NamingException
+    {
+        // The bytes used are the UTF-8 encoding for turkish characters
+        String cn = new String(
+                new byte[] { (byte)0xC4, (byte)0xB0, (byte)0xC4, (byte)0xB1, 
+                             (byte)0xC5, (byte)0x9E, (byte)0xC5, (byte)0x9F, 
+                             (byte)0xC3, (byte)0x96, (byte)0xC3, (byte)0xB6, 
+                             (byte)0xC3, (byte)0x9C, (byte)0xC3, (byte)0xBC, 
+                             (byte)0xC4, (byte)0x9E, (byte)0xC4, (byte)0x9F });
+        String sn = "baumgarten";
+
+        // Add a person
+        Attributes attributes = AttributesFactory.createPersonAttributes(cn, sn);
+
+        String rdn = "cn=" + cn;
+
+        DirContext person = ctx.createSubcontext(rdn, attributes);
+
+        // Check whether person looks fine
+        person = (DirContext) ctx.lookup(rdn);
+        assertNotNull(person);
+        attributes = person.getAttributes("");
+
+        // objectclasses
+        Attribute ocls = attributes.get("objectClass");
+        String[] expectedOcls = { "top", "person" };
+
+        for (int i = 0; i < expectedOcls.length; i++) {
+            String name = expectedOcls[i];
+            assertTrue("object class " + name + " is not present", ocls.contains(name));
+        }
+
+        // Other attributes
+        Attribute cnRes = attributes.get("cn");
+        assertTrue(cnRes.contains(cn));
+        Attribute snRes = attributes.get("sn");
+        assertTrue(snRes.contains(sn));
+    }
+
     public void testAddEntryWithGermanUmlauts() throws NamingException, UnsupportedEncodingException
     {
 
@@ -133,4 +177,5 @@
         Attribute snRes = attributes.get("sn");
         assertTrue(snRes.contains(sn));
     }
+
 }



Mime
View raw message