directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r291503 [2/2] - in /directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src: java/main/org/apache/asn1new/ldap/ java/main/org/apache/asn1new/ldap/codec/grammar/ java/main/org/apache/asn1new/ldap/codec/primitives/ java/...
Date Mon, 26 Sep 2005 01:05:14 GMT
Modified: directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchRequestTest.java?rev=291503&r1=291502&r2=291503&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchRequestTest.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/SearchRequestTest.java
Sun Sep 25 18:04:43 2005
@@ -543,12 +543,12 @@
         stream.put(
             new byte[]
             {
-                0x30, 0x38,                   // LDAPMessage ::=SEQUENCE {
+                0x30, 0x37,                   // LDAPMessage ::=SEQUENCE {
 				0x02, 0x01, 0x03, 	          //        messageID MessageID
-				0x63, 0x33,                   //	      CHOICE { ..., searchRequest SearchRequest, ...
+				0x63, 0x32,                   //	      CHOICE { ..., searchRequest SearchRequest, ...
                         			     	  // SearchRequest ::= APPLICATION[3] SEQUENCE {
-				0x04, 0x13, 		     	  //    baseObject LDAPDN,
-				'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', ' ', 
+				0x04, 0x12, 		     	  //    baseObject LDAPDN,
+				'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 
 				'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', 
 				0x0A, 0x01, 0x00,        	  //    scope           ENUMERATED {
                 					     	  //        baseObject              (0),
@@ -595,7 +595,7 @@
         SearchRequest sr      = message.getSearchRequest();
 
         Assert.assertEquals( 3, message.getMessageId() );
-        Assert.assertEquals( "ou=users, ou=system", sr.getBaseObject().toString() );
+        Assert.assertEquals( "ou=users,ou=system", sr.getBaseObject().toString() );
         Assert.assertEquals( LdapConstants.SCOPE_BASE_OBJECT, sr.getScope() );
         Assert.assertEquals( LdapConstants.DEREF_ALWAYS, sr.getDerefAliases() );
         Assert.assertEquals( 0, sr.getSizeLimit() );
@@ -613,7 +613,7 @@
        	Assert.assertNull( attributes );
 
         // Check the length
-        Assert.assertEquals(0x3A, message.computeLength());
+        Assert.assertEquals(0x39, message.computeLength());
 
         // Check the encoding
         try
@@ -622,7 +622,7 @@
             
             String encodedPdu = StringUtils.dumpBytes( bb.array() ); 
             
-            Assert.assertEquals(encodedPdu, decodedPdu.substring( 0, decodedPdu.length()
- 30) );
+            Assert.assertEquals(encodedPdu, decodedPdu.substring( 0, decodedPdu.length()
- 35) );
         }
         catch ( EncoderException ee )
         {

Modified: directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/DNUtilsTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/DNUtilsTest.java?rev=291503&r1=291502&r2=291503&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/DNUtilsTest.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/DNUtilsTest.java
Sun Sep 25 18:04:43 2005
@@ -36,7 +36,7 @@
     public void testAreEqualsFull()
     {
         // Full compare
-        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".getBytes(), 0, "azerty" )
);
+        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".toCharArray(), 0, "azerty"
) );
     }
 
     /**
@@ -45,7 +45,7 @@
     public void testAreEqualsDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "Azerty"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "Azerty"
) );
     }
 
     /**
@@ -54,7 +54,7 @@
     public void testAreEqualsEmpty()
     {
         // Compare to an empty string
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "" ) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "" ) );
     }
 
     /**
@@ -63,7 +63,7 @@
     public void testAreEqualsFirstCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "Azerty"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "Azerty"
) );
     }
     
     /**
@@ -72,7 +72,7 @@
     public void testAreEqualsMiddleCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "azeRty"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "azeRty"
) );
     }
     
     /**
@@ -81,7 +81,7 @@
     public void testAreEqualsLastCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "azertY"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "azertY"
) );
     }
     
     /**
@@ -90,12 +90,12 @@
     public void testAreEqualsCharByChar()
     {
         // Index must be incremented after each comparison
-        Assert.assertEquals( 1, StringUtils.areEquals( "azerty".getBytes(), 0, "a" ) );
-        Assert.assertEquals( 2, StringUtils.areEquals( "azerty".getBytes(), 1, "z" ) );
-        Assert.assertEquals( 3, StringUtils.areEquals( "azerty".getBytes(), 2, "e" ) );
-        Assert.assertEquals( 4, StringUtils.areEquals( "azerty".getBytes(), 3, "r" ) );
-        Assert.assertEquals( 5, StringUtils.areEquals( "azerty".getBytes(), 4, "t" ) );
-        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".getBytes(), 5, "y" ) );
+        Assert.assertEquals( 1, StringUtils.areEquals( "azerty".toCharArray(), 0, "a" ) );
+        Assert.assertEquals( 2, StringUtils.areEquals( "azerty".toCharArray(), 1, "z" ) );
+        Assert.assertEquals( 3, StringUtils.areEquals( "azerty".toCharArray(), 2, "e" ) );
+        Assert.assertEquals( 4, StringUtils.areEquals( "azerty".toCharArray(), 3, "r" ) );
+        Assert.assertEquals( 5, StringUtils.areEquals( "azerty".toCharArray(), 4, "t" ) );
+        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".toCharArray(), 5, "y" ) );
     }
 
     /**
@@ -104,7 +104,7 @@
     public void testAreEqualsTooShort()
     {
         // length too short
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "azertyiop"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "azertyiop"
) );
     }
 
     /**
@@ -113,7 +113,7 @@
     public void testAreEqualsTooShortMiddle()
     {
         // length too short
-        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".getBytes(), 0, "ertyiop"
) );
+        Assert.assertEquals( -1, StringUtils.areEquals( "azerty".toCharArray(), 0, "ertyiop"
) );
     }
 
     /**
@@ -122,7 +122,7 @@
     public void testAreEqualsLastChar()
     {
         // last character
-        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".getBytes(), 5, "y" ) );
+        Assert.assertEquals( 6, StringUtils.areEquals( "azerty".toCharArray(), 5, "y" ) );
     }
 
     /**
@@ -131,6 +131,6 @@
     public void testAreEqualsMiddle()
     {
         // In the middle
-        Assert.assertEquals( 4, StringUtils.areEquals( "azerty".getBytes(), 2, "er" ) );
+        Assert.assertEquals( 4, StringUtils.areEquals( "azerty".toCharArray(), 2, "er" )
);
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapDNTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapDNTest.java?rev=291503&r1=291502&r2=291503&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapDNTest.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapDNTest.java
Sun Sep 25 18:04:43 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.asn1new.ldap.codec.utils;
 
+import javax.naming.InvalidNameException;
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
@@ -41,131 +43,151 @@
     /**
      * Test a null DN
      */
