You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/08/20 22:25:12 UTC

svn commit: r433029 [3/3] - in /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name: AttributeTypeAndValueTest.java DnParserDIRSERVER_584_Test.java LdapDNTest.java LdapDnParserTest.java RdnTest.java

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java?rev=433029&r1=433028&r2=433029&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java Sun Aug 20 13:25:11 2006
@@ -31,520 +31,527 @@
 
 /**
  * Test the class LdapDN
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class LdapDnParserTest extends TestCase
 {
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
+   // ~ Methods
+   // ------------------------------------------------------------------------------------
 
-    /**
-     * Setup the test
-     */
-    protected void setUp()
-    {
-    }
-
-
-    // CONSTRUCTOR functions --------------------------------------------------
-
-    /**
-     * test an empty DN
-     */
-    public void testLdapDNEmpty() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-
-        Assert.assertEquals( "", ( ( LdapDN ) dnParser.parse( "" ) ).getUpName() );
-    }
-
-
-    /**
-     * test a simple DN : a = b
-     */
-    public void testLdapDNSimple() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-
-        Assert.assertEquals( "a = b", ( ( LdapDN ) dnParser.parse( "a = b" ) ).getUpName() );
-        Assert.assertEquals( "a=b", ( ( LdapDN ) dnParser.parse( "a = b" ) ).toString() );
-    }
-
-
-    /**
-     * test a composite DN : a = b, d = e
-     */
-    public void testLdapDNComposite() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a = b, c = d" );
-        Assert.assertEquals( "a=b,c=d", dn.toString() );
-        Assert.assertEquals( "a = b, c = d", dn.getUpName() );
-    }
-
-
-    /**
-     * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
-     */
-    public void testLdapDNCompositeWithSpace() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a=b, a =b, a= b, a = b, a  =  b" );
-        Assert.assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.toString() );
-        Assert.assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getUpName() );
-    }
-
-
-    /**
-     * test a composite DN with differents separators : a=b;c=d,e=f It should
-     * return a=b,c=d,e=f (the ';' is replaced by a ',')
-     */
-    public void testLdapDNCompositeSepators() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a=b;c=d,e=f" );
-        Assert.assertEquals( "a=b,c=d,e=f", dn.toString() );
-        Assert.assertEquals( "a=b;c=d,e=f", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with multiple NameComponents : a = b + c = d
-     */
-    public void testLdapDNSimpleMultivaluedAttribute() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a = b + c = d" );
-        Assert.assertEquals( "a=b+c=d", dn.toString() );
-        Assert.assertEquals( "a = b + c = d", dn.getUpName() );
-    }
-
-
-    /**
-     * test a composite DN with multiple NC and separators : a=b+c=d, e=f + g=h +
-     * i=j
-     */
-    public void testLdapDNCompositeMultivaluedAttribute() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a=b+c=d, e=f + g=h + i=j" );
-        Assert.assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.toString() );
-        Assert.assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
-     */
-    public void testLdapDNOidUpper() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "OID.12.34.56 = azerty" );
-        Assert.assertEquals( "oid.12.34.56=azerty", dn.toString() );
-        Assert.assertEquals( "OID.12.34.56 = azerty", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
-     */
-    public void testLdapDNOidLower() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "oid.12.34.56 = azerty" );
-        Assert.assertEquals( "oid.12.34.56=azerty", dn.toString() );
-        Assert.assertEquals( "oid.12.34.56 = azerty", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with an oid attribut without oid prefix : 12.34.56 =
-     * azerty
-     */
-    public void testLdapDNOidWithoutPrefix() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "12.34.56 = azerty" );
-        Assert.assertEquals( "12.34.56=azerty", dn.toString() );
-        Assert.assertEquals( "12.34.56 = azerty", dn.getUpName() );
-    }
-
-
-    /**
-     * test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 =
-     * azerty; 7.8 = test
-     */
-    public void testLdapDNCompositeOidWithoutPrefix() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "12.34.56 = azerty; 7.8 = test" );
-        Assert.assertEquals( "12.34.56=azerty,7.8=test", dn.toString() );
-        Assert.assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\A0\00"
-     */
-    public void testLdapDNPairCharAttributeValue() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00" );
-        Assert.assertEquals( "a=\\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", dn.toString() );
-        Assert.assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with hexString attribute value : a = #0010A0AAFF
-     */
-    public void testLdapDNHexStringAttributeValue() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a = #0010A0AAFF" );
-        Assert.assertEquals( "a=#0010A0AAFF", dn.toString() );
-        Assert.assertEquals( "a = #0010A0AAFF", dn.getUpName() );
-    }
-
-
-    /**
-     * test a simple DN with quoted attribute value : a = "quoted \"value"
-     */
-    public void testLdapDNQuotedAttributeValue() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "a = quoted \\\"value" );
-        Assert.assertEquals( "a=quoted \\\"value", dn.toString() );
-        Assert.assertEquals( "a = quoted \\\"value", dn.getUpName() );
-    }
-
-
-    /**
-     * Test the encoding of a LdanDN
-     */
-    public void testNameToBytes() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN dn = ( LdapDN ) dnParser.parse( "cn = John, ou = People, OU = Marketing" );
-
-        byte[] bytes = LdapDN.getBytes( dn );
-
-        Assert.assertEquals( 30, bytes.length );
-        Assert.assertEquals( "cn=John,ou=People,ou=Marketing", StringTools.utf8ToString( bytes ) );
-    }
-
-
-    public void testStringParser() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN name = ( LdapDN ) dnParser.parse( "CN = Emmanuel  Lécharny" );
-
-        Assert.assertEquals( "CN = Emmanuel  Lécharny", name.getUpName() );
-        Assert.assertEquals( "cn=Emmanuel  Lécharny", name.toString() );
-    }
-
-
-    public void testVsldapExtras() throws NamingException
-    {
-        NameParser dnParser = LdapDnParser.getNameParser();
-        LdapDN name = ( LdapDN ) dnParser
-            .parse( "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US" );
-
-        Assert.assertEquals(
-            "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US", name
-                .getUpName() );
-        Assert.assertEquals(
-            "cn=Billy Bakers,oid.2.5.4.11=Corporate Tax,ou=Fin-Accounting,ou=Americas,ou=Search,o=IMC,c=US", name
-                .toString() );
-    }
-
-
-    // ~ Methods
-    // ----------------------------------------------------------------
-
-    /**
-     * Class under test for void DnParser()
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testDnParser() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        assertNotNull( parser );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringEmpty() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameEmpty = parser.parse( "" );
-
-        assertNotNull( nameEmpty );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringNull() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameNull = parser.parse( null );
-
-        assertEquals( "Null DN are legal : ", "", nameNull.toString() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC1779_1() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC1779_1 = parser
-            .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
-
-        assertEquals( "RFC1779_1 : ",
-            "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US",
-            ( ( LdapDN ) nameRFC1779_1 ).getUpName() );
-        assertEquals( "RFC1779_1 : ", "cn=Marshall T. Rose,o=Dover Beach Consulting,l=Santa Clara,st=California,c=US",
-            nameRFC1779_1.toString() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_1() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
-
-        assertEquals( "RFC2253_1 : ", "CN=Steve Kille,O=Isode limited,C=GB", ( ( LdapDN ) nameRFC2253_1 ).getUpName() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_2() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_2 = parser.parse( "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US" );
-
-        assertEquals( "RFC2253_2 : ", "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US",
-            ( ( LdapDN ) nameRFC2253_2 ).getUpName() );
-        assertEquals( "RFC2253_2 : ", "cn=J. Smith+cn=Sales,o=Widget Inc.,c=US", nameRFC2253_2.toString() );
-    }
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_3() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_3 = parser.parse( "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB" );
-
-        assertEquals( "RFC2253_3 : ", "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB", ( ( LdapDN ) nameRFC2253_3 )
-            .getUpName() );
-        assertEquals( "RFC2253_3 : ", "cn=L. Eagle,o=Sue\\, Grabbit and Runn,c=GB", nameRFC2253_3.toString() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_4() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_4 = parser.parse( "CN=Before\\0DAfter,O=Test,C=GB" );
-        assertEquals( "RFC2253_4 : ", "CN=Before\\0DAfter,O=Test,C=GB", ( ( LdapDN ) nameRFC2253_4 ).getUpName() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_5() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_5 = parser.parse( "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB" );
-
-        assertEquals( "RFC2253_5 : ", "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB", ( ( LdapDN ) nameRFC2253_5 )
-            .getUpName() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseStringRFC2253_6() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        Name nameRFC2253_6 = parser.parse( "SN=Lu\\C4\\8Di\\C4\\87" );
-
-        assertEquals( "RFC2253_6 : ", "SN=Lu\\C4\\8Di\\C4\\87", ( ( LdapDN ) nameRFC2253_6 ).getUpName() );
-    }
-
-
-    /**
-     * Class under test for Name parse(String)
-     * 
-     * @throws NamingException
-     *             if anything goes wrong
-     */
-    public final void testParseInvalidString() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-
-        try
-        {
-            parser.parse( "&#347;=&#347;rasulu,dc=example,dc=com" );
-            fail( "the invalid name should never succeed in a parse" );
-        }
-        catch ( Exception e )
-        {
-            assertNotNull( e );
-        }
-    }
-
-
-    /**
-     * Tests to see if inner whitespace is preserved after an escaped ',' in a
-     * value of a name component. This test was added to try to reproduce the
-     * bug encountered in DIREVE-179 <a
-     * href="http://issues.apache.org/jira/browse/DIREVE-179"> here</a>.
-     * 
-     * @throws NamingException
-     *             if anything goes wrong on parse()
-     */
-    public final void testPreserveSpaceAfterEscape() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-        String input = "ou=some test\\,  something else";
-        String result = parser.parse( input ).toString();
-        assertEquals( input, result );
-    }
-
-
-    public void testWindowsFilePath() throws Exception
-    {
-        // '\' should be escaped as stated in RFC 2253
-        String path = "windowsFilePath=C:\\\\cygwin";
-        NameParser parser = LdapDnParser.getNameParser();
-        Name result = parser.parse( path );
-        assertEquals( path, ( ( LdapDN ) result ).getUpName() );
-        assertEquals( "windowsfilepath=C:\\\\cygwin", result.toString() );
-    }
-
-
-    public void testNameFrenchChars() throws Exception
-    {
-        String cn = new String( new byte[]
-            { 'c', 'n', '=', 0x4A, ( byte ) 0xC3, ( byte ) 0xA9, 0x72, ( byte ) 0xC3, ( byte ) 0xB4, 0x6D, 0x65 } );
-
-        NameParser parser = LdapDnParser.getNameParser();
-        String result = parser.parse( cn ).toString();
-
-        assertEquals( cn, result.toString() );
-
-    }
-
-
-    public void testNameGermanChars() throws Exception
-    {
-        String cn = new String( new byte[]
-            { 'c', 'n', '=', ( byte ) 0xC3, ( byte ) 0x84, ( byte ) 0xC3, ( byte ) 0x96, ( byte ) 0xC3, ( byte ) 0x9C,
-                ( byte ) 0xC3, ( byte ) 0x9F, ( byte ) 0xC3, ( byte ) 0xA4, ( byte ) 0xC3, ( byte ) 0xB6,
-                ( byte ) 0xC3, ( byte ) 0xBC }, "UTF-8" );
-
-        NameParser parser = LdapDnParser.getNameParser();
-        String result = parser.parse( cn ).toString();
-
-        assertEquals( cn, result.toString() );
-    }
-
-
-    public void testNameTurkishChars() throws Exception
-    {
-        String cn = new String( new byte[]
-            { 'c', 'n', '=', ( 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 }, "UTF-8" );
-
-        NameParser parser = LdapDnParser.getNameParser();
-        String result = parser.parse( cn ).toString();
-
-        assertEquals( cn, result.toString() );
-
-    }
-
-    /**
-     * Test to check that even with a non escaped char, the DN is parsed ok
-     * or at least an error is generated. 
-     * 
-     * @throws NamingException
-     *             if anything goes wrong on parse()
-     */
-    public final void testNonEscapedChars() throws NamingException
-    {
-        NameParser parser = LdapDnParser.getNameParser();
-        String input = "ou=ou=test";
-        
-        try
-        {
-            parser.parse( input ).toString();
-        }
-        catch ( NamingException ne )
-        {
-            assertTrue( true );
-            return;
-        }
-        
-        fail( "Should never rech this point" );
-    }
+   /**
+    * Setup the test
+    */
+   protected void setUp()
+   {
+   }
+
+
+   // CONSTRUCTOR functions --------------------------------------------------
+
+   /**
+    * test an empty DN
+    */
+   public void testLdapDNEmpty() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+
+       Assert.assertEquals( "", ( ( LdapDN ) dnParser.parse( "" ) ).getUpName() );
+   }
+
+
+   /**
+    * test a simple DN : a = b
+    */
+   public void testLdapDNSimple() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+
+       Assert.assertEquals( "a = b", ( ( LdapDN ) dnParser.parse( "a = b" ) ).getUpName() );
+       Assert.assertEquals( "a=b", ( ( LdapDN ) dnParser.parse( "a = b" ) ).toString() );
+   }
+
+
+   /**
+    * test a composite DN : a = b, d = e
+    */
+   public void testLdapDNComposite() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a = b, c = d" );
+       Assert.assertEquals( "a=b,c=d", dn.toString() );
+       Assert.assertEquals( "a = b, c = d", dn.getUpName() );
+   }
+
+
+   /**
+    * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
+    */
+   public void testLdapDNCompositeWithSpace() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a=b, a =b, a= b, a = b, a  =  b" );
+       Assert.assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.toString() );
+       Assert.assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getUpName() );
+   }
+
+
+   /**
+    * test a composite DN with differents separators : a=b;c=d,e=f It should
+    * return a=b,c=d,e=f (the ';' is replaced by a ',')
+    */
+   public void testLdapDNCompositeSepators() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a=b;c=d,e=f" );
+       Assert.assertEquals( "a=b,c=d,e=f", dn.toString() );
+       Assert.assertEquals( "a=b;c=d,e=f", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with multiple NameComponents : a = b + c = d
+    */
+   public void testLdapDNSimpleMultivaluedAttribute() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a = b + c = d" );
+       Assert.assertEquals( "a=b+c=d", dn.toString() );
+       Assert.assertEquals( "a = b + c = d", dn.getUpName() );
+   }
+
+
+   /**
+    * test a composite DN with multiple NC and separators : a=b+c=d, e=f + g=h +
+    * i=j
+    */
+   public void testLdapDNCompositeMultivaluedAttribute() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a=b+c=d, e=f + g=h + i=j" );
+       Assert.assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.toString() );
+       Assert.assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
+    */
+   public void testLdapDNOidUpper() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "OID.12.34.56 = azerty" );
+       Assert.assertEquals( "oid.12.34.56=azerty", dn.toString() );
+       Assert.assertEquals( "OID.12.34.56 = azerty", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
+    */
+   public void testLdapDNOidLower() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "oid.12.34.56 = azerty" );
+       Assert.assertEquals( "oid.12.34.56=azerty", dn.toString() );
+       Assert.assertEquals( "oid.12.34.56 = azerty", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with an oid attribut without oid prefix : 12.34.56 =
+    * azerty
+    */
+   public void testLdapDNOidWithoutPrefix() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "12.34.56 = azerty" );
+       Assert.assertEquals( "12.34.56=azerty", dn.toString() );
+       Assert.assertEquals( "12.34.56 = azerty", dn.getUpName() );
+   }
+
+
+   /**
+    * test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 =
+    * azerty; 7.8 = test
+    */
+   public void testLdapDNCompositeOidWithoutPrefix() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "12.34.56 = azerty; 7.8 = test" );
+       Assert.assertEquals( "12.34.56=azerty,7.8=test", dn.toString() );
+       Assert.assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
+    */
+   public void testLdapDNPairCharAttributeValue() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       String expected = StringTools.utf8ToString( new byte[]{'a', '=', ',', '=', '+', '<', '>', '#', ';', '\\', '"', (byte)0xC3, (byte)0xA9});
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" );
+       Assert.assertEquals( expected, dn.toString() );
+       Assert.assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with hexString attribute value : a = #0010A0AAFF
+    */
+   public void testLdapDNHexStringAttributeValue() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a = #0010A0AAFF" );
+       Assert.assertEquals( "a=#0010A0AAFF", dn.toString() );
+       Assert.assertEquals( "a = #0010A0AAFF", dn.getUpName() );
+   }
+
+
+   /**
+    * test a simple DN with quoted attribute value : a = "quoted \"value"
+    */
+   public void testLdapDNQuotedAttributeValue() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "a = quoted \\\"value" );
+       Assert.assertEquals( "a=quoted \"value", dn.toString() );
+       Assert.assertEquals( "a = quoted \\\"value", dn.getUpName() );
+   }
+
+
+   /**
+    * Test the encoding of a LdanDN
+    */
+   public void testNameToBytes() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN dn = ( LdapDN ) dnParser.parse( "cn = John, ou = People, OU = Marketing" );
+
+       byte[] bytes = LdapDN.getBytes( dn );
+
+       Assert.assertEquals( 30, bytes.length );
+       Assert.assertEquals( "cn=John,ou=People,ou=Marketing", StringTools.utf8ToString( bytes ) );
+   }
+
+
+   public void testStringParser() throws NamingException
+   {
+       String dn = StringTools.utf8ToString( new byte[]{'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 
+           'l', ' ', ' ', 'L', (byte)0xc3, (byte)0xa9, 'c', 'h', 'a', 'r', 'n', 'y'} );
+
+       String expected = StringTools.utf8ToString( new byte[]{'c', 'n', '=','E', 'm', 'm', 'a', 'n', 'u', 'e', 
+           'l', ' ', ' ', 'L', (byte)0xc3, (byte)0xa9, 'c', 'h', 'a', 'r', 'n', 'y'} );
+
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN name = ( LdapDN ) dnParser.parse( dn );
+
+       Assert.assertEquals( dn, name.getUpName() );
+       Assert.assertEquals( expected, name.toString() );
+   }
+
+
+   public void testVsldapExtras() throws NamingException
+   {
+       NameParser dnParser = LdapDnParser.getNameParser();
+       LdapDN name = ( LdapDN ) dnParser
+           .parse( "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US" );
+
+       Assert.assertEquals(
+           "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US", name
+               .getUpName() );
+       Assert.assertEquals(
+           "cn=Billy Bakers,oid.2.5.4.11=Corporate Tax,ou=Fin-Accounting,ou=Americas,ou=Search,o=IMC,c=US", name
+               .toString() );
+   }
+
+
+   // ~ Methods
+   // ----------------------------------------------------------------
+
+   /**
+    * Class under test for void DnParser()
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testDnParser() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       assertNotNull( parser );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringEmpty() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameEmpty = parser.parse( "" );
+
+       assertNotNull( nameEmpty );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringNull() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameNull = parser.parse( null );
+
+       assertEquals( "Null DN are legal : ", "", nameNull.toString() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC1779_1() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC1779_1 = parser
+           .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
+
+       assertEquals( "RFC1779_1 : ",
+           "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US",
+           ( ( LdapDN ) nameRFC1779_1 ).getUpName() );
+       assertEquals( "RFC1779_1 : ", "cn=Marshall T. Rose,o=Dover Beach Consulting,l=Santa Clara,st=California,c=US",
+           nameRFC1779_1.toString() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_1() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
+
+       assertEquals( "RFC2253_1 : ", "CN=Steve Kille,O=Isode limited,C=GB", ( ( LdapDN ) nameRFC2253_1 ).getUpName() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_2() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_2 = parser.parse( "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US" );
+
+       assertEquals( "RFC2253_2 : ", "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US",
+           ( ( LdapDN ) nameRFC2253_2 ).getUpName() );
+       assertEquals( "RFC2253_2 : ", "cn=J. Smith+cn=Sales,o=Widget Inc.,c=US", nameRFC2253_2.toString() );
+   }
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_3() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_3 = parser.parse( "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB" );
+
+       assertEquals( "RFC2253_3 : ", "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB", ( ( LdapDN ) nameRFC2253_3 )
+           .getUpName() );
+       assertEquals( "RFC2253_3 : ", "cn=L. Eagle,o=Sue, Grabbit and Runn,c=GB", nameRFC2253_3.toString() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_4() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_4 = parser.parse( "CN=Before\\0DAfter,O=Test,C=GB" );
+       assertEquals( "RFC2253_4 : ", "CN=Before\\0DAfter,O=Test,C=GB", ( ( LdapDN ) nameRFC2253_4 ).getUpName() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_5() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_5 = parser.parse( "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB" );
+
+       assertEquals( "RFC2253_5 : ", "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB", ( ( LdapDN ) nameRFC2253_5 )
+           .getUpName() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseStringRFC2253_6() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       Name nameRFC2253_6 = parser.parse( "SN=Lu\\C4\\8Di\\C4\\87" );
+
+       assertEquals( "RFC2253_6 : ", "SN=Lu\\C4\\8Di\\C4\\87", ( ( LdapDN ) nameRFC2253_6 ).getUpName() );
+   }
+
+
+   /**
+    * Class under test for Name parse(String)
+    *
+    * @throws NamingException
+    *             if anything goes wrong
+    */
+   public final void testParseInvalidString() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+
+       try
+       {
+           parser.parse( "&#347;=&#347;rasulu,dc=example,dc=com" );
+           fail( "the invalid name should never succeed in a parse" );
+       }
+       catch ( Exception e )
+       {
+           assertNotNull( e );
+       }
+   }
+
+
+   /**
+    * Tests to see if inner whitespace is preserved after an escaped ',' in a
+    * value of a name component. This test was added to try to reproduce the
+    * bug encountered in DIREVE-179 <a
+    * href="http://issues.apache.org/jira/browse/DIREVE-179"> here</a>.
+    *
+    * @throws NamingException
+    *             if anything goes wrong on parse()
+    */
+   public final void testPreserveSpaceAfterEscape() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+       String input = "ou=some test\\,  something else";
+       String result = parser.parse( input ).toString();
+       assertEquals( "ou=some test,  something else", result );
+   }
+
+
+   public void testWindowsFilePath() throws Exception
+   {
+       // '\' should be escaped as stated in RFC 2253
+       String path = "windowsFilePath=C:\\\\cygwin";
+       NameParser parser = LdapDnParser.getNameParser();
+       Name result = parser.parse( path );
+       assertEquals( path, ( ( LdapDN ) result ).getUpName() );
+       assertEquals( "windowsfilepath=C:\\cygwin", result.toString() );
+   }
+
+
+   public void testNameFrenchChars() throws Exception
+   {
+       String cn = new String( new byte[]
+           { 'c', 'n', '=', 0x4A, ( byte ) 0xC3, ( byte ) 0xA9, 0x72, ( byte ) 0xC3, ( byte ) 0xB4, 0x6D, 0x65 } );
+
+       NameParser parser = LdapDnParser.getNameParser();
+       String result = parser.parse( cn ).toString();
+
+       assertEquals( cn, result.toString() );
+
+   }
+
+
+   public void testNameGermanChars() throws Exception
+   {
+       String cn = new String( new byte[]
+           { 'c', 'n', '=', ( byte ) 0xC3, ( byte ) 0x84, ( byte ) 0xC3, ( byte ) 0x96, ( byte ) 0xC3, ( byte ) 0x9C,
+               ( byte ) 0xC3, ( byte ) 0x9F, ( byte ) 0xC3, ( byte ) 0xA4, ( byte ) 0xC3, ( byte ) 0xB6,
+               ( byte ) 0xC3, ( byte ) 0xBC }, "UTF-8" );
+
+       NameParser parser = LdapDnParser.getNameParser();
+       String result = parser.parse( cn ).toString();
+
+       assertEquals( cn, result.toString() );
+   }
+
+
+   public void testNameTurkishChars() throws Exception
+   {
+       String cn = new String( new byte[]
+           { 'c', 'n', '=', ( 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 }, "UTF-8" );
+
+       NameParser parser = LdapDnParser.getNameParser();
+       String result = parser.parse( cn ).toString();
+
+       assertEquals( cn, result.toString() );
+
+   }
+
+   /**
+    * Test to check that even with a non escaped char, the DN is parsed ok
+    * or at least an error is generated.
+    *
+    * @throws NamingException
+    *             if anything goes wrong on parse()
+    */
+   public final void testNonEscapedChars() throws NamingException
+   {
+       NameParser parser = LdapDnParser.getNameParser();
+       String input = "ou=ou=test";
+
+       try
+       {
+           parser.parse( input ).toString();
+       }
+       catch ( NamingException ne )
+       {
+           assertTrue( true );
+           return;
+       }
+
+       fail( "Should never rech this point" );
+   }
 
 }

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=433029&r1=433028&r2=433029&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java Sun Aug 20 13:25:11 2006
@@ -32,469 +32,470 @@
 
 /**
  * Test the class Rdn
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class RdnTest extends TestCase
 {
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
+   // ~ Methods
+   // ------------------------------------------------------------------------------------
 
-    /**
-     * Setup the test
-     */
-    protected void setUp()
-    {
-    }
+   /**
+    * Setup the test
+    */
+   protected void setUp()
+   {
+   }
 
 
-    /**
-     * Test a null RDN
-     */
-    public void testRdnNull() throws InvalidNameException
-    {
-        Assert.assertEquals( "", new Rdn().toString() );
-    }
+   /**
+    * Test a null RDN
+    */
+   public void testRdnNull() throws InvalidNameException
+   {
+       Assert.assertEquals( "", new Rdn().toString() );
+   }
 
 
-    /**
-     * test an empty RDN
-     */
-    public void testRdnEmpty() throws InvalidNameException
-    {
-        Assert.assertEquals( "", new Rdn( "" ).toString() );
-    }
+   /**
+    * test an empty RDN
+    */
+   public void testRdnEmpty() throws InvalidNameException
+   {
+       Assert.assertEquals( "", new Rdn( "" ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN : a = b
-     */
-    public void testRdnSimple() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=b", new Rdn( "a = b" ).toString() );
-    }
+   /**
+    * test a simple RDN : a = b
+    */
+   public void testRdnSimple() throws InvalidNameException
+   {
+       Assert.assertEquals( "a=b", new Rdn( "a = b" ).toString() );
+   }
 
 
-    /**
-     * test a composite RDN : a = b, d = e
-     */
-    public void testRdnComposite() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=b+c=d", new Rdn( "a = b + c = d" ).toString() );
-    }
+   /**
+    * test a composite RDN : a = b, d = e
+    */
+   public void testRdnComposite() throws InvalidNameException
+   {
+       Assert.assertEquals( "a=b+c=d", new Rdn( "a = b + c = d" ).toString() );
+   }
 
 
-    /**
-     * test a composite RDN with or without spaces: a=b, a =b, a= b, a = b, a =
-     * b
-     */
-    public void testRdnCompositeWithSpace() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=b", new Rdn( "a=b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a=b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a =b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a= b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a=b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a =b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a= b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a=b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a = b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a =b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a= b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a = b" ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a =b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a= b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( "a = b " ).toString() );
-        Assert.assertEquals( "a=b", new Rdn( " a = b " ).toString() );
-    }
+   /**
+    * test a composite RDN with or without spaces: a=b, a =b, a= b, a = b, a =
+    * b
+    */
+   public void testRdnCompositeWithSpace() throws InvalidNameException
+   {
+       Assert.assertEquals( "a=b", new Rdn( "a=b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a=b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a =b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a= b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a=b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a =b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a= b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a=b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a = b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a =b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a= b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a = b" ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a =b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a= b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( "a = b " ).toString() );
+       Assert.assertEquals( "a=b", new Rdn( " a = b " ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN with differents separators : a = b + c = d
-     */
-    public void testRdnSimpleMultivaluedAttribute() throws InvalidNameException
-    {
-        String result = new Rdn( "a = b + c = d" ).toString();
-        Assert.assertEquals( "a=b+c=d", result );
-    }
+   /**
+    * test a simple RDN with differents separators : a = b + c = d
+    */
+   public void testRdnSimpleMultivaluedAttribute() throws InvalidNameException
+   {
+       String result = new Rdn( "a = b + c = d" ).toString();
+       Assert.assertEquals( "a=b+c=d", result );
+   }
 
 
-    /**
-     * test a composite RDN with differents separators : a=b+c=d, e=f + g=h +
-     * i=j
-     */
-    public void testRdnCompositeMultivaluedAttribute() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( "a =b+c=d + e=f + g  =h + i =j " );
+   /**
+    * test a composite RDN with differents separators : a=b+c=d, e=f + g=h +
+    * i=j
+    */
+   public void testRdnCompositeMultivaluedAttribute() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( "a =b+c=d + e=f + g  =h + i =j " );
 
-        // NameComponent are not ordered
-        Assert.assertEquals( "b", rdn.getValue( "a" ) );
-        Assert.assertEquals( "d", rdn.getValue( "c" ) );
-        Assert.assertEquals( "f", rdn.getValue( "  E  " ) );
-        Assert.assertEquals( "h", rdn.getValue( "g" ) );
-        Assert.assertEquals( "j", rdn.getValue( "i" ) );
-    }
+       // NameComponent are not ordered
+       Assert.assertEquals( "b", rdn.getValue( "a" ) );
+       Assert.assertEquals( "d", rdn.getValue( "c" ) );
+       Assert.assertEquals( "f", rdn.getValue( "  E  " ) );
+       Assert.assertEquals( "h", rdn.getValue( "g" ) );
+       Assert.assertEquals( "j", rdn.getValue( "i" ) );
+   }
 
 
-    /**
-     * test a simple RDN with an oid prefix (uppercase) : OID.12.34.56 = azerty
-     */
-    public void testRdnOidUpper() throws InvalidNameException
-    {
-        Assert.assertEquals( "oid.12.34.56=azerty", new Rdn( "OID.12.34.56 =  azerty" ).toString() );
-    }
+   /**
+    * test a simple RDN with an oid prefix (uppercase) : OID.12.34.56 = azerty
+    */
+   public void testRdnOidUpper() throws InvalidNameException
+   {
+       Assert.assertEquals( "oid.12.34.56=azerty", new Rdn( "OID.12.34.56 =  azerty" ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN with an oid prefix (lowercase) : oid.12.34.56 = azerty
-     */
-    public void testRdnOidLower() throws InvalidNameException
-    {
-        Assert.assertEquals( "oid.12.34.56=azerty", new Rdn( "oid.12.34.56 = azerty" ).toString() );
-    }
+   /**
+    * test a simple RDN with an oid prefix (lowercase) : oid.12.34.56 = azerty
+    */
+   public void testRdnOidLower() throws InvalidNameException
+   {
+       Assert.assertEquals( "oid.12.34.56=azerty", new Rdn( "oid.12.34.56 = azerty" ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN with an oid attribut wiithout oid prefix : 12.34.56 =
-     * azerty
-     */
-    public void testRdnOidWithoutPrefix() throws InvalidNameException
-    {
-        Assert.assertEquals( "12.34.56=azerty", new Rdn( "12.34.56 = azerty" ).toString() );
-    }
+   /**
+    * test a simple RDN with an oid attribut wiithout oid prefix : 12.34.56 =
+    * azerty
+    */
+   public void testRdnOidWithoutPrefix() throws InvalidNameException
+   {
+       Assert.assertEquals( "12.34.56=azerty", new Rdn( "12.34.56 = azerty" ).toString() );
+   }
 
 
-    /**
-     * test a composite RDN with an oid attribut wiithout oid prefix : 12.34.56 =
-     * azerty; 7.8 = test
-     */
-    public void testRdnCompositeOidWithoutPrefix() throws InvalidNameException
-    {
-        String result = new Rdn( "12.34.56 = azerty + 7.8 = test" ).toString();
-        Assert.assertEquals( "12.34.56=azerty+7.8=test", result );
-    }
+   /**
+    * test a composite RDN with an oid attribut wiithout oid prefix : 12.34.56 =
+    * azerty; 7.8 = test
+    */
+   public void testRdnCompositeOidWithoutPrefix() throws InvalidNameException
+   {
+       String result = new Rdn( "12.34.56 = azerty + 7.8 = test" ).toString();
+       Assert.assertEquals( "12.34.56=azerty+7.8=test", result );
+   }
 
 
-    /**
-     * test a simple RDN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\A0\00"
-     */
-    public void testRdnPairCharAttributeValue() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=\\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", new Rdn(
-            "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00" ).toString() );
-    }
+   /**
+    * test a simple RDN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
+    */
+   public void testRdnPairCharAttributeValue() throws InvalidNameException
+   {
+       String rdn = StringTools.utf8ToString( new byte[]{'a', '=', ',', '=', '+', '<', '>', '#', ';', '\\', '"', (byte)0xC3, (byte)0xA9});
+       Assert.assertEquals( rdn, new Rdn(
+           "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN with hexString attribute value : a = #0010A0AAFF
-     */
-    public void testRdnHexStringAttributeValue() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=#0010A0AAFF", new Rdn( "a = #0010A0AAFF" ).toString() );
-    }
+   /**
+    * test a simple RDN with hexString attribute value : a = #0010A0AAFF
+    */
+   public void testRdnHexStringAttributeValue() throws InvalidNameException
+   {
+       Assert.assertEquals( "a=#0010A0AAFF", new Rdn( "a = #0010A0AAFF" ).toString() );
+   }
 
 
-    /**
-     * test a simple RDN with quoted attribute value : a = "quoted \"value"
-     */
-    public void testRdnQuotedAttributeValue() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=quoted \\\"value", new Rdn( "a = quoted \\\"value" ).toString() );
-    }
+   /**
+    * test a simple RDN with quoted attribute value : a = "quoted \"value"
+    */
+   public void testRdnQuotedAttributeValue() throws InvalidNameException
+   {
+       Assert.assertEquals( "a=quoted \"value", new Rdn( "a = quoted \\\"value" ).toString() );
+   }
 
 
-    /**
-     * Test the clone method for a RDN.
-     */
-    public void testRDNCloningOneNameComponent() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( "a", "b" );
+   /**
+    * Test the clone method for a RDN.
+    */
+   public void testRDNCloningOneNameComponent() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( "a", "b" );
 
-        Rdn rdnClone = ( Rdn ) rdn.clone();
+       Rdn rdnClone = ( Rdn ) rdn.clone();
 
-        RdnParser.parse( "c=d", rdn );
+       RdnParser.parse( "c=d", rdn );
 
-        Assert.assertEquals( "b", rdnClone.getValue( "a" ) );
-    }
+       Assert.assertEquals( "b", rdnClone.getValue( "a" ) );
+   }
 
 
-    /**
-     * Test the clone method for a RDN.
-     */
-    public void testRDNCloningTwoNameComponent() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( "a = b + aa = bb" );
+   /**
+    * Test the clone method for a RDN.
+    */
+   public void testRDNCloningTwoNameComponent() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( "a = b + aa = bb" );
 
-        Rdn rdnClone = ( Rdn ) rdn.clone();
+       Rdn rdnClone = ( Rdn ) rdn.clone();
 
-        rdn.clear();
-        RdnParser.parse( "c=d", rdn );
+       rdn.clear();
+       RdnParser.parse( "c=d", rdn );
 
-        Assert.assertEquals( "b", rdnClone.getValue( "a" ) );
-        Assert.assertEquals( "bb", rdnClone.getValue( "aa" ) );
-        Assert.assertEquals( "", rdnClone.getValue( "c" ) );
-    }
+       Assert.assertEquals( "b", rdnClone.getValue( "a" ) );
+       Assert.assertEquals( "bb", rdnClone.getValue( "aa" ) );
+       Assert.assertEquals( "", rdnClone.getValue( "c" ) );
+   }
 
 
-    /**
-     * Test the compareTo method for a RDN.
-     */
-    public void testRDNCompareToNull() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
-        Rdn rdn2 = null;
-        Assert.assertEquals( 1, rdn1.compareTo( rdn2 ) );
-    }
+   /**
+    * Test the compareTo method for a RDN.
+    */
+   public void testRDNCompareToNull() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
+       Rdn rdn2 = null;
+       Assert.assertEquals( 1, rdn1.compareTo( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a composite NC to a single NC.
-     */
-    public void testRDNCompareToNCS2NC() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
-        Rdn rdn2 = new Rdn( " a = b " );
-        Assert.assertTrue( rdn1.compareTo( rdn2 ) > 0 );
-    }
+   /**
+    * Compares a composite NC to a single NC.
+    */
+   public void testRDNCompareToNCS2NC() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
+       Rdn rdn2 = new Rdn( " a = b " );
+       Assert.assertTrue( rdn1.compareTo( rdn2 ) > 0 );
+   }
 
 
-    /**
-     * Compares a single NC to a composite NC.
-     */
-    public void testRDNCompareToNC2NCS() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b " );
-        Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
+   /**
+    * Compares a single NC to a composite NC.
+    */
+   public void testRDNCompareToNC2NCS() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b " );
+       Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        Assert.assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-    }
+       Assert.assertTrue( rdn1.compareTo( rdn2 ) < 0 );
+   }
 
 
-    /**
-     * Compares a composite NCS to a composite NCS in the same order.
-     */
-    public void testRDNCompareToNCS2NCSOrdered() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
-        Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
+   /**
+    * Compares a composite NCS to a composite NCS in the same order.
+    */
+   public void testRDNCompareToNCS2NCSOrdered() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b + c = d + a = f + g = h " );
+       Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
-    }
+       Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a composite NCS to a composite NCS in a different order.
-     */
-    public void testRDNCompareToNCS2NCSUnordered() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b + a = f + g = h + c = d " );
-        Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
+   /**
+    * Compares a composite NCS to a composite NCS in a different order.
+    */
+   public void testRDNCompareToNCS2NCSUnordered() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b + a = f + g = h + c = d " );
+       Rdn rdn2 = new Rdn( " a = b + c = d + a = f + g = h " );
 
