You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sz...@apache.org on 2005/10/07 22:45:22 UTC
svn commit: r307192 -
/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java
Author: szoerner
Date: Fri Oct 7 13:45:18 2005
New Revision: 307192
URL: http://svn.apache.org/viewcvs?rev=307192&view=rev
Log:
Integrated the test elecharny added to the old version of the tests.
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=307192&r1=307191&r2=307192&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 Fri Oct 7 13:45:18 2005
@@ -99,4 +99,55 @@
assertTrue(description.contains(allUmlauts));
}
+
+ /**
+ * Checks that an entry with non-ASCII chars can be added
+ *
+ * @throws NamingException
+ */
+ public void testAddEntryNonASCII() throws NamingException
+ {
+ // The bytes used are the UTF-8 encoding for Jérôme :
+ // 0x4A = J
+ // 0xC3 0xA9 = é, encoded
+ // 0x72 = r
+ // 0xC3 0xB4 = ô, encoded
+ // 0x6D = m
+ // 0x65 = e
+ String cn = new String(
+ new byte[] { 0x4A, (byte) 0xC3, (byte) 0xA9, 0x72, (byte) 0xC3, (byte) 0xB4, 0x6D, 0x65 });
+ String sn = "baumgarten";
+
+ DirContext ctx = this.createContext();
+ DirContext target = (DirContext) ctx.lookup(getTestContainerRdn());
+
+ // Add a person
+ Attributes attributes = createPersonAttributes(cn, sn);
+
+ String rdn = "cn=" + cn;
+
+ DirContext person = target.createSubcontext(rdn, attributes);
+
+ // Check whether person looks fine
+ person = (DirContext) target.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));
+
+ ctx.close();
+ }
}