-    public void testLdapDNNull() throws DecoderException
+    public void testLdapDNNull() throws InvalidNameException
     {
-        Assert.assertEquals( "", new LdapDN( null ).toString() );
+        LdapDN dn = new LdapDN();
+        Assert.assertEquals( null, dn.getName() );
+        Assert.assertEquals( null, dn.getNameNormalized() );
     }
 
     /**
      * test an empty DN
      */
-    public void testLdapDNEmpty() throws DecoderException
+    public void testLdapDNEmpty() throws InvalidNameException
     {
-        Assert.assertEquals( "", new LdapDN( "".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "" );
+        Assert.assertEquals( "", new LdapDN( "" ).getName() );
+        Assert.assertEquals( "", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN : a = b
      */
-    public void testLdapDNSimple() throws DecoderException
+    public void testLdapDNSimple() throws InvalidNameException
     {
-        Assert.assertEquals( "a = b", new LdapDN( "a = b".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a = b" );
+        Assert.assertEquals( "a = b", dn.getName() );
+        Assert.assertEquals( "a=b", dn.getNameNormalized() );
     }
 
     /**
      * test a composite DN : a = b, d = e
      */
-    public void testLdapDNComposite() throws DecoderException
+    public void testLdapDNComposite() throws InvalidNameException
     {
-        Assert.assertEquals( "a = b, c = d", new LdapDN( "a = b, c = d".getBytes() ).toString()
);
+        LdapDN dn = new LdapDN( "a = b, c = d" );
+        Assert.assertEquals( "a = b, c = d", dn.getName() );
+        Assert.assertEquals( "a=b,c=d", dn.getNameNormalized() );
     }
 
     /**
      * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a  =  b
      */
-    public void testLdapDNCompositeWithSpace() throws DecoderException
+    public void testLdapDNCompositeWithSpace() throws InvalidNameException
     {
-        Assert.assertEquals( "a=b, a =b, a= b, a = b, a  =  b",
-                new LdapDN( "a=b, a =b, a= b, a = b, a  =  b".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a=b, a =b, a= b, a = b, a  =  b" );
+        Assert.assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
+        Assert.assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNameNormalized() );
     }
 
     /**
      * 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 DecoderException
+    public void testLdapDNCompositeSepators() throws InvalidNameException
     {
-        Assert.assertEquals( "a=b,c=d,e=f", new LdapDN( "a=b;c=d,e=f".getBytes() ).toString()
);
+        LdapDN dn = new LdapDN( "a=b;c=d,e=f" );
+        Assert.assertEquals( "a=b;c=d,e=f", dn.getName() );
+        Assert.assertEquals( "a=b,c=d,e=f", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with differents separators : a = b + c = d
      */
-    public void testLdapDNSimpleMultivaluedAttribute() throws DecoderException
+    public void testLdapDNSimpleMultivaluedAttribute() throws InvalidNameException
     {
-        Assert.assertEquals( "a = b + c = d",
-                new LdapDN( "a = b + c = d".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a = b + c = d" );
+        Assert.assertEquals( "a = b + c = d", dn.getName() );
+        Assert.assertEquals( "a=b+c=d", dn.getNameNormalized() );
     }
 
     /**
      * test a composite DN with differents separators : a=b+c=d, e=f + g=h + i=j
      */
-    public void testLdapDNCompositeMultivaluedAttribute() throws DecoderException
+    public void testLdapDNCompositeMultivaluedAttribute() throws InvalidNameException
     {
-        Assert.assertEquals( "a=b+c=d, e=f + g=h + i=j",
-                new LdapDN( "a=b+c=d, e=f + g=h + i=j".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a=b+c=d, e=f + g=h + i=j" );
+        Assert.assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getName() );
+        Assert.assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
      */
-    public void testLdapDNOidUpper() throws DecoderException
+    public void testLdapDNOidUpper() throws InvalidNameException
     {
-        Assert.assertEquals( "OID.12.34.56 = azerty",
-                new LdapDN( "OID.12.34.56 = azerty".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "OID.12.34.56 = azerty" );
+        Assert.assertEquals( "OID.12.34.56 = azerty", dn.getName() );
+        Assert.assertEquals( "oid.12.34.56=azerty", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
      */
-    public void testLdapDNOidLower() throws DecoderException
+    public void testLdapDNOidLower() throws InvalidNameException
     {
-        Assert.assertEquals( "oid.12.34.56 = azerty",
-                new LdapDN( "oid.12.34.56 = azerty".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "oid.12.34.56 = azerty" );
+        Assert.assertEquals( "oid.12.34.56 = azerty", dn.getName() );
+        Assert.assertEquals( "oid.12.34.56=azerty", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with an oid attribut wiithout oid prefix : 12.34.56 = azerty
      */
-    public void testLdapDNOidWithoutPrefix() throws DecoderException
+    public void testLdapDNOidWithoutPrefix() throws InvalidNameException
     {
-        Assert.assertEquals( "12.34.56 = azerty",
-                new LdapDN( "12.34.56 = azerty".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "12.34.56 = azerty" );
+        Assert.assertEquals( "12.34.56 = azerty", dn.getName() );
+        Assert.assertEquals( "12.34.56=azerty", dn.getNameNormalized() );
     }
 
     /**
      * test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 = azerty;
7.8 = test
      */
-    public void testLdapDNCompositeOidWithoutPrefix() throws DecoderException
+    public void testLdapDNCompositeOidWithoutPrefix() throws InvalidNameException
     {
-        Assert.assertEquals( "12.34.56 = azerty, 7.8 = test",
-                new LdapDN( "12.34.56 = azerty; 7.8 = test".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "12.34.56 = azerty; 7.8 = test" );
+        Assert.assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
+        Assert.assertEquals( "12.34.56=azerty,7.8=test", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\A0\00"
      */
-    public void testLdapDNPairCharAttributeValue() throws DecoderException
+    public void testLdapDNPairCharAttributeValue() throws InvalidNameException
     {
-        Assert.assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00",
-                new LdapDN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00".getBytes()
).toString() );
+        LdapDN dn = new LdapDN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00" );
+        Assert.assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", dn.getName()
);
+        Assert.assertEquals( "a=\\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\A0\\00", dn.getNameNormalized()
);
     }
 
     /**
      * test a simple DN with hexString attribute value : a = #0010A0AAFF
      */
-    public void testLdapDNHexStringAttributeValue() throws DecoderException
+    public void testLdapDNHexStringAttributeValue() throws InvalidNameException
     {
-        Assert.assertEquals( "a = #0010A0AAFF",
-                new LdapDN( "a = #0010A0AAFF".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a = #0010A0AAFF" );
+        Assert.assertEquals( "a = #0010A0AAFF", dn.getName() );
+        Assert.assertEquals( "a=#0010A0AAFF", dn.getNameNormalized() );
     }
 
     /**
      * test a simple DN with quoted attribute value : a = "quoted \"value"
      */
-    public void testLdapDNQuotedAttributeValue() throws DecoderException
+    public void testLdapDNQuotedAttributeValue() throws InvalidNameException
     {
-        Assert.assertEquals( "a = quoted \\\"value",
-                new LdapDN( "a = quoted \\\"value".getBytes() ).toString() );
+        LdapDN dn = new LdapDN( "a = quoted \\\"value" );
+        Assert.assertEquals( "a = quoted \\\"value", dn.getName() );
+        Assert.assertEquals( "a=quoted \\\"value", dn.getNameNormalized() );
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapUrlTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapUrlTest.java?rev=291503&r1=291502&r2=291503&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapUrlTest.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/test/org/apache/asn1new/ldap/codec/utils/LdapUrlTest.java
Sun Sep 25 18:04:43 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.asn1new.ldap.codec.utils;
 
+import java.io.UnsupportedEncodingException;
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
@@ -49,35 +51,35 @@
     /**
      * test an empty LdapURL
      */
-    public void testLdapDNEmpty() throws DecoderException
+    public void testLdapDNEmpty() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals( "ldap:///", new LdapURL( "".getBytes() ).toString() );
+        Assert.assertEquals( "ldap:///", new LdapURL( "" ).toString() );
     }
 
     /**
      * test a simple LdapURL
      */
-    public void testLdapDNSimple() throws DecoderException
+    public void testLdapDNSimple() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals( "ldap://directory.apache.org:80/", new LdapURL( "ldap://directory.apache.org:80/".getBytes()
).toString() );
+        Assert.assertEquals( "ldap://directory.apache.org:80/", new LdapURL( "ldap://directory.apache.org:80/"
).toString() );
     }
 
     /**
      * test a LdapURL host 1
      */
-    public void testLdapDNWithMinus() throws DecoderException
+    public void testLdapDNWithMinus() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals( "ldap://d-a.org:80/", new LdapURL( "ldap://d-a.org:80/".getBytes()
).toString() );
+        Assert.assertEquals( "ldap://d-a.org:80/", new LdapURL( "ldap://d-a.org:80/").toString()
);
     }
 
     /**
      * test a LdapURL with a bad port
      */
-    public void testLdapDNBadPort() throws DecoderException
+    public void testLdapDNBadPort() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:/".getBytes() );
+            new LdapURL( "ldap://directory.apache.org:/" );
         }
         catch (DecoderException de)
         {
@@ -91,11 +93,11 @@
     /**
      * test a LdapURL with a bad port 2
      */
-    public void testLdapDNBadPort2() throws DecoderException
+    public void testLdapDNBadPort2() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:-1/".getBytes() );
+            new LdapURL( "ldap://directory.apache.org:-1/" );
         }
         catch (DecoderException de)
         {
@@ -109,11 +111,11 @@
     /**
      * test a LdapURL with a bad port 3
      */
-    public void testLdapDNBadPort3() throws DecoderException
+    public void testLdapDNBadPort3() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:abc/".getBytes() );
+            new LdapURL( "ldap://directory.apache.org:abc/" );
         }
         catch (DecoderException de)
         {
@@ -127,11 +129,11 @@
     /**
      * test a LdapURL with a bad port 4
      */
-    public void testLdapDNBadPort4() throws DecoderException
+    public void testLdapDNBadPort4() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:65536/".getBytes() );
+            new LdapURL( "ldap://directory.apache.org:65536/" );
         }
         catch (DecoderException de)
         {
@@ -145,19 +147,19 @@
     /**
      * test a LdapURL with no host 
      */
-    public void testLdapDNBadHost1() throws DecoderException
+    public void testLdapDNBadHost1() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap:///", new LdapURL( "ldap:///".getBytes() ).toString() );
+        Assert.assertEquals("ldap:///", new LdapURL( "ldap:///" ).toString() );
     }
 
     /**
      * test a LdapURL with a bad host 2
      */
-    public void testLdapDNBadHost2() throws DecoderException
+    public void testLdapDNBadHost2() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://./".getBytes() );
+            new LdapURL( "ldap://./" );
         }
         catch (DecoderException de)
         {
@@ -171,11 +173,11 @@
     /**
      * test a LdapURL with a bad host 3
      */
-    public void testLdapDNBadHost3() throws DecoderException
+    public void testLdapDNBadHost3() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://a..b/".getBytes() );
+            new LdapURL( "ldap://a..b/" );
         }
         catch (DecoderException de)
         {
@@ -189,11 +191,11 @@
     /**
      * test a LdapURL with a bad host 4
      */
-    public void testLdapDNBadHost4() throws DecoderException
+    public void testLdapDNBadHost4() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://-/".getBytes() );
+            new LdapURL( "ldap://-/" );
         }
         catch (DecoderException de)
         {
@@ -207,11 +209,11 @@
     /**
      * test a LdapURL with a bad host 5
      */
-    public void testLdapDNBadHost5() throws DecoderException
+    public void testLdapDNBadHost5() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://a.b.c-/".getBytes() );
+            new LdapURL( "ldap://a.b.c-/" );
         }
         catch (DecoderException de)
         {
@@ -225,11 +227,11 @@
     /**
      * test a LdapURL with a bad host 6
      */
-    public void testLdapDNBadHost6() throws DecoderException
+    public void testLdapDNBadHost6() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://a.b.-c/".getBytes() );
+            new LdapURL( "ldap://a.b.-c/" );
         }
         catch (DecoderException de)
         {
@@ -243,11 +245,11 @@
     /**
      * test a LdapURL with a bad host 7
      */
-    public void testLdapDNBadHost7() throws DecoderException
+    public void testLdapDNBadHost7() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://a.-.c/".getBytes() );
+            new LdapURL( "ldap://a.-.c/" );
         }
         catch (DecoderException de)
         {
@@ -261,27 +263,27 @@
     /**
      * test a LdapURL IP host
      */
-    public void testLdapDNIPHost() throws DecoderException
+    public void testLdapDNIPHost() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals( "ldap://1.2.3.4/", new LdapURL( "ldap://1.2.3.4/".getBytes()
).toString() );
+        Assert.assertEquals( "ldap://1.2.3.4/", new LdapURL( "ldap://1.2.3.4/" ).toString()
);
     }
 
     /**
      * test a LdapURL IP host and port
      */
-    public void testLdapDNIPHostPort() throws DecoderException
+    public void testLdapDNIPHostPort() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals( "ldap://1.2.3.4:80/", new LdapURL( "ldap://1.2.3.4:80/".getBytes()
).toString() );
+        Assert.assertEquals( "ldap://1.2.3.4:80/", new LdapURL( "ldap://1.2.3.4:80/" ).toString()
);
     }
 
     /**
      * test a LdapURL with a bad IP host 1
      */
-    public void testLdapDNBadHostIP1() throws DecoderException
+    public void testLdapDNBadHostIP1() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://1.1.1/".getBytes() );
+            new LdapURL( "ldap://1.1.1/" );
         }
         catch (DecoderException de)
         {
@@ -295,11 +297,11 @@
     /**
      * test a LdapURL with a bad IP host 2
      */
-    public void testLdapDNBadHostIP2() throws DecoderException
+    public void testLdapDNBadHostIP2() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://1.1.1./".getBytes() );
+            new LdapURL( "ldap://1.1.1./" );
         }
         catch (DecoderException de)
         {
@@ -313,11 +315,11 @@
     /**
      * test a LdapURL with a bad IP host 3
      */
-    public void testLdapDNBadHostIP3() throws DecoderException
+    public void testLdapDNBadHostIP3() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://1.1.1.100000/".getBytes() );
+            new LdapURL( "ldap://1.1.1.100000/" );
         }
         catch (DecoderException de)
         {
@@ -331,11 +333,11 @@
     /**
      * test a LdapURL with a bad IP host 4
      */
-    public void testLdapDNBadHostIP4() throws DecoderException
+    public void testLdapDNBadHostIP4() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://1.1.1.1.1/".getBytes() );
+            new LdapURL( "ldap://1.1.1.1.1/" );
         }
         catch (DecoderException de)
         {
@@ -349,43 +351,43 @@
     /**
      * test a LdapURL with a valid host hich is not an IP
      */
-    public void testLdapDNNotAnIP() throws DecoderException
+    public void testLdapDNNotAnIP() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://1.1.1.100000.a/", new LdapURL( "ldap://1.1.1.100000.a/".getBytes()
).toString() );
+        Assert.assertEquals("ldap://1.1.1.100000.a/", new LdapURL( "ldap://1.1.1.100000.a/"
).toString() );
     }
 
     /**
      * test a LdapURL with valid simpleDN
      */
-    public void testLdapDNSimpleDN() throws DecoderException
+    public void testLdapDNSimpleDN() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org/", new LdapURL(
"ldap://directory.apache.org:389/dc=example,dc=org/".getBytes() ).toString() );
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org/", new LdapURL(
"ldap://directory.apache.org:389/dc=example,dc=org/" ).toString() );
     }
 
     /**
      * test a LdapURL with valid simpleDN 2
      */
-    public void testLdapDNSimpleDN2() throws DecoderException
+    public void testLdapDNSimpleDN2() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example", new LdapURL( "ldap://directory.apache.org:389/dc=example".getBytes()
).toString() );
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example", new LdapURL( "ldap://directory.apache.org:389/dc=example"
).toString() );
     }
 
     /**
      * test a LdapURL with a valid encoded DN
      */
-    public void testLdapDNSimpleDNEncoded() throws DecoderException
+    public void testLdapDNSimpleDNEncoded() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example%202,dc=org", new
LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc=org".getBytes() ).toString() );
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example%202,dc=org", new
LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc=org" ).toString() );
     }
     
     /**
      * test a LdapURL with an invalid DN
      */
