directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r923524 [6/7] - in /directory/shared/trunk: ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/ ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/ ldap-schema-manager/sr...
Date Tue, 16 Mar 2010 00:31:39 GMT
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=923524&r1=923523&r2=923524&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java Tue Mar 16 00:31:36 2010
@@ -42,11 +42,10 @@ import java.util.Map;
 import java.util.Properties;
 
 import javax.naming.CompoundName;
-import javax.naming.InvalidNameException;
 import javax.naming.Name;
-import javax.naming.NamingException;
 import javax.naming.ldap.LdapName;
 
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -116,7 +115,7 @@ public class DNTest
      * test an empty DN
      */
     @Test
-    public void testDnEmpty() throws InvalidNameException
+    public void testDnEmpty() throws LdapException
     {
         DN dn = new DN( "" );
         assertEquals( "", dn.getName() );
@@ -128,7 +127,7 @@ public class DNTest
      * test a simple DN : a = b
      */
     @Test
-    public void testDnSimple() throws InvalidNameException
+    public void testDnSimple() throws LdapException
     {
         DN dn = new DN( "a = b" );
 
@@ -142,7 +141,7 @@ public class DNTest
      * test a simple DN with some spaces : "a = b  "
      */
     @Test
-    public void testDnSimpleWithSpaces() throws InvalidNameException
+    public void testDnSimpleWithSpaces() throws LdapException
     {
         DN dn = new DN( "a = b  " );
 
@@ -156,7 +155,7 @@ public class DNTest
      * test a composite DN : a = b, d = e
      */
     @Test
-    public void testDnComposite() throws InvalidNameException
+    public void testDnComposite() throws LdapException
     {
         DN dn = new DN( "a = b, c = d" );
 
@@ -170,7 +169,7 @@ public class DNTest
      * test a composite DN with spaces : a = b  , d = e
      */
     @Test
-    public void testDnCompositeWithSpaces() throws InvalidNameException
+    public void testDnCompositeWithSpaces() throws LdapException
     {
         DN dn = new DN( "a = b  , c = d" );
 
@@ -184,7 +183,7 @@ public class DNTest
      * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
      */
     @Test
-    public void testDnCompositeWithSpace() throws InvalidNameException
+    public void testDnCompositeWithSpace() throws LdapException
     {
         DN dn = new DN( "a=b, a =b, a= b, a = b, a  =  b" );
 
@@ -199,7 +198,7 @@ public class DNTest
      * return a=b,c=d,e=f (the ';' is replaced by a ',')
      */
     @Test
-    public void testDnCompositeSepators() throws InvalidNameException
+    public void testDnCompositeSepators() throws LdapException
     {
         DN dn = new DN( "a=b;c=d,e=f" );
 
@@ -213,7 +212,7 @@ public class DNTest
      * test a simple DN with multiple NameComponents : a = b + c = d
      */
     @Test
-    public void testDnSimpleMultivaluedAttribute() throws InvalidNameException
+    public void testDnSimpleMultivaluedAttribute() throws LdapException
     {
         DN dn = new DN( "a = b + c = d" );
 
@@ -228,7 +227,7 @@ public class DNTest
      * i=j
      */
     @Test
-    public void testDnCompositeMultivaluedAttribute() throws InvalidNameException
+    public void testDnCompositeMultivaluedAttribute() throws LdapException
     {
         DN dn = new DN( "a=b+c=d, e=f + g=h + i=j" );
 
@@ -242,7 +241,7 @@ public class DNTest
     * Test to see if a DN with multiRdn values is preserved after an addAll.
     */
     @Test
-    public void testAddAllWithMultivaluedAttribute() throws InvalidNameException
+    public void testAddAllWithMultivaluedAttribute() throws LdapException
     {
         DN dn = new DN( "cn=Kate Bush+sn=Bush,ou=system" );
         DN target = new DN();
@@ -258,7 +257,7 @@ public class DNTest
      * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
      */
     @Test
-    public void testDnOidUpper() throws InvalidNameException
+    public void testDnOidUpper() throws LdapException
     {
         DN dn = new DN( "OID.12.34.56 = azerty" );
 
@@ -272,7 +271,7 @@ public class DNTest
      * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
      */
     @Test
-    public void testDnOidLower() throws InvalidNameException
+    public void testDnOidLower() throws LdapException
     {
         DN dn = new DN( "oid.12.34.56 = azerty" );
 
@@ -287,7 +286,7 @@ public class DNTest
      * azerty
      */
     @Test
-    public void testDnOidWithoutPrefix() throws InvalidNameException
+    public void testDnOidWithoutPrefix() throws LdapException
     {
         DN dn = new DN( "12.34.56 = azerty" );
 
@@ -302,7 +301,7 @@ public class DNTest
      * azerty; 7.8 = test
      */
     @Test
-    public void testDnCompositeOidWithoutPrefix() throws InvalidNameException
+    public void testDnCompositeOidWithoutPrefix() throws LdapException
     {
         DN dn = new DN( "12.34.56 = azerty; 7.8 = test" );
 
@@ -316,7 +315,7 @@ public class DNTest
      * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C4\8D"
      */
     @Test
-    public void testDnPairCharAttributeValue() throws InvalidNameException
+    public void testDnPairCharAttributeValue() throws LdapException
     {
         DN dn = new DN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" );
 
@@ -330,7 +329,7 @@ public class DNTest
      * test a simple DN with pair char attribute value : "SN=Lu\C4\8Di\C4\87"
      */
     @Test
-    public void testDnRFC253_Lucic() throws InvalidNameException
+    public void testDnRFC253_Lucic() throws LdapException
     {
         DN dn = new DN( "SN=Lu\\C4\\8Di\\C4\\87" );
 
@@ -344,7 +343,7 @@ public class DNTest
      * test a simple DN with hexString attribute value : a = #0010A0AAFF
      */
     @Test
-    public void testDnHexStringAttributeValue() throws InvalidNameException
+    public void testDnHexStringAttributeValue() throws LdapException
     {
         DN dn = new DN( "a = #0010A0AAFF" );
 
@@ -361,7 +360,7 @@ public class DNTest
      * (without the ESC it would be a valid hexstring).
      */
     @Test
-    public void testDnEscSharpNumber() throws InvalidNameException, NamingException
+    public void testDnEscSharpNumber() throws LdapException, LdapException
     {
         DN dn = new DN( "a = \\#123456" );
 
@@ -388,7 +387,7 @@ public class DNTest
      * test a simple DN with a # on first position
      */
     @Test
-    public void testDnSharpFirst() throws InvalidNameException, NamingException
+    public void testDnSharpFirst() throws LdapException, LdapException
     {
         DN dn = new DN( "a = \\#this is a sharp" );
 
@@ -405,7 +404,7 @@ public class DNTest
      * Normalize a simple DN with a # on first position
      */
     @Test
-    public void testNormalizeDnSharpFirst() throws InvalidNameException, NamingException
+    public void testNormalizeDnSharpFirst() throws LdapException, LdapException
     {
         DN dn = new DN( "ou = \\#this is a sharp" );
 
@@ -426,7 +425,7 @@ public class DNTest
      * This is a corner case for the parser and normalizer.
      */
     @Test
-    public void testNormalizeDnEscEscHexHex() throws NamingException
+    public void testNormalizeDnEscEscHexHex() throws LdapException
     {
         DN dn = new DN( "ou = AC\\\\DC" );
         assertTrue( DN.isValid( "ou = AC\\\\DC" ) );
@@ -451,7 +450,7 @@ public class DNTest
             new DN( "a = #0010Z0AAFF" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
 
             assertFalse( DN.isValid( "a = #0010Z0AAFF" ) );
@@ -471,7 +470,7 @@ public class DNTest
             new DN( "a = #AABBCCDD3" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertFalse( DN.isValid( "a = #AABBCCDD3" ) );
             assertTrue( true );
@@ -483,7 +482,7 @@ public class DNTest
      * test a simple DN with a quote in attribute value : a = quoted \"value\"
      */
     @Test
-    public void testDnQuoteInAttributeValue() throws InvalidNameException
+    public void testDnQuoteInAttributeValue() throws LdapException
     {
         DN dn = new DN( "a = quoted \\\"value\\\"" );
 
@@ -497,7 +496,7 @@ public class DNTest
      * test a simple DN with quoted attribute value : a = \" quoted value \"
      */
     @Test
-    public void testDnQuotedAttributeValue() throws InvalidNameException
+    public void testDnQuotedAttributeValue() throws LdapException
     {
         DN dn = new DN( "a = \\\" quoted value \\\"" );
 
@@ -521,7 +520,7 @@ public class DNTest
             new DN( "a = b," );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertTrue( true );
         }
@@ -534,7 +533,7 @@ public class DNTest
      * test a remove from position 0
      */
     @Test
-    public void testDnRemove0() throws InvalidNameException
+    public void testDnRemove0() throws LdapException
     {
         DN dn = new DN( "a=b, c=d, e=f" );
 
@@ -549,7 +548,7 @@ public class DNTest
      * test a remove from position 1
      */
     @Test
-    public void testDnRemove1() throws InvalidNameException
+    public void testDnRemove1() throws LdapException
     {
         DN dn = new DN( "a=b, c=d, e=f" );
 
@@ -563,7 +562,7 @@ public class DNTest
      * test a remove from position 2
      */
     @Test
-    public void testDnRemove2() throws InvalidNameException
+    public void testDnRemove2() throws LdapException
     {
         DN dn = new DN( "a=b, c=d, e=f" );
 
@@ -577,7 +576,7 @@ public class DNTest
      * test a remove from position 1 whith semi colon
      */
     @Test
-    public void testDnRemove1WithSemiColon() throws InvalidNameException
+    public void testDnRemove1WithSemiColon() throws LdapException
     {
         DN dn = new DN( "a=b, c=d; e=f" );
 
@@ -591,7 +590,7 @@ public class DNTest
      * test a remove out of bound
      */
     @Test
-    public void testDnRemoveOutOfBound() throws InvalidNameException
+    public void testDnRemoveOutOfBound() throws LdapException
     {
         DN dn = new DN( "a=b, c=d; e=f" );
 
@@ -628,7 +627,7 @@ public class DNTest
      * test a 1 size
      */
     @Test
-    public void testDnSize1() throws InvalidNameException
+    public void testDnSize1() throws LdapException
     {
         DN dn = new DN( "a=b" );
 
@@ -641,7 +640,7 @@ public class DNTest
      * test a 3 size
      */
     @Test
-    public void testDnSize3() throws InvalidNameException
+    public void testDnSize3() throws LdapException
     {
         DN dn = new DN( "a=b, c=d, e=f" );
 
@@ -654,7 +653,7 @@ public class DNTest
      * test a 3 size with NameComponents
      */
     @Test
-    public void testDnSize3NC() throws InvalidNameException
+    public void testDnSize3NC() throws LdapException
     {
         DN dn = new DN( "a=b+c=d, c=d, e=f" );
 
@@ -667,7 +666,7 @@ public class DNTest
      * test size after operations
      */
     @Test
-    public void testLdapResizing() throws InvalidNameException
+    public void testLdapResizing() throws LdapException
     {
         DN dn = new DN();
         assertEquals( 0, dn.size() );
@@ -691,7 +690,7 @@ public class DNTest
      * test Add on a new DN
      */
     @Test
-    public void testLdapEmptyAdd() throws InvalidNameException
+    public void testLdapEmptyAdd() throws LdapException
     {
         DN dn = new DN();
 
@@ -706,7 +705,7 @@ public class DNTest
      * test Add to an existing DN
      */
     @Test
-    public void testDnAdd() throws InvalidNameException
+    public void testDnAdd() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
 
@@ -721,7 +720,7 @@ public class DNTest
      * test Add a composite RDN to an existing DN
      */
     @Test
-    public void testDnAddComposite() throws InvalidNameException
+    public void testDnAddComposite() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
 
@@ -739,7 +738,7 @@ public class DNTest
      * test Add at the end of an existing DN
      */
     @Test
-    public void testDnAddEnd() throws InvalidNameException
+    public void testDnAddEnd() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
 
@@ -753,7 +752,7 @@ public class DNTest
      * test Add at the start of an existing DN
      */
     @Test
-    public void testDnAddStart() throws InvalidNameException
+    public void testDnAddStart() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
 
@@ -767,7 +766,7 @@ public class DNTest
      * test Add at the middle of an existing DN
      */
     @Test
-    public void testDnAddMiddle() throws InvalidNameException
+    public void testDnAddMiddle() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
 
@@ -781,10 +780,10 @@ public class DNTest
     /**
      * Test AddAll
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAddAll() throws InvalidNameException
+    public void testDnAddAll() throws LdapException
     {
         DN dn = new DN( "a = b" );
         DN dn2 = new DN( "c = d" );
@@ -796,10 +795,10 @@ public class DNTest
     /**
      * Test AddAll with an empty added name
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAddAllAddedNameEmpty() throws InvalidNameException
+    public void testDnAddAllAddedNameEmpty() throws LdapException
     {
         DN dn = new DN( "a = b" );
         DN dn2 = new DN();
@@ -812,10 +811,10 @@ public class DNTest
     /**
      * Test AddAll to an empty name
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAddAllNameEmpty() throws InvalidNameException
+    public void testDnAddAllNameEmpty() throws LdapException
     {
         DN dn = new DN();
         DN dn2 = new DN( "a = b" );
@@ -827,10 +826,10 @@ public class DNTest
     /**
      * Test AddAll at position 0
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAt0AddAll() throws InvalidNameException
+    public void testDnAt0AddAll() throws LdapException
     {
         DN dn = new DN( "a = b" );
         DN dn2 = new DN( "c = d" );
@@ -842,10 +841,10 @@ public class DNTest
     /**
      * Test AddAll at position 1
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAt1AddAll() throws InvalidNameException
+    public void testDnAt1AddAll() throws LdapException
     {
         DN dn = new DN( "a = b" );
         DN dn2 = new DN( "c = d" );
@@ -857,10 +856,10 @@ public class DNTest
     /**
      * Test AddAll at the middle
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAtTheMiddleAddAll() throws InvalidNameException
+    public void testDnAtTheMiddleAddAll() throws LdapException
     {
         DN dn = new DN( "a = b, c = d" );
         DN dn2 = new DN( "e = f" );
@@ -872,10 +871,10 @@ public class DNTest
     /**
      * Test AddAll with an empty added name at position 0
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAddAllAt0AddedNameEmpty() throws InvalidNameException
+    public void testDnAddAllAt0AddedNameEmpty() throws LdapException
     {
         DN dn = new DN( "a = b" );
         DN dn2 = new DN();
@@ -888,10 +887,10 @@ public class DNTest
     /**
      * Test AddAll to an empty name at position 0
      *
-     * @throws InvalidNameException
+     * @throws LdapException
      */
     @Test
-    public void testDnAddAllAt0NameEmpty() throws InvalidNameException
+    public void testDnAddAllAt0NameEmpty() throws LdapException
     {
         DN dn = new DN();
         DN dn2 = new DN( "a = b" );
@@ -905,7 +904,7 @@ public class DNTest
      * Get the prefix at pos 0
      */
     @Test
-    public void testDnGetPrefixPos0() throws InvalidNameException
+    public void testDnGetPrefixPos0() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getPrefix( 0 ) );
@@ -917,7 +916,7 @@ public class DNTest
      * Get the prefix at pos 1
      */
     @Test
-    public void testDnGetPrefixPos1() throws InvalidNameException
+    public void testDnGetPrefixPos1() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getPrefix( 1 ) );
@@ -929,7 +928,7 @@ public class DNTest
      * Get the prefix at pos 2
      */
     @Test
-    public void testDnGetPrefixPos2() throws InvalidNameException
+    public void testDnGetPrefixPos2() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getPrefix( 2 ) );
@@ -941,7 +940,7 @@ public class DNTest
      * Get the prefix at pos 3
      */
     @Test
-    public void testDnGetPrefixPos3() throws InvalidNameException
+    public void testDnGetPrefixPos3() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getPrefix( 3 ) );
@@ -953,7 +952,7 @@ public class DNTest
      * Get the prefix out of bound
      */
     @Test
-    public void testDnGetPrefixPos4() throws InvalidNameException
+    public void testDnGetPrefixPos4() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
 
@@ -987,7 +986,7 @@ public class DNTest
      * Get the suffix at pos 0
      */
     @Test
-    public void testDnGetSuffixPos0() throws InvalidNameException
+    public void testDnGetSuffixPos0() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getSuffix( 0 ) );
@@ -999,7 +998,7 @@ public class DNTest
      * Get the suffix at pos 1
      */
     @Test
-    public void testDnGetSuffixPos1() throws InvalidNameException
+    public void testDnGetSuffixPos1() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getSuffix( 1 ) );
@@ -1011,7 +1010,7 @@ public class DNTest
      * Get the suffix at pos 2
      */
     @Test
-    public void testDnGetSuffixPos2() throws InvalidNameException
+    public void testDnGetSuffixPos2() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getSuffix( 2 ) );
@@ -1023,7 +1022,7 @@ public class DNTest
      * Get the suffix at pos 3
      */
     @Test
-    public void testDnGetSuffixPos3() throws InvalidNameException
+    public void testDnGetSuffixPos3() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         DN newDn = ( ( DN ) dn.getSuffix( 3 ) );
@@ -1035,7 +1034,7 @@ public class DNTest
      * Get the suffix out of bound
      */
     @Test
-    public void testDnGetSuffixPos4() throws InvalidNameException
+    public void testDnGetSuffixPos4() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
 
@@ -1080,7 +1079,7 @@ public class DNTest
      * Test that a DN is empty
      */
     @Test
-    public void testDnNotEmpty() throws InvalidNameException
+    public void testDnNotEmpty() throws LdapException
     {
         DN dn = new DN( "a=b" );
         assertEquals( false, dn.isEmpty() );
@@ -1091,7 +1090,7 @@ public class DNTest
      * Test that a DN is empty
      */
     @Test
-    public void testDnRemoveIsEmpty() throws InvalidNameException
+    public void testDnRemoveIsEmpty() throws LdapException
     {
         DN dn = new DN( "a=b, c=d" );
         dn.remove( 0 );
@@ -1106,7 +1105,7 @@ public class DNTest
      * Test a startsWith a null DN
      */
     @Test
-    public void testDnStartsWithNull() throws InvalidNameException
+    public void testDnStartsWithNull() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.startsWith( null ) );
@@ -1117,7 +1116,7 @@ public class DNTest
      * Test a startsWith an empty DN
      */
     @Test
-    public void testDnStartsWithEmpty() throws InvalidNameException
+    public void testDnStartsWithEmpty() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.startsWith( new DN() ) );
@@ -1128,7 +1127,7 @@ public class DNTest
      * Test a startsWith an simple DN
      */
     @Test
-    public void testDnStartsWithSimple() throws InvalidNameException
+    public void testDnStartsWithSimple() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.startsWith( new DN( "e=f" ) ) );
@@ -1139,7 +1138,7 @@ public class DNTest
      * Test a startsWith a complex DN
      */
     @Test
-    public void testDnStartsWithComplex() throws InvalidNameException
+    public void testDnStartsWithComplex() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.startsWith( new DN( "c =  d, e =  f" ) ) );
@@ -1150,7 +1149,7 @@ public class DNTest
      * Test a startsWith a complex DN
      */
     @Test
-    public void testDnStartsWithComplexMixedCase() throws InvalidNameException
+    public void testDnStartsWithComplexMixedCase() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( false, dn.startsWith( new DN( "c =  D, E =  f" ) ) );
@@ -1161,7 +1160,7 @@ public class DNTest
      * Test a startsWith a full DN
      */
     @Test
-    public void testDnStartsWithFull() throws InvalidNameException
+    public void testDnStartsWithFull() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.startsWith( new DN( "a=  b; c =  d, e =  f" ) ) );
@@ -1172,7 +1171,7 @@ public class DNTest
      * Test a startsWith which returns false
      */
     @Test
-    public void testDnStartsWithWrong() throws InvalidNameException
+    public void testDnStartsWithWrong() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( false, dn.startsWith( new DN( "c =  t, e =  f" ) ) );
@@ -1184,7 +1183,7 @@ public class DNTest
      * Test a endsWith a null DN
      */
     @Test
-    public void testDnEndsWithNull() throws InvalidNameException
+    public void testDnEndsWithNull() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.endsWith( null ) );
@@ -1195,7 +1194,7 @@ public class DNTest
      * Test a endsWith an empty DN
      */
     @Test
-    public void testDnEndsWithEmpty() throws InvalidNameException
+    public void testDnEndsWithEmpty() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.endsWith( new DN() ) );
@@ -1206,7 +1205,7 @@ public class DNTest
      * Test a endsWith an simple DN
      */
     @Test
-    public void testDnEndsWithSimple() throws InvalidNameException
+    public void testDnEndsWithSimple() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.endsWith( new DN( "a=b" ) ) );
@@ -1217,7 +1216,7 @@ public class DNTest
      * Test a endsWith a complex DN
      */
     @Test
-    public void testDnEndsWithComplex() throws InvalidNameException
+    public void testDnEndsWithComplex() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.endsWith( new DN( "a =  b, c =  d" ) ) );
@@ -1228,7 +1227,7 @@ public class DNTest
      * Test a endsWith a complex DN
      */
     @Test
-    public void testDnEndsWithComplexMixedCase() throws InvalidNameException
+    public void testDnEndsWithComplexMixedCase() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( false, dn.endsWith( new DN( "a =  B, C =  d" ) ) );
@@ -1239,7 +1238,7 @@ public class DNTest
      * Test a endsWith a full DN
      */
     @Test
-    public void testDnEndsWithFull() throws InvalidNameException
+    public void testDnEndsWithFull() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( true, dn.endsWith( new DN( "a=  b; c =  d, e =  f" ) ) );
@@ -1250,7 +1249,7 @@ public class DNTest
      * Test a endsWith which returns false
      */
     @Test
-    public void testDnEndsWithWrong() throws InvalidNameException
+    public void testDnEndsWithWrong() throws LdapException
     {
         DN dn = new DN( "a=b, c=d,e = f" );
         assertEquals( false, dn.endsWith( new DN( "a =  b, e =  f" ) ) );
@@ -1275,7 +1274,7 @@ public class DNTest
      * test a getAll operation on an empty DN
      */
     @Test
-    public void testDnGetAllEmpty() throws InvalidNameException
+    public void testDnGetAllEmpty() throws LdapException
     {
         DN dn = new DN( "" );
         Enumeration<String> nc = dn.getAll();
@@ -1288,7 +1287,7 @@ public class DNTest
      * test a getAll operation on a simple DN
      */
     @Test
-    public void testDnGetAllSimple() throws InvalidNameException
+    public void testDnGetAllSimple() throws LdapException
     {
         DN dn = new DN( "a=b" );
         Enumeration<String> nc = dn.getAll();
@@ -1303,7 +1302,7 @@ public class DNTest
      * test a getAll operation on a complex DN
      */
     @Test
-    public void testDnGetAllComplex() throws InvalidNameException
+    public void testDnGetAllComplex() throws LdapException
     {
         DN dn = new DN( "e=f+g=h,a=b,c=d" );
         Enumeration<String> nc = dn.getAll();
@@ -1322,7 +1321,7 @@ public class DNTest
      * test a getAll operation on a complex DN
      */
     @Test
-    public void testDnGetAllComplexOrdered() throws InvalidNameException
+    public void testDnGetAllComplexOrdered() throws LdapException
     {
         DN dn = new DN( "g=h+e=f,a=b,c=d" );
         Enumeration<String> nc = dn.getAll();
@@ -1357,7 +1356,7 @@ public class DNTest
      * test a clone operation on a simple DN
      */
     @Test
-    public void testDnCloneSimple() throws InvalidNameException
+    public void testDnCloneSimple() throws LdapException
     {
         DN dn = new DN( "a=b" );
         DN clone = ( DN ) dn.clone();
@@ -1372,7 +1371,7 @@ public class DNTest
      * test a clone operation on a complex DN
      */
     @Test
-    public void testDnCloneComplex() throws InvalidNameException
+    public void testDnCloneComplex() throws LdapException
     {
         DN dn = new DN( "e=f+g=h,a=b,c=d" );
         DN clone = ( DN ) dn.clone();
@@ -1399,7 +1398,7 @@ public class DNTest
      * test a get in an empty DN
      */
     @Test
-    public void testDnGetEmpty() throws InvalidNameException
+    public void testDnGetEmpty() throws LdapException
     {
         DN dn = new DN( "" );
         assertEquals( "", dn.get( 0 ) );
@@ -1410,7 +1409,7 @@ public class DNTest
      * test a get in a simple DN
      */
     @Test
-    public void testDnGetSimple() throws InvalidNameException
+    public void testDnGetSimple() throws LdapException
     {
         DN dn = new DN( "a = b" );
         assertEquals( "a=b", dn.get( 0 ) );
@@ -1421,7 +1420,7 @@ public class DNTest
      * test a get in a complex DN
      */
     @Test
-    public void testDnGetComplex() throws InvalidNameException
+    public void testDnGetComplex() throws LdapException
     {
         DN dn = new DN( "a = b + c= d, e= f; g =h" );
         assertEquals( "g=h", dn.get( 0 ) );
@@ -1434,7 +1433,7 @@ public class DNTest
      * test a get out of bound
      */
     @Test
-    public void testDnGetOutOfBound() throws InvalidNameException
+    public void testDnGetOutOfBound() throws LdapException
     {
         DN dn = new DN( "a = b + c= d, e= f; g =h" );
 
@@ -2594,7 +2593,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testName() throws NamingException
+    public void testName() throws LdapException
     {
         Name jName = new javax.naming.ldap.LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2608,7 +2607,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetPrefixName() throws NamingException
+    public void testGetPrefixName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2625,7 +2624,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetSuffix() throws NamingException
+    public void testGetSuffix() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2642,7 +2641,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddStringName() throws NamingException
+    public void testAddStringName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2657,7 +2656,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddIntString() throws NamingException
+    public void testAddIntString() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2680,7 +2679,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddAllName() throws NamingException
+    public void testAddAllName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2695,7 +2694,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testAddAllIntName() throws NamingException
+    public void testAddAllIntName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2718,7 +2717,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testStartsWithName() throws NamingException
+    public void testStartsWithName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2734,7 +2733,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testEndsWithName() throws NamingException
+    public void testEndsWithName() throws LdapException
     {
         Name name0 = new LdapName( "cn=zero" );
         Name name10 = new LdapName( "cn=one,cn=zero" );
@@ -2836,7 +2835,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testRemoveName() throws NamingException
+    public void testRemoveName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2853,7 +2852,7 @@ public class DNTest
      * Test for DIRSERVER-191
      */
     @Test
-    public void testGetAllName() throws NamingException
+    public void testGetAllName() throws LdapException
     {
         Name jName = new LdapName( "cn=four,cn=three,cn=two,cn=one" );
         Name aName = new DN( "cn=four,cn=three,cn=two,cn=one" );
@@ -2870,10 +2869,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-642
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDoubleQuoteInNameDIRSERVER_642() throws NamingException
+    public void testDoubleQuoteInNameDIRSERVER_642() throws LdapException
     {
         Name name1 = new DN( "cn=\"Kylie Minogue\",dc=example,dc=com" );
         Name name2 = new LdapName( "cn=\"Kylie Minogue\",dc=example,dc=com" );
@@ -2891,10 +2890,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-642
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDoubleQuoteInNameDIRSERVER_642_1() throws NamingException
+    public void testDoubleQuoteInNameDIRSERVER_642_1() throws LdapException
     {
         DN dn = new DN( "cn=\" Kylie Minogue \",dc=example,dc=com" );
 
@@ -2905,10 +2904,10 @@ public class DNTest
 
     /**
      * Test for DIRSTUDIO-250
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDoubleQuoteWithSpecialCharsInNameDIRSERVER_250() throws NamingException
+    public void testDoubleQuoteWithSpecialCharsInNameDIRSERVER_250() throws LdapException
     {
         DN dn = new DN( "a=\"b,c\"" );
 
@@ -2919,10 +2918,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testLeadingAndTrailingSpacesDIRSERVER_184() throws NamingException
+    public void testLeadingAndTrailingSpacesDIRSERVER_184() throws LdapException
     {
         DN name = new DN( "dn= \\ four spaces leading and 3 trailing \\  " );
 
@@ -2933,7 +2932,7 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
     public void testDIRSERVER_184_1()
@@ -2942,7 +2941,7 @@ public class DNTest
         {
             new DN( "dn=middle\\ spaces" );
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertTrue( true );
         }
@@ -2951,7 +2950,7 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
     public void testDIRSERVER_184_2()
@@ -2960,7 +2959,7 @@ public class DNTest
         {
             new DN( "dn=# a leading pound" );
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertTrue( true );
         }
@@ -2969,10 +2968,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDIRSERVER_184_3() throws NamingException
+    public void testDIRSERVER_184_3() throws LdapException
     {
         DN name = new DN( "dn=\\# a leading pound" );
 
@@ -2983,10 +2982,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDIRSERVER_184_4() throws NamingException
+    public void testDIRSERVER_184_4() throws LdapException
     {
         DN name = new DN( "dn=a middle \\# pound" );
 
@@ -2997,10 +2996,10 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDIRSERVER_184_5() throws NamingException
+    public void testDIRSERVER_184_5() throws LdapException
     {
         DN name = new DN( "dn=a trailing pound \\#" );
 
@@ -3011,7 +3010,7 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
     public void testDIRSERVER_184_6()
@@ -3020,7 +3019,7 @@ public class DNTest
         {
             new DN( "dn=a middle # pound" );
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertTrue( true );
         }
@@ -3029,7 +3028,7 @@ public class DNTest
 
     /**
      * Test for DIRSERVER-184
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
     public void testDIRSERVER_184_7()
@@ -3038,7 +3037,7 @@ public class DNTest
         {
             new DN( "dn=a trailing pound #" );
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             assertTrue( true );
         }
@@ -3046,7 +3045,7 @@ public class DNTest
 
 
     @Test
-    public void testDIRSERVER_631_1() throws NamingException
+    public void testDIRSERVER_631_1() throws LdapException
     {
         DN name = new DN( "cn=Bush\\, Kate,dc=example,dc=com" );
 
@@ -3059,10 +3058,10 @@ public class DNTest
     /**
      * Added a test to check the parsing of a DN with more than one RDN
      * which are OIDs, and with one RDN which has more than one atav.
-     * @throws NamingException
+     * @throws LdapException
      */
     @Test
-    public void testDNWithMultiOidsRDN() throws NamingException
+    public void testDNWithMultiOidsRDN() throws LdapException
     {
         DN name = new DN(
             "0.9.2342.19200300.100.1.1=00123456789+2.5.4.3=pablo picasso,2.5.4.11=search,2.5.4.10=imc,2.5.4.6=us" );
@@ -3076,7 +3075,7 @@ public class DNTest
 
 
     @Test
-    public void testNameAddAll() throws NamingException
+    public void testNameAddAll() throws LdapException
     {
         Properties props = new Properties();
         props.setProperty( "jndi.syntax.direction", "right_to_left" );
@@ -3099,7 +3098,7 @@ public class DNTest
 
 
     @Test
-    public void testDNEquals() throws NamingException
+    public void testDNEquals() throws LdapException
     {
         DN dn1 = new DN( "a=b,c=d,e=f" );
         DN dn2 = new DN( "a=b\\,c\\=d,e=f" );
@@ -3109,7 +3108,7 @@ public class DNTest
 
 
     @Test
-    public void testDNAddEmptyString() throws NamingException
+    public void testDNAddEmptyString() throws LdapException
     {
         DN dn = new DN();
         assertTrue( dn.size() == 0 );
@@ -3121,7 +3120,7 @@ public class DNTest
      * This leads to the bug in DIRSERVER-832.
      */
     @Test
-    public void testPreserveAttributeIdCase() throws NamingException
+    public void testPreserveAttributeIdCase() throws LdapException
     {
         DN dn = new DN( "uID=kevin" );
         assertEquals( "uID", dn.getRdn().getUpType() );
@@ -3332,7 +3331,7 @@ public class DNTest
     }
     
     @Test
-    public void testCompositeRDN() throws InvalidNameException
+    public void testCompositeRDN() throws LdapException
     {
         assertTrue( DN.isValid( "a=b+c=d+e=f,g=h" ) );
 
@@ -3342,7 +3341,7 @@ public class DNTest
     }
 
     @Test
-    public void testCompositeRDNOids() throws InvalidNameException
+    public void testCompositeRDNOids() throws LdapException
     {
         assertTrue( DN.isValid( "1.2.3.4.5=0+1.2.3.4.6=0+1.2.3.4.7=omnischmomni,2.5.4.3=subtree,0.9.2342.19200300.100.1.25=example,0.9.2342.19200300.100.1.25=com" ) );
 
@@ -3355,7 +3354,7 @@ public class DNTest
      * Tests that AttributeTypeAndValues are correctly trimmed.
      */
     @Test
-    public void testTrimAtavs() throws InvalidNameException
+    public void testTrimAtavs() throws LdapException
     {
         // antlr parser: string value with trailing spaces
         DN dn1 = new DN( " cn = Amos\\,Tori , ou=system " );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java?rev=923524&r1=923523&r2=923524&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java Tue Mar 16 00:31:36 2010
@@ -22,8 +22,7 @@ package org.apache.directory.shared.ldap
 
 import java.util.ArrayList;
 
-import javax.naming.InvalidNameException;
-
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.junit.Test;
 import static org.junit.Assert.fail;
 
@@ -48,7 +47,7 @@ public class DnParserDIRSERVER_584_Test
            DnParser.parseInternal( "ou=test+testing", new ArrayList<RDN>() );
            fail( "should never get here" );
        }
-       catch ( InvalidNameException e )
+       catch ( LdapException e )
        {
            // Nothing to do
        }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java?rev=923524&r1=923523&r2=923524&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserTest.java Tue Mar 16 00:31:36 2010
@@ -20,11 +20,10 @@
 package org.apache.directory.shared.ldap.name;
 
 
-import javax.naming.InvalidNameException;
 import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 import static org.junit.Assert.fail;
@@ -50,9 +49,9 @@ public class DnParserTest
      * test an empty DN
      */
     @Test
-    public void testLdapDNEmpty() throws NamingException
+    public void testLdapDNEmpty() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
 
         assertEquals( "", ( ( DN ) dnParser.parse( "" ) ).getName() );
     }
@@ -62,9 +61,9 @@ public class DnParserTest
      * test a simple DN : a = b
      */
     @Test
-    public void testLdapDNSimple() throws NamingException
+    public void testLdapDNSimple() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
 
         assertEquals( "a = b", ( ( DN ) dnParser.parse( "a = b" ) ).getName() );
         assertEquals( "a=b", ( ( DN ) dnParser.parse( "a = b" ) ).getNormName() );
@@ -75,9 +74,9 @@ public class DnParserTest
      * test a composite DN : a = b, d = e
      */
     @Test
-    public void testLdapDNComposite() throws NamingException
+    public void testLdapDNComposite() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = b, c = d" );
         assertEquals( "a=b,c=d", dn.getNormName() );
         assertEquals( "a = b, c = d", dn.getName() );
@@ -88,9 +87,9 @@ public class DnParserTest
      * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
      */
     @Test
-    public void testLdapDNCompositeWithSpace() throws NamingException
+    public void testLdapDNCompositeWithSpace() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a=b, a =b, a= b, a = b, a  =  b" );
         assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNormName() );
         assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
@@ -102,9 +101,9 @@ public class DnParserTest
      * return a=b,c=d,e=f (the ';' is replaced by a ',')
      */
     @Test
-    public void testLdapDNCompositeSepators() throws NamingException
+    public void testLdapDNCompositeSepators() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a=b;c=d,e=f" );
         assertEquals( "a=b,c=d,e=f", dn.getNormName() );
         assertEquals( "a=b;c=d,e=f", dn.getName() );
@@ -115,9 +114,9 @@ public class DnParserTest
      * test a simple DN with multiple NameComponents : a = b + c = d
      */
     @Test
-    public void testLdapDNSimpleMultivaluedAttribute() throws NamingException
+    public void testLdapDNSimpleMultivaluedAttribute() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = b + c = d" );
         assertEquals( "a=b+c=d", dn.getNormName() );
         assertEquals( "a = b + c = d", dn.getName() );
@@ -129,9 +128,9 @@ public class DnParserTest
      * i=j
      */
     @Test
-    public void testLdapDNCompositeMultivaluedAttribute() throws NamingException
+    public void testLdapDNCompositeMultivaluedAttribute() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a=b+c=d, e=f + g=h + i=j" );
         assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.getNormName() );
         assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getName() );
@@ -142,9 +141,9 @@ public class DnParserTest
      * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
      */
     @Test
-    public void testLdapDNOidUpper() throws NamingException
+    public void testLdapDNOidUpper() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "OID.12.34.56 = azerty" );
         assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
         assertEquals( "OID.12.34.56 = azerty", dn.getName() );
@@ -155,9 +154,9 @@ public class DnParserTest
      * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
      */
     @Test
-    public void testLdapDNOidLower() throws NamingException
+    public void testLdapDNOidLower() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "oid.12.34.56 = azerty" );
         assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
         assertEquals( "oid.12.34.56 = azerty", dn.getName() );
@@ -169,9 +168,9 @@ public class DnParserTest
      * azerty
      */
     @Test
-    public void testLdapDNOidWithoutPrefix() throws NamingException
+    public void testLdapDNOidWithoutPrefix() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "12.34.56 = azerty" );
         assertEquals( "12.34.56=azerty", dn.getNormName() );
         assertEquals( "12.34.56 = azerty", dn.getName() );
@@ -183,9 +182,9 @@ public class DnParserTest
      * azerty; 7.8 = test
      */
     @Test
-    public void testLdapDNCompositeOidWithoutPrefix() throws NamingException
+    public void testLdapDNCompositeOidWithoutPrefix() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "12.34.56 = azerty; 7.8 = test" );
         assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
         assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
@@ -196,9 +195,9 @@ public class DnParserTest
      * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
      */
     @Test
-    public void testLdapDNPairCharAttributeValue() throws NamingException
+    public void testLdapDNPairCharAttributeValue() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" );
         assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00e9", dn.getNormName() );
         assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9", dn.getName() );
@@ -213,9 +212,9 @@ public class DnParserTest
      * test a simple DN with hexString attribute value : a = #0010A0AAFF
      */
     @Test
-    public void testLdapDNHexStringAttributeValue() throws NamingException
+    public void testLdapDNHexStringAttributeValue() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = #0010A0AAFF" );
         assertEquals( "a=#0010A0AAFF", dn.getNormName() );
         assertEquals( "a = #0010A0AAFF", dn.getName() );
@@ -226,21 +225,21 @@ public class DnParserTest
      * test exception from illegal hexString attribute value : a=#zz.
      */
     @Test
-    public void testBadLdapDNHexStringAttributeValue() throws InvalidNameException
+    public void testBadLdapDNHexStringAttributeValue() throws LdapException
     {
         try
         {
-            NameParser dnParser = DnParser.getNameParser();
+            DnParser dnParser = DnParser.getNameParser();
             dnParser.parse( "a=#zz" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapInvalidDnException ine )
         {
-            assertTrue( true );
+            fail();
         }
-        catch ( NamingException ine )
+        catch ( LdapException ine )
         {
-            fail();
+            assertTrue( true );
         }
     }
     
@@ -249,9 +248,9 @@ public class DnParserTest
      * test a simple DN with quoted attribute value : a = "quoted \"value"
      */
     @Test
-    public void testLdapDNQuotedAttributeValue() throws NamingException
+    public void testLdapDNQuotedAttributeValue() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = quoted \\\"value" );
         assertEquals( "a=quoted \\\"value", dn.getNormName() );
         assertEquals( "a = quoted \\\"value", dn.getName() );
@@ -266,9 +265,9 @@ public class DnParserTest
      * Tests a corner case of the parser because the sequence "\DC" is also a valid hex pair
      */
     @Test
-    public void testLdapDNBackslashInAttributeValue() throws NamingException
+    public void testLdapDNBackslashInAttributeValue() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = AC\\\\DC" );
         assertEquals( "a=AC\\\\DC", dn.getNormName() );
         assertEquals( "a = AC\\\\DC", dn.getName() );
@@ -279,9 +278,9 @@ public class DnParserTest
      * Test the encoding of a LdanDN
      */
     @Test
-    public void testNameToBytes() throws NamingException
+    public void testNameToBytes() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "cn = John, ou = People, OU = Marketing" );
 
         byte[] bytes = DN.getBytes( dn );
@@ -292,13 +291,13 @@ public class DnParserTest
 
 
     @Test
-    public void testStringParser() throws NamingException
+    public void testStringParser() throws LdapException
     {
         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' } );
 
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
 
         assertEquals( dn, name.getName() );
@@ -307,12 +306,12 @@ public class DnParserTest
 
 
     @Test
-    public void testStringParserShort() throws NamingException
+    public void testStringParserShort() throws LdapException
     {
         String dn = StringTools.utf8ToString( new byte[]
             { 'C', '=', ' ', 'E', ( byte ) 0xc3, ( byte ) 0xa9, 'c' } );
 
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
 
         assertEquals( dn, name.getName() );
@@ -321,9 +320,9 @@ public class DnParserTest
 
 
     @Test
-    public void testVsldapExtras() throws NamingException
+    public void testVsldapExtras() throws LdapException
     {
-        NameParser dnParser = DnParser.getNameParser();
+        DnParser dnParser = DnParser.getNameParser();
         DN name = ( DN ) dnParser
             .parse( "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US" );
 
@@ -342,12 +341,12 @@ public class DnParserTest
     /**
      * Class under test for void DnParser()
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     public final void testDnParser()
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         assertNotNull( parser );
     }
@@ -356,12 +355,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringEmpty() throws NamingException
+    public final void testParseStringEmpty() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameEmpty = parser.parse( "" );
 
@@ -372,12 +371,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringNull() throws NamingException
+    public final void testParseStringNull() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameNull = parser.parse( null );
 
@@ -388,12 +387,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC1779_1() throws NamingException
+    public final void testParseStringRFC1779_1() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC1779_1 = parser
             .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
@@ -409,12 +408,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_1() throws NamingException
+    public final void testParseStringRFC2253_1() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
 
@@ -425,12 +424,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_2() throws NamingException
+    public final void testParseStringRFC2253_2() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_2 = parser.parse( "CN = Sales + CN =   J. Smith , O = Widget Inc. , C = US" );
 
@@ -443,12 +442,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_3() throws NamingException
+    public final void testParseStringRFC2253_3() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_3 = parser.parse( "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB" );
 
@@ -461,12 +460,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_4() throws NamingException
+    public final void testParseStringRFC2253_4() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_4 = parser.parse( "CN=Before\\0DAfter,O=Test,C=GB" );
         assertEquals( "RFC2253_4 : ", "CN=Before\\0DAfter,O=Test,C=GB", ( ( DN ) nameRFC2253_4 ).getName() );
@@ -476,12 +475,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_5() throws NamingException
+    public final void testParseStringRFC2253_5() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_5 = parser.parse( "1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB" );
 
@@ -493,12 +492,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
-    public final void testParseStringRFC2253_6() throws NamingException
+    public final void testParseStringRFC2253_6() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         Name nameRFC2253_6 = parser.parse( "SN=Lu\\C4\\8Di\\C4\\87" );
 
@@ -509,12 +508,12 @@ public class DnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     public final void testParseInvalidString()
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
 
         try
         {
@@ -534,12 +533,12 @@ public class DnParserTest
      * bug encountered in DIREVE-179 <a
      * href="http://issues.apache.org/jira/browse/DIREVE-179"> here</a>.
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong on parse()
      */
-    public final void testPreserveSpaceAfterEscape() throws NamingException
+    public final void testPreserveSpaceAfterEscape() throws LdapException
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String input = "ou=some test\\,  something else";
         String result = parser.parse( input ).toString();
         assertEquals( "ou=some test\\,  something else", result );
@@ -551,7 +550,7 @@ public class DnParserTest
     {
         // '\' should be escaped as stated in RFC 2253
         String path = "windowsFilePath=C:\\\\cygwin";
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         Name result = parser.parse( path );
         assertEquals( path, ( ( DN ) result ).getName() );
         assertEquals( "windowsfilepath=C:\\\\cygwin", ((DN)result).getNormName() );
@@ -565,7 +564,7 @@ public class DnParserTest
             { 'c', 'n', '=', 0x4A, ( byte ) 0xC3, ( byte ) 0xA9, 0x72, ( byte ) 0xC3, ( byte ) 0xB4, 0x6D, 0x65 },
             "UTF-8" );
 
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=J\u00e9r\u00f4me", result.toString() );
@@ -580,7 +579,7 @@ public class DnParserTest
                 ( byte ) 0xC3, ( byte ) 0x9F, ( byte ) 0xC3, ( byte ) 0xA4, ( byte ) 0xC3, ( byte ) 0xB6,
                 ( byte ) 0xC3, ( byte ) 0xBC }, "UTF-8" );
 
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=\u00C4\u00D6\u00DC\u00DF\u00E4\u00F6\u00FC", result.toString() );
@@ -596,7 +595,7 @@ public class DnParserTest
                 ( byte ) 0xC3, ( byte ) 0x9C, ( byte ) 0xC3, ( byte ) 0xBC, ( byte ) 0xC4, ( byte ) 0x9E,
                 ( byte ) 0xC4, ( byte ) 0x9F }, "UTF-8" );
 
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=\u0130\u0131\u015E\u015F\u00D6\u00F6\u00DC\u00FC\u011E\u011F", result.toString() );
@@ -609,7 +608,7 @@ public class DnParserTest
         String cn = new String( new byte[] { 'c', 'n', '=', (byte)0xC3, (byte)0x84, 0x5C, 0x32, 0x42 }, "UTF-8" );
 
 
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String result = ((DN)parser.parse( cn )).getNormName();
         
         assertEquals( "cn=\u00c4\\+", result );
@@ -621,7 +620,7 @@ public class DnParserTest
     {
         String cn = new String( new byte[] { 'c', 'n', '=', (byte)0xC3, (byte)0x84, '\\', '+' }, "UTF-8" );
         
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String result = parser.parse( cn ).toString();
         
         assertEquals( "cn=\u00c4\\+", result );
@@ -632,12 +631,12 @@ public class DnParserTest
      * Test to check that even with a non escaped char, the DN is parsed ok
      * or at least an error is generated.
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong on parse()
      */
     public final void testNonEscapedChars()
     {
-        NameParser parser = DnParser.getNameParser();
+        DnParser parser = DnParser.getNameParser();
         String input = "ou=ou+test";
 
         try
@@ -645,7 +644,7 @@ public class DnParserTest
             parser.parse( input ).toString();
             fail( "Should never rech this point" );
         }
-        catch ( NamingException ne )
+        catch ( LdapException ne )
         {
             assertTrue( true );
             return;

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java?rev=923524&r1=923523&r2=923524&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java Tue Mar 16 00:31:36 2010
@@ -20,11 +20,9 @@
 package org.apache.directory.shared.ldap.name;
 
 
-import javax.naming.InvalidNameException;
 import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -48,9 +46,9 @@ public class FastDnParserTest
      * test an empty DN
      */
     @Test
-    public void testLdapDNEmpty() throws NamingException
+    public void testLdapDNEmpty() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         assertEquals( "", ( ( DN ) dnParser.parse( "" ) ).getName() );
     }
 
@@ -60,9 +58,9 @@ public class FastDnParserTest
      * run into infinite loops.
      */
     @Test
-    public void testLdapDNIncomplete() throws NamingException
+    public void testLdapDNIncomplete() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
 
         // empty DN is ok
         dnParser.parse( " " );
@@ -73,7 +71,7 @@ public class FastDnParserTest
             dnParser.parse( " a" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -82,7 +80,7 @@ public class FastDnParserTest
             dnParser.parse( " a " );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -91,7 +89,7 @@ public class FastDnParserTest
             dnParser.parse( " a- " );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -105,7 +103,7 @@ public class FastDnParserTest
             dnParser.parse( " 1 = b " );
             fail( "OID must contain at least on dot." );
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -114,7 +112,7 @@ public class FastDnParserTest
             dnParser.parse( " 0" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -123,7 +121,7 @@ public class FastDnParserTest
             dnParser.parse( " 0." );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -132,7 +130,7 @@ public class FastDnParserTest
             dnParser.parse( " 0.5" );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
@@ -141,10 +139,11 @@ public class FastDnParserTest
             dnParser.parse( " 0.5 " );
             fail();
         }
-        catch ( InvalidNameException ine )
+        catch ( LdapException ine )
         {
             // expected
         }
+        
         dnParser.parse( " 0.5=" );
         dnParser.parse( " 0.5 = " );
         dnParser.parse( " 0.5 = b" );
@@ -155,9 +154,9 @@ public class FastDnParserTest
      * test a simple DN : a = b
      */
     @Test
-    public void testLdapDNSimple() throws NamingException
+    public void testLdapDNSimple() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = b" );
 
         assertEquals( "a = b", dn.getName() );
@@ -181,9 +180,9 @@ public class FastDnParserTest
      * test a composite DN : a = b, d = e
      */
     @Test
-    public void testLdapDNComposite() throws NamingException
+    public void testLdapDNComposite() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a = b, c = d" );
         assertEquals( "a=b,c=d", dn.getNormName() );
         assertEquals( "a = b, c = d", dn.getName() );
@@ -194,9 +193,9 @@ public class FastDnParserTest
      * test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
      */
     @Test
-    public void testLdapDNCompositeWithSpace() throws NamingException
+    public void testLdapDNCompositeWithSpace() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a=b, a =b, a= b, a = b, a  =  b" );
         assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNormName() );
         assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
@@ -208,9 +207,9 @@ public class FastDnParserTest
      * return a=b,c=d,e=f (the ';' is replaced by a ',')
      */
     @Test
-    public void testLdapDNCompositeSepators() throws NamingException
+    public void testLdapDNCompositeSepators() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "a=b;c=d,e=f" );
         assertEquals( "a=b,c=d,e=f", dn.getNormName() );
         assertEquals( "a=b;c=d,e=f", dn.getName() );
@@ -221,9 +220,9 @@ public class FastDnParserTest
      * test a simple DN with multiple NameComponents : a = b + c = d
      */
     @Test
-    public void testLdapDNSimpleMultivaluedAttribute() throws NamingException
+    public void testLdapDNSimpleMultivaluedAttribute() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "a = b + c = d" );
@@ -241,9 +240,9 @@ public class FastDnParserTest
      * i=j
      */
     @Test
-    public void testLdapDNCompositeMultivaluedAttribute() throws NamingException
+    public void testLdapDNCompositeMultivaluedAttribute() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "a=b+c=d, e=f + g=h + i=j" );
@@ -260,9 +259,9 @@ public class FastDnParserTest
      * test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
      */
     @Test
-    public void testLdapDNOidUpper() throws NamingException
+    public void testLdapDNOidUpper() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "OID.12.34.56 = azerty" );
@@ -279,9 +278,9 @@ public class FastDnParserTest
      * test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
      */
     @Test
-    public void testLdapDNOidLower() throws NamingException
+    public void testLdapDNOidLower() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "oid.12.34.56 = azerty" );
@@ -299,9 +298,9 @@ public class FastDnParserTest
      * azerty
      */
     @Test
-    public void testLdapDNOidWithoutPrefix() throws NamingException
+    public void testLdapDNOidWithoutPrefix() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "12.34.56 = azerty" );
         assertEquals( "12.34.56=azerty", dn.getNormName() );
         assertEquals( "12.34.56 = azerty", dn.getName() );
@@ -313,9 +312,9 @@ public class FastDnParserTest
      * azerty; 7.8 = test
      */
     @Test
-    public void testLdapDNCompositeOidWithoutPrefix() throws NamingException
+    public void testLdapDNCompositeOidWithoutPrefix() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "12.34.56 = azerty; 7.8 = test" );
         assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
         assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
@@ -326,9 +325,9 @@ public class FastDnParserTest
      * test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
      */
     @Test
-    public void testLdapDNPairCharAttributeValue() throws NamingException
+    public void testLdapDNPairCharAttributeValue() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" );
@@ -345,9 +344,9 @@ public class FastDnParserTest
      * test a simple DN with hexString attribute value : a = #0010A0AAFF
      */
     @Test
-    public void testLdapDNHexStringAttributeValue() throws NamingException
+    public void testLdapDNHexStringAttributeValue() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "a = #0010A0AAFF" );
@@ -364,11 +363,11 @@ public class FastDnParserTest
      * test exception from illegal hexString attribute value : a=#zz.
      */
     @Test
-    public void testBadLdapDNHexStringAttributeValue() throws NamingException
+    public void testBadLdapDNHexStringAttributeValue() throws LdapException
     {
         try
         {
-            NameParser dnParser = FastDnParser.getNameParser();
+            FastDnParser dnParser = FastDnParser.getNameParser();
             dnParser.parse( "a=#zz" );
             fail( "Hex DNs not supported by fast parser" );
         }
@@ -383,9 +382,9 @@ public class FastDnParserTest
      * test a simple DN with quoted attribute value : a = "quoted \"value"
      */
     @Test
-    public void testLdapDNQuotedAttributeValue() throws NamingException
+    public void testLdapDNQuotedAttributeValue() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser.parse( "a = quoted \\\"value" );
@@ -402,9 +401,9 @@ public class FastDnParserTest
      * Test the encoding of a LdanDN
      */
     @Test
-    public void testNameToBytes() throws NamingException
+    public void testNameToBytes() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN dn = ( DN ) dnParser.parse( "cn = John, ou = People, OU = Marketing" );
 
         byte[] bytes = DN.getBytes( dn );
@@ -415,13 +414,13 @@ public class FastDnParserTest
 
 
     @Test
-    public void testStringParser() throws NamingException
+    public void testStringParser() throws LdapException
     {
         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' } );
 
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
 
         assertEquals( dn, name.getName() );
@@ -430,12 +429,12 @@ public class FastDnParserTest
 
 
     @Test
-    public void testStringParserShort() throws NamingException
+    public void testStringParserShort() throws LdapException
     {
         String dn = StringTools.utf8ToString( new byte[]
             { 'C', '=', ' ', 'E', ( byte ) 0xc3, ( byte ) 0xa9, 'c' } );
 
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         DN name = ( DN ) dnParser.parse( dn );
 
         assertEquals( dn, name.getName() );
@@ -444,9 +443,9 @@ public class FastDnParserTest
 
 
     @Test
-    public void testVsldapExtras() throws NamingException
+    public void testVsldapExtras() throws LdapException
     {
-        NameParser dnParser = FastDnParser.getNameParser();
+        FastDnParser dnParser = FastDnParser.getNameParser();
         try
         {
             dnParser
@@ -461,15 +460,15 @@ public class FastDnParserTest
 
 
     /**
-     * Class under test for void DnParser()
+     * Class under test for void FastDnParser()
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
     public final void testDnParser()
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         assertNotNull( parser );
     }
@@ -478,13 +477,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringEmpty() throws NamingException
+    public final void testParseStringEmpty() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         Name nameEmpty = parser.parse( "" );
 
@@ -495,13 +494,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringNull() throws NamingException
+    public final void testParseStringNull() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         Name nameNull = parser.parse( null );
 
@@ -512,13 +511,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC1779_1() throws NamingException
+    public final void testParseStringRFC1779_1() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         Name nameRFC1779_1 = parser
             .parse( "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US" );
@@ -534,13 +533,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_1() throws NamingException
+    public final void testParseStringRFC2253_1() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         Name nameRFC2253_1 = parser.parse( "CN=Steve Kille,O=Isode limited,C=GB" );
 
@@ -551,13 +550,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_2() throws NamingException
+    public final void testParseStringRFC2253_2() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
@@ -574,13 +573,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_3() throws NamingException
+    public final void testParseStringRFC2253_3() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
@@ -597,13 +596,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_4() throws NamingException
+    public final void testParseStringRFC2253_4() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
@@ -620,13 +619,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_5() throws NamingException
+    public final void testParseStringRFC2253_5() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
@@ -643,13 +642,13 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
-    public final void testParseStringRFC2253_6() throws NamingException
+    public final void testParseStringRFC2253_6() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
@@ -666,20 +665,20 @@ public class FastDnParserTest
     /**
      * Class under test for Name parse(String)
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong
      */
     @Test
     public final void testParseInvalidString()
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
 
         try
         {
             parser.parse( "&#347;=&#347;rasulu,dc=example,dc=com" );
             fail( "the invalid name should never succeed in a parse" );
         }
-        catch ( NamingException e )
+        catch ( LdapException e )
         {
             assertNotNull( e );
         }
@@ -692,13 +691,13 @@ public class FastDnParserTest
      * bug encountered in DIREVE-179 <a
      * href="http://issues.apache.org/jira/browse/DIREVE-179"> here</a>.
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong on parse()
      */
     @Test
-    public final void testPreserveSpaceAfterEscape() throws NamingException
+    public final void testPreserveSpaceAfterEscape() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         String input = "ou=some test\\,  something else";
         try
         {
@@ -717,7 +716,7 @@ public class FastDnParserTest
     {
         // '\' should be escaped as stated in RFC 2253
         String path = "windowsFilePath=C:\\\\cygwin";
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         try
         {
             parser.parse( path );
@@ -737,7 +736,7 @@ public class FastDnParserTest
             { 'c', 'n', '=', 0x4A, ( byte ) 0xC3, ( byte ) 0xA9, 0x72, ( byte ) 0xC3, ( byte ) 0xB4, 0x6D, 0x65 },
             "UTF-8" );
 
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=J\u00e9r\u00f4me", result );
@@ -753,7 +752,7 @@ public class FastDnParserTest
                 ( byte ) 0xC3, ( byte ) 0x9F, ( byte ) 0xC3, ( byte ) 0xA4, ( byte ) 0xC3, ( byte ) 0xB6,
                 ( byte ) 0xC3, ( byte ) 0xBC }, "UTF-8" );
 
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=\u00C4\u00D6\u00DC\u00DF\u00E4\u00F6\u00FC", result );
@@ -769,7 +768,7 @@ public class FastDnParserTest
                 ( byte ) 0xC3, ( byte ) 0x9C, ( byte ) 0xC3, ( byte ) 0xBC, ( byte ) 0xC4, ( byte ) 0x9E,
                 ( byte ) 0xC4, ( byte ) 0x9F }, "UTF-8" );
 
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         String result = parser.parse( cn ).toString();
 
         assertEquals( "cn=\u0130\u0131\u015E\u015F\u00D6\u00F6\u00DC\u00FC\u011E\u011F", result );
@@ -782,7 +781,7 @@ public class FastDnParserTest
     {
         String cn = new String( new byte[]
             { 'c', 'n', '=', ( byte ) 0xC3, ( byte ) 0x84, 0x5C, 0x32, 0x42 }, "UTF-8" );
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         try
         {
             parser.parse( cn ).toString();
@@ -801,7 +800,7 @@ public class FastDnParserTest
         String cn = new String( new byte[]
             { 'c', 'n', '=', ( byte ) 0xC3, ( byte ) 0x84, '\\', '+' }, "UTF-8" );
 
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         try
         {
             parser.parse( cn ).toString();
@@ -818,13 +817,13 @@ public class FastDnParserTest
      * Test to check that even with a non escaped char, the DN is parsed ok
      * or at least an error is generated.
      *
-     * @throws NamingException
+     * @throws LdapException
      *             if anything goes wrong on parse()
      */
     @Test
-    public final void testNonEscapedChars() throws NamingException
+    public final void testNonEscapedChars() throws LdapException
     {
-        NameParser parser = FastDnParser.getNameParser();
+        FastDnParser parser = FastDnParser.getNameParser();
         String input = "ou=ou+test";
 
         try



Mime
View raw message