-        Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
-    }
+       Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a composite NCS to a different composite NCS.
-     */
-    public void testRDNCompareToNCS2NCSNotEquals() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = f + g = h + c = d " );
-        Rdn rdn2 = new Rdn( " c = d + a = h + g = h " );
+   /**
+    * Compares a composite NCS to a different composite NCS.
+    */
+   public void testRDNCompareToNCS2NCSNotEquals() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = f + g = h + c = d " );
+       Rdn rdn2 = new Rdn( " c = d + a = h + g = h " );
 
-        Assert.assertEquals( -1, rdn1.compareTo( rdn2 ) );
-    }
+       Assert.assertEquals( -1, rdn1.compareTo( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a simple NC to a simple NC.
-     */
-    public void testRDNCompareToNC2NC() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b " );
-        Rdn rdn2 = new Rdn( " a = b " );
+   /**
+    * Compares a simple NC to a simple NC.
+    */
+   public void testRDNCompareToNC2NC() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b " );
+       Rdn rdn2 = new Rdn( " a = b " );
 
-        Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
-    }
+       Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a simple NC to a simple NC in UperCase.
-     */
-    public void testRDNCompareToNC2NCUperCase() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b " );
-        Rdn rdn2 = new Rdn( " A = b " );
+   /**
+    * Compares a simple NC to a simple NC in UperCase.
+    */
+   public void testRDNCompareToNC2NCUperCase() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b " );
+       Rdn rdn2 = new Rdn( " A = b " );
 
-        Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
-        Assert.assertEquals( true, rdn1.equals( rdn2 ) );
-    }
+       Assert.assertEquals( 0, rdn1.compareTo( rdn2 ) );
+       Assert.assertEquals( true, rdn1.equals( rdn2 ) );
+   }
 
 
-    /**
-     * Compares a simple NC to a different simple NC.
-     */
-    public void testRDNCompareToNC2NCNotEquals() throws InvalidNameException
-    {
-        Rdn rdn1 = new Rdn( " a = b " );
-        Rdn rdn2 = new Rdn( " A = d " );
+   /**
+    * Compares a simple NC to a different simple NC.
+    */
+   public void testRDNCompareToNC2NCNotEquals() throws InvalidNameException
+   {
+       Rdn rdn1 = new Rdn( " a = b " );
+       Rdn rdn2 = new Rdn( " A = d " );
 
-        Assert.assertTrue( rdn1.compareTo( rdn2 ) < 0 );
-    }
+       Assert.assertTrue( rdn1.compareTo( rdn2 ) < 0 );
+   }
 
 
-    public void testToAttributes() throws InvalidNameException, NamingException
-    {
-        Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
+   public void testToAttributes() throws InvalidNameException, NamingException
+   {
+       Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
 
-        Attributes attributes = rdn.toAttributes();
+       Attributes attributes = rdn.toAttributes();
 
-        Assert.assertNotNull( attributes.get( "a" ) );
-        Assert.assertNotNull( attributes.get( "g" ) );
-        Assert.assertNotNull( attributes.get( "c" ) );
+       Assert.assertNotNull( attributes.get( "a" ) );
+       Assert.assertNotNull( attributes.get( "g" ) );
+       Assert.assertNotNull( attributes.get( "c" ) );
 
-        Attribute attribute = attributes.get( "a" );
+       Attribute attribute = attributes.get( "a" );
 
-        Assert.assertNotNull( attribute.get( 0 ) );
-        Assert.assertEquals( "b", attribute.get( 0 ) );
+       Assert.assertNotNull( attribute.get( 0 ) );
+       Assert.assertEquals( "b", attribute.get( 0 ) );
 
-        Assert.assertNotNull( attribute.get( 1 ) );
-        Assert.assertEquals( "f", attribute.get( 1 ) );
+       Assert.assertNotNull( attribute.get( 1 ) );
+       Assert.assertEquals( "f", attribute.get( 1 ) );
 
-        attribute = attributes.get( "g" );
-        Assert.assertNotNull( attribute.get( 0 ) );
-        Assert.assertEquals( "h", attribute.get( 0 ) );
+       attribute = attributes.get( "g" );
+       Assert.assertNotNull( attribute.get( 0 ) );
+       Assert.assertEquals( "h", attribute.get( 0 ) );
 
-        attribute = attributes.get( "c" );
-        Assert.assertNotNull( attribute.get( 0 ) );
-        Assert.assertEquals( "d", attribute.get( 0 ) );
-    }
+       attribute = attributes.get( "c" );
+       Assert.assertNotNull( attribute.get( 0 ) );
+       Assert.assertEquals( "d", attribute.get( 0 ) );
+   }
 
 
-    public void testGetValue() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
+   public void testGetValue() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
 
