directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r159174 - directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
Date Sun, 27 Mar 2005 18:43:26 GMT
Author: elecharny
Date: Sun Mar 27 10:43:26 2005
New Revision: 159174

URL: http://svn.apache.org/viewcvs?view=rev&rev=159174
Log:
A first working version of the new ASN.1 LDAP decoder.

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java?view=diff&r1=159173&r2=159174
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
Sun Mar 27 10:43:26 2005
@@ -28,6 +28,14 @@
  */
 public class LdapDNTest extends TestCase
 {
+	private char[] getChars(String value)
+	{
+		char[] charArray = new char[value.length()];
+		
+		value.getChars(0, value.length(), charArray, 0);
+		return charArray;
+	}
+	
     /**
      * Test a null DN
      */
@@ -41,15 +49,7 @@
      */
     public void testLdapDNEmpty() throws DecoderException
     {
-        Assert.assertEquals("", LdapDN.parseDN("".getBytes()) );
-    }
-	
-    /**
-     * test an empty DN
-     */
-    public void testLdapDN() throws DecoderException
-    {
-        Assert.assertEquals("", LdapDN.parseDN("".getBytes()) );
+        Assert.assertEquals("", LdapDN.parseDN(getChars("")) );
     }
 	
     /**
@@ -57,7 +57,7 @@
      */
     public void testLdapDNSimple() throws DecoderException
     {
-        Assert.assertEquals("a = b", LdapDN.parseDN("a = b".getBytes()) );
+        Assert.assertEquals("a = b", LdapDN.parseDN(getChars("a = b")) );
     }
 	
     /**
@@ -65,7 +65,7 @@
      */
     public void testLdapDNComposite() throws DecoderException
     {
-        Assert.assertEquals("a = b, c = d", LdapDN.parseDN("a = b, c = d".getBytes()) );
+        Assert.assertEquals("a = b, c = d", LdapDN.parseDN(getChars("a = b, c = d")) );
     }
 	
     /**
@@ -73,7 +73,7 @@
      */
     public void testLdapDNCompositeWithSpace() throws DecoderException
     {
-        Assert.assertEquals("a=b, a =b, a= b, a = b, a  =  b", LdapDN.parseDN("a=b, a =b,
a= b, a = b, a  =  b".getBytes()) );
+        Assert.assertEquals("a=b, a =b, a= b, a = b, a  =  b", LdapDN.parseDN(getChars("a=b,
a =b, a= b, a = b, a  =  b")) );
     }
 	
     /**
@@ -82,7 +82,7 @@
      */
     public void testLdapDNCompositeSepators() throws DecoderException
     {
-        Assert.assertEquals("a=b,c=d,e=f", LdapDN.parseDN("a=b;c=d,e=f".getBytes()) );
+        Assert.assertEquals("a=b,c=d,e=f", LdapDN.parseDN(getChars("a=b;c=d,e=f")) );
     }
 	
     /**
@@ -90,7 +90,7 @@
      */
     public void testLdapDNSimpleMultivaluedAttribute() throws DecoderException
     {
-        Assert.assertEquals("a = b + c = d", LdapDN.parseDN("a = b + c = d".getBytes()) );
+        Assert.assertEquals("a = b + c = d", LdapDN.parseDN(getChars("a = b + c = d")) );
     }
 	
     /**
@@ -98,7 +98,7 @@
      */
     public void testLdapDNCompositeMultivaluedAttribute() throws DecoderException
     {
-        Assert.assertEquals("a=b+c=d, e=f + g=h + i=j", LdapDN.parseDN("a=b+c=d, e=f + g=h
+ i=j".getBytes()) );
+        Assert.assertEquals("a=b+c=d, e=f + g=h + i=j", LdapDN.parseDN(getChars("a=b+c=d,
e=f + g=h + i=j")) );
     }
 
     /**
@@ -106,7 +106,7 @@
      */
     public void testLdapDNOidUpper() throws DecoderException
     {
-        Assert.assertEquals("OID.12.34.56 = azerty", LdapDN.parseDN("OID.12.34.56 = azerty".getBytes())
);
+        Assert.assertEquals("OID.12.34.56 = azerty", LdapDN.parseDN(getChars("OID.12.34.56
= azerty")) );
     }
 
     /**
@@ -114,7 +114,7 @@
      */
     public void testLdapDNOidLower() throws DecoderException
     {
-        Assert.assertEquals("oid.12.34.56 = azerty", LdapDN.parseDN("oid.12.34.56 = azerty".getBytes())
);
+        Assert.assertEquals("oid.12.34.56 = azerty", LdapDN.parseDN(getChars("oid.12.34.56
= azerty")) );
     }
 
     /**
@@ -122,7 +122,7 @@
      */
     public void testLdapDNOidWithoutPrefix() throws DecoderException
     {
-        Assert.assertEquals("12.34.56 = azerty", LdapDN.parseDN("12.34.56 = azerty".getBytes())
);
+        Assert.assertEquals("12.34.56 = azerty", LdapDN.parseDN(getChars("12.34.56 = azerty"))
);
     }
 
     /**
@@ -130,7 +130,7 @@
      */
     public void testLdapDNCompositeOidWithoutPrefix() throws DecoderException
     {
-        Assert.assertEquals("12.34.56 = azerty, 7.8 = test", LdapDN.parseDN("12.34.56 = azerty;
7.8 = test".getBytes()) );
+        Assert.assertEquals("12.34.56 = azerty, 7.8 = test", LdapDN.parseDN(getChars("12.34.56
= azerty; 7.8 = test")) );
     }
 
     /**
@@ -138,7 +138,7 @@
      */
     public void testLdapDNPairCharAttributeValue() throws DecoderException
     {
-        Assert.assertEquals("a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", LdapDN.parseDN("a
= \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00".getBytes()) );
+        Assert.assertEquals("a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", LdapDN.parseDN(getChars("a
= \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00")) );
     }
 
     /**
@@ -146,7 +146,7 @@
      */
     public void testLdapDNHexStringAttributeValue() throws DecoderException
     {
-        Assert.assertEquals("a = #0010A0AAFF", LdapDN.parseDN("a = #0010A0AAFF".getBytes())
);
+        Assert.assertEquals("a = #0010A0AAFF", LdapDN.parseDN(getChars("a = #0010A0AAFF"))
);
     }
 
     /**
@@ -154,6 +154,6 @@
      */
     public void testLdapDNQuotedAttributeValue() throws DecoderException
     {
-        Assert.assertEquals("a = quoted \\\"value", LdapDN.parseDN("a = quoted \\\"value".getBytes())
);
+        Assert.assertEquals("a = quoted \\\"value", LdapDN.parseDN(getChars("a = quoted \\\"value"))
);
     }
 }



Mime
View raw message