-    public void testLdapDNInvalidDN() throws DecoderException
+    public void testLdapDNInvalidDN() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc : org".getBytes()
);
+            new LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc : org" );
         }
         catch (DecoderException de)
         {
@@ -397,11 +399,11 @@
     /**
      * test a LdapURL with an invalid DN 2
      */
-    public void testLdapDNInvalidDN2() throws DecoderException
+    public void testLdapDNInvalidDN2() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc = org,".getBytes()
);
+            new LdapURL( "ldap://directory.apache.org:389/dc=example%202,dc = org," );
         }
         catch (DecoderException de)
         {
@@ -413,35 +415,35 @@
     /**
      * test a LdapURL with valid unique attributes
      */
-    public void testLdapDNUniqueAttribute() throws DecoderException
+    public void testLdapDNUniqueAttribute() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou", new LdapURL(
"ldap://directory.apache.org:389/dc=example,dc=org?ou".getBytes() ).toString() );
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou", new LdapURL(
"ldap://directory.apache.org:389/dc=example,dc=org?ou" ).toString() );
     }
 
     /**
      * test a LdapURL with valid attributes
      */
-    public void testLdapDNAttributes() throws DecoderException
+    public void testLdapDNAttributes() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc",
new LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc".getBytes()
).toString() );
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc",
new LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou,objectclass,dc" ).toString()
);
     }
 
     /**
      * test a LdapURL with valid duplicated attributes
      */