-        Assert.assertEquals( "b", rdn.getValue() );
-    }
+       Assert.assertEquals( "b", rdn.getValue() );
+   }
 
 
-    public void testGetType() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
+   public void testGetType() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
 
-        Assert.assertEquals( "a", rdn.getType() );
-    }
+       Assert.assertEquals( "a", rdn.getType() );
+   }
 
 
-    public void testGetSize() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
+   public void testGetSize() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( " a = b + a = f + g = h + c = d " );
 
-        Assert.assertEquals( 4, rdn.size() );
-    }
+       Assert.assertEquals( 4, rdn.size() );
+   }
 
 
-    public void testGetSize0() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn();
+   public void testGetSize0() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn();
 
-        Assert.assertEquals( 0, rdn.size() );
-    }
+       Assert.assertEquals( 0, rdn.size() );
+   }
 
 
-    public void testEquals() throws InvalidNameException
-    {
-        Rdn rdn = new Rdn( "a=b + c=d + a=f" );
+   public void testEquals() throws InvalidNameException
+   {
+       Rdn rdn = new Rdn( "a=b + c=d + a=f" );
 
-        Assert.assertFalse( rdn.equals( null ) );
-        Assert.assertFalse( rdn.equals( new String( "test" ) ) );
-        Assert.assertFalse( rdn.equals( new Rdn( "a=c + c=d + a=f" ) ) );
-        Assert.assertFalse( rdn.equals( new Rdn( "a=b" ) ) );
-        Assert.assertTrue( rdn.equals( new Rdn( "a=b + c=d + a=f" ) ) );
-        Assert.assertTrue( rdn.equals( new Rdn( "a=b + C=d + A=f" ) ) );
-        Assert.assertTrue( rdn.equals( new Rdn( "c=d + a=f + a=b" ) ) );
-    }
+       Assert.assertFalse( rdn.equals( null ) );
+       Assert.assertFalse( rdn.equals( new String( "test" ) ) );
+       Assert.assertFalse( rdn.equals( new Rdn( "a=c + c=d + a=f" ) ) );
+       Assert.assertFalse( rdn.equals( new Rdn( "a=b" ) ) );
+       Assert.assertTrue( rdn.equals( new Rdn( "a=b + c=d + a=f" ) ) );
+       Assert.assertTrue( rdn.equals( new Rdn( "a=b + C=d + A=f" ) ) );
+       Assert.assertTrue( rdn.equals( new Rdn( "c=d + a=f + a=b" ) ) );
+   }
 
 
-    public void testUnescapeValueHexa() throws InvalidNameException
-    {
-        byte[] res = ( byte[] ) Rdn.unescapeValue( "#fF" );
+   public void testUnescapeValueHexa() throws InvalidNameException
+   {
+       byte[] res = ( byte[] ) Rdn.unescapeValue( "#fF" );
 
-        Assert.assertEquals( "0xFF ", StringTools.dumpBytes( res ) );
+       Assert.assertEquals( "0xFF ", StringTools.dumpBytes( res ) );
 
-        res = ( byte[] ) Rdn.unescapeValue( "#0123456789aBCDEF" );
-        Assert.assertEquals( "0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF ", StringTools.dumpBytes( res ) );
-    }
+       res = ( byte[] ) Rdn.unescapeValue( "#0123456789aBCDEF" );
+       Assert.assertEquals( "0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF ", StringTools.dumpBytes( res ) );
+   }
 
 
-    public void testUnescapeValueHexaWrong() throws InvalidNameException
-    {
-        try
-        {
-            Rdn.unescapeValue( "#fF1" );
-            Assert.fail(); // Should not happen
-        }
-        catch ( IllegalArgumentException iae )
-        {
-            Assert.assertTrue( true );
-        }
-    }
+   public void testUnescapeValueHexaWrong() throws InvalidNameException
+   {
+       try
+       {
+           Rdn.unescapeValue( "#fF1" );
+           Assert.fail(); // Should not happen
+       }
+       catch ( IllegalArgumentException iae )
+       {
+           Assert.assertTrue( true );
+       }
+   }
 
 
-    public void testUnescapeValueString() throws InvalidNameException
-    {
-        String res = ( String ) Rdn.unescapeValue( "azerty" );
+   public void testUnescapeValueString() throws InvalidNameException
+   {
+       String res = ( String ) Rdn.unescapeValue( "azerty" );
 
-        Assert.assertEquals( "azerty", res );
-    }
+       Assert.assertEquals( "azerty", res );
+   }
 
 
-    public void testUnescapeValueStringSpecial() throws InvalidNameException
-    {
-        String res = ( String ) Rdn.unescapeValue( "\\\\\\#\\,\\+\\;\\<\\>\\=\\\"\\ " );
+   public void testUnescapeValueStringSpecial() throws InvalidNameException
+   {
+       String res = ( String ) Rdn.unescapeValue( "\\\\\\#\\,\\+\\;\\<\\>\\=\\\"\\ " );
 
-        Assert.assertEquals( "\\#,+;<>=\" ", res );
-    }
+       Assert.assertEquals( "\\#,+;<>=\" ", res );
+   }
 
 
-    public void testEscapeValueString() throws InvalidNameException
-    {
-        String res = Rdn.escapeValue( StringTools.getBytesUtf8( "azerty" ) );
+   public void testEscapeValueString() throws InvalidNameException
+   {
+       String res = Rdn.escapeValue( StringTools.getBytesUtf8( "azerty" ) );
 
-        Assert.assertEquals( "azerty", res );
-    }
+       Assert.assertEquals( "azerty", res );
+   }
 
 
-    public void testEscapeValueStringSpecial() throws InvalidNameException
-    {
-        String res = Rdn.escapeValue( StringTools.getBytesUtf8( "\\#,+;<>=\" " ) );
+   public void testEscapeValueStringSpecial() throws InvalidNameException
+   {
+       String res = Rdn.escapeValue( StringTools.getBytesUtf8( "\\#,+;<>=\" " ) );
 
-        Assert.assertEquals( "\\\\\\#\\,\\+\\;\\<\\>\\=\\\"\\ ", res );
-    }
+       Assert.assertEquals( "\\\\\\#\\,\\+\\;\\<\\>\\=\\\"\\ ", res );
+   }
 
 
-    public void testEscapeValueNumeric() throws InvalidNameException
-    {
-        String res = Rdn.escapeValue( new byte[]
-            { '-', 0x00, '-', 0x1F, '-', 0x7F, '-' } );
+   public void testEscapeValueNumeric() throws InvalidNameException
+   {
+       String res = Rdn.escapeValue( new byte[]
+           { '-', 0x00, '-', 0x1F, '-', 0x7F, '-' } );
 
-        Assert.assertEquals( "-\\00-\\1F-\\7F-", res );
-    }
+       Assert.assertEquals( "-\\00-\\1F-\\7F-", res );
+   }
 
 
-    public void testEscapeValueMix() throws InvalidNameException
-    {
-        String res = Rdn.escapeValue( new byte[]
-            { '\\', 0x00, '-', '+', '#', 0x7F, '-' } );
+   public void testEscapeValueMix() throws InvalidNameException
+   {
+       String res = Rdn.escapeValue( new byte[]
+           { '\\', 0x00, '-', '+', '#', 0x7F, '-' } );
 
-        Assert.assertEquals( "\\\\\\00-\\+\\#\\7F-", res );
-    }
+       Assert.assertEquals( "\\\\\\00-\\+\\#\\7F-", res );
+   }
 
-    
-    public void testDIRSERVER_703() throws InvalidNameException 
+
+    public void testDIRSERVER_703() throws InvalidNameException
     {
-    	Rdn rdn = new Rdn( "cn=Kate Bush+sn=Bush" );
-    	assertEquals( "cn=Kate Bush+sn=Bush", rdn.getUpName() );
-	}
+        Rdn rdn = new Rdn( "cn=Kate Bush+sn=Bush" );
+        assertEquals( "cn=Kate Bush+sn=Bush", rdn.getUpName() );
+    }
 }