-    public void testLdapDNDuplicatedAttributes() throws DecoderException
+    public void testLdapDNDuplicatedAttributes() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou,dc", new
LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou,dc,ou".getBytes() ).toString()
);
+        Assert.assertEquals("ldap://directory.apache.org:389/dc=example,dc=org?ou,dc", new
LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou,dc,ou" ).toString() );
     }
 
     /**
      * test a LdapURL with invalid attributes
      */
-    public void testLdapInvalideAttributes() throws DecoderException
+    public void testLdapInvalideAttributes() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou=,dc".getBytes()
);
+            new LdapURL( "ldap://directory.apache.org:389/dc=example,dc=org?ou=,dc" );
         }
         catch (DecoderException de)
         {
@@ -452,11 +454,11 @@
     /**
      * test a LdapURL with attributes but no DN
      */
-    public void testLdapNoDNAttributes() throws DecoderException
+    public void testLdapNoDNAttributes() throws DecoderException, UnsupportedEncodingException
     {
         try 
         {
-            new LdapURL( "ldap://directory.apache.org:389/?ou,dc".getBytes() );
+            new LdapURL( "ldap://directory.apache.org:389/?ou,dc" );
         }
         catch (DecoderException de)
         {
@@ -468,73 +470,73 @@
     /**
      * test 1 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_1() throws DecoderException
+    public void testLdapRFC2255_1() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap:///o=University%20of%20Michigan,c=US", new LdapURL( "ldap:///o=University%20of%20Michigan,c=US".getBytes()
).toString() );
+        Assert.assertEquals("ldap:///o=University%20of%20Michigan,c=US", new LdapURL( "ldap:///o=University%20of%20Michigan,c=US"
).toString() );
     }
     
     /**
      * test 2 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_2() throws DecoderException
+    public void testLdapRFC2255_2() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US",
new LdapURL( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US".getBytes() ).toString()
);
+        Assert.assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US",
new LdapURL( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US" ).toString() );
     }
 
     /**
      * test 3 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_3() throws DecoderException
+    public void testLdapRFC2255_3() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress",
new LdapURL( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress".getBytes()
).toString() );
+        Assert.assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress",
new LdapURL( "ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress" ).toString()
);
     }
 
     /**
      * test 4 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_4() throws DecoderException
+    public void testLdapRFC2255_4() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
new LdapURL( "ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)".getBytes()
).toString() );
+        Assert.assertEquals("ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)",
new LdapURL( "ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)"
).toString() );
     }
 
     /**
      * test 5 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_5() throws DecoderException
+    public void testLdapRFC2255_5() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://ldap.itd.umich.edu/c=GB?objectClass?one", new LdapURL(
"ldap://ldap.itd.umich.edu/c=GB?objectClass?one".getBytes() ).toString() );
+        Assert.assertEquals("ldap://ldap.itd.umich.edu/c=GB?objectClass?one", new LdapURL(
"ldap://ldap.itd.umich.edu/c=GB?objectClass?one" ).toString() );
     }
 
     /**
      * test 6 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_6() throws DecoderException
+    public void testLdapRFC2255_6() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://ldap.question.com/o=Question%3f,c=US?mail", new LdapURL(
"ldap://ldap.question.com/o=Question%3f,c=US?mail".getBytes() ).toString() );
+        Assert.assertEquals("ldap://ldap.question.com/o=Question%3f,c=US?mail", new LdapURL(
"ldap://ldap.question.com/o=Question%3f,c=US?mail" ).toString() );
     }
 
     /**
      * test 7 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_7() throws DecoderException
+    public void testLdapRFC2255_7() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)",
new LdapURL( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)".getBytes()
).toString() );
+        Assert.assertEquals("ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)",
new LdapURL( "ldap://ldap.netscape.com/o=Babsco,c=US???(int=%5c00%5c00%5c00%5c04)" ).toString()
);
     }
 
     /**
      * test 8 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_8() throws DecoderException
+    public void testLdapRFC2255_8() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap:///??sub??bindname=cn=Manager%2co=Foo", new LdapURL( "ldap:///??sub??bindname=cn=Manager%2co=Foo".getBytes()
).toString() );
+        Assert.assertEquals("ldap:///??sub??bindname=cn=Manager%2co=Foo", new LdapURL( "ldap:///??sub??bindname=cn=Manager%2co=Foo"
).toString() );
     }
 
     /**
      * test 9 from RFC 2255 LdapURL 
      */
-    public void testLdapRFC2255_9() throws DecoderException
+    public void testLdapRFC2255_9() throws DecoderException, UnsupportedEncodingException
     {
-        Assert.assertEquals("ldap:///??sub??!bindname=cn=Manager%2co=Foo", new LdapURL( "ldap:///??sub??!bindname=cn=Manager%2co=Foo".getBytes()
).toString() );
+        Assert.assertEquals("ldap:///??sub??!bindname=cn=Manager%2co=Foo", new LdapURL( "ldap:///??sub??!bindname=cn=Manager%2co=Foo"
).toString() );
     }
 }
 



Mime
View raw message