directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r925929 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/ apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ shared/trunk/dsml-parser/src/test/java/org/apache/dir...
Date Sun, 21 Mar 2010 23:14:20 GMT
Author: elecharny
Date: Sun Mar 21 23:14:20 2010
New Revision: 925929

URL: http://svn.apache.org/viewvc?rev=925929&view=rev
Log:
o Modified the RDN.compareTo() method to take a RDN as a parameter
o Fixed DIRSHARED-57

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
    directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modDNRequest/ModifyDNRequestTest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestCodec.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
Sun Mar 21 23:14:20 2010
@@ -249,7 +249,7 @@ public class JournalInterceptor extends 
             LdifEntry ldif = new LdifEntry();
             ldif.setChangeType( ChangeType.ModRdn );
             ldif.setDn( opContext.getDn() );
-            ldif.setNewRdn( opContext.getNewRdn().toString() );
+            ldif.setNewRdn( opContext.getNewRdn().getNormName() );
             ldif.setDeleteOldRdn( opContext.getDelOldDn() );
             
             journal.log( getPrincipal(), opRevision, ldif );
@@ -293,7 +293,7 @@ public class JournalInterceptor extends 
             LdifEntry ldif = new LdifEntry();
             ldif.setChangeType( ChangeType.ModDn );
             ldif.setDn( opContext.getDn() );
-            ldif.setNewRdn( opContext.getNewRdn().toString() );
+            ldif.setNewRdn( opContext.getNewRdn().getNormName() );
             ldif.setDeleteOldRdn( opContext.getDelOldDn() );
             ldif.setNewSuperior( opContext.getNewDn().getNormName() );
             

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ModifyDnHandler.java
Sun Mar 21 23:14:20 2010
@@ -74,11 +74,11 @@ public class ModifyDnHandler extends Lda
         
         try
         {
-            DN newRdn = new DN( req.getNewRdn().toString() );
+            DN newRdn = new DN( req.getNewRdn().getUpName() );
             newRdn.normalize( session.getCoreSession().getDirectoryService()
                 .getSchemaManager().getNormalizerMapping() );
             
-            DN oldRdn = new DN( req.getName().getRdn().toString() );
+            DN oldRdn = new DN( req.getName().getRdn().getUpName() );
             oldRdn.normalize( session.getCoreSession().getDirectoryService()
                 .getSchemaManager().getNormalizerMapping() );
             

Modified: directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modDNRequest/ModifyDNRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modDNRequest/ModifyDNRequestTest.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modDNRequest/ModifyDNRequestTest.java
(original)
+++ directory/shared/trunk/dsml-parser/src/test/java/org/apache/directory/shared/dsmlv2/modDNRequest/ModifyDNRequestTest.java
Sun Mar 21 23:14:20 2010
@@ -278,7 +278,7 @@ public class ModifyDNRequestTest extends
 
         assertEquals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM", modifyDNRequest.getEntry().getNormName()
);
 
-        assertEquals( "cn=Steve Jobs", modifyDNRequest.getNewRDN().toString() );
+        assertEquals( "cn=Steve Jobs", modifyDNRequest.getNewRDN().getNormName() );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestCodec.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestCodec.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestCodec.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestCodec.java
Sun Mar 21 23:14:20 2010
@@ -214,7 +214,7 @@ public class ModifyDNRequestCodec extend
      */
     protected int computeLengthProtocolOp()
     {
-        int newRdnlength = StringTools.getBytesUtf8( newRDN.toString() ).length;
+        int newRdnlength = StringTools.getBytesUtf8( newRDN.getUpName() ).length;
         modifyDNRequestLength = 1 + TLV.getNbBytes( DN.getNbBytes( entry ) ) + DN.getNbBytes(
entry ) + 1
             + TLV.getNbBytes( newRdnlength ) + newRdnlength + 1 + 1 + 1; // deleteOldRDN
 
@@ -255,7 +255,7 @@ public class ModifyDNRequestCodec extend
             Value.encode( buffer, DN.getBytes( entry ) );
 
             // The newRDN
-            Value.encode( buffer, newRDN.toString() );
+            Value.encode( buffer, newRDN.getUpName() );
 
             // The flag deleteOldRdn
             Value.encode( buffer, deleteOldRDN );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
Sun Mar 21 23:14:20 2010
@@ -731,7 +731,15 @@ public class DN implements Externalizabl
 
 
     /**
-     * {@inheritDoc}
+     * Get the given RDN as a String. The position is used in the 
+     * reverse order. Assuming that we have a DN like 
+     * <pre>dc=example,dc=apache,dc=org</pre>
+     * then :
+     * <li><code>get(0)</code> will return dc=org</li>
+     * <li><code>get(1)</code> will return dc=apache</li>
+     * <li><code>get(2)</code> will return dc=example</li>
+     * 
+     * @param posn The position of the wanted RDN in the DN.
      */
     public String get( int posn )
     {
@@ -743,7 +751,7 @@ public class DN implements Externalizabl
         {
             RDN rdn = rdns.get( rdns.size() - posn - 1 );
 
-            return rdn.toString();
+            return rdn.getNormName();
         }
     }
 
@@ -811,7 +819,8 @@ public class DN implements Externalizabl
 
 
     /**
-     * {@inheritDoc}
+     * @return The list of all the RDN for this DN, as Strings. This method
+     * retruns a User Provided form of each RDN, not a normalized form.
      */
     public Enumeration<String> getAll()
     {
@@ -842,7 +851,7 @@ public class DN implements Externalizabl
 
                 RDN rdn = rdns.get( rdns.size() - pos - 1 );
                 pos++;
-                return rdn.toString();
+                return rdn.getNormName();
             }
         };
     }
@@ -1169,7 +1178,7 @@ public class DN implements Externalizabl
         // RDN normalized name. The very same for upName.
         if (rdns.size() == 1 )
         {
-            normName = newRdn.toString();
+            normName = newRdn.getNormName();
             upName = newRdn.getUpName();
         }
         else
@@ -1221,11 +1230,11 @@ public class DN implements Externalizabl
     /**
      * {@inheritDoc}
      */
-    public Object remove( int posn ) throws LdapInvalidDnException
+    public RDN remove( int posn ) throws LdapInvalidDnException
     {
         if ( rdns.size() == 0 )
         {
-            return EMPTY_DN;
+            return RDN.EMPTY_RDN;
         }
 
         if ( ( posn < 0 ) || ( posn >= rdns.size() ) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
Sun Mar 21 23:14:20 2010
@@ -108,10 +108,13 @@ import org.slf4j.LoggerFactory;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class RDN implements Cloneable, Comparable, Externalizable, Iterable<AVA>
+public class RDN implements Cloneable, Comparable<RDN>, Externalizable, Iterable<AVA>
 {
     /** The LoggerFactory used by this class */
     protected static final Logger LOG = LoggerFactory.getLogger( RDN.class );
+    
+    /** An empty RDN */
+    public static final RDN EMPTY_RDN = new RDN();
 
     /**
     * Declares the Serial Version Uid.
@@ -750,82 +753,64 @@ public class RDN implements Cloneable, C
      * @return 0 if both rdn are equals. -1 if the current RDN is inferior, 1 if
      *         the current Rdn is superior, UNDEFINED otherwise.
      */
-    public int compareTo( Object object )
+    public int compareTo( RDN rdn )
     {
-        if ( object == null )
+        if ( rdn == null )
         {
             return SUPERIOR;
         }
 
-        if ( object instanceof RDN )
+        if ( rdn.nbAtavs != nbAtavs )
         {
-            RDN rdn = ( RDN ) object;
-
-            if ( rdn.nbAtavs != nbAtavs )
-            {
-                // We don't have the same number of ATAVs. The Rdn which
-                // has the higher number of Atav is the one which is
-                // superior
-                return nbAtavs - rdn.nbAtavs;
-            }
+            // We don't have the same number of ATAVs. The Rdn which
+            // has the higher number of Atav is the one which is
+            // superior
+            return nbAtavs - rdn.nbAtavs;
+        }
 
-            switch ( nbAtavs )
-            {
-                case 0:
-                    return EQUAL;
+        switch ( nbAtavs )
+        {
+            case 0:
+                return EQUAL;
 
-                case 1:
-                    return atav.compareTo( rdn.atav );
+            case 1:
+                return atav.compareTo( rdn.atav );
 
-                default:
-                    // We have more than one value. We will
-                    // go through all of them.
+            default:
+                // We have more than one value. We will
+                // go through all of them.
 
-                    // the types are already normalized and sorted in the atavs TreeSet
-                    // so we could compare the 1st with the 1st, then the 2nd with the 2nd,
etc.
-                    Iterator<AVA> localIterator = atavs.iterator();
-                    Iterator<AVA> paramIterator = rdn.atavs.iterator();
+                // the types are already normalized and sorted in the atavs TreeSet
+                // so we could compare the 1st with the 1st, then the 2nd with the 2nd, etc.
+                Iterator<AVA> localIterator = atavs.iterator();
+                Iterator<AVA> paramIterator = rdn.atavs.iterator();
 
-                    while ( localIterator.hasNext() || paramIterator.hasNext() )
+                while ( localIterator.hasNext() || paramIterator.hasNext() )
+                {
+                    if ( !localIterator.hasNext() )
                     {
-                        if ( !localIterator.hasNext() )
-                        {
-                            return SUPERIOR;
-                        }
-                        if ( !paramIterator.hasNext() )
-                        {
-                            return INFERIOR;
-                        }
+                        return SUPERIOR;
+                    }
+                    if ( !paramIterator.hasNext() )
+                    {
+                        return INFERIOR;
+                    }
 
-                        AVA localAtav = localIterator.next();
-                        AVA paramAtav = paramIterator.next();
-                        int result = localAtav.compareTo( paramAtav );
-                        if ( result != EQUAL )
-                        {
-                            return result;
-                        }
+                    AVA localAtav = localIterator.next();
+                    AVA paramAtav = paramIterator.next();
+                    int result = localAtav.compareTo( paramAtav );
+                    if ( result != EQUAL )
+                    {
+                        return result;
                     }
+                }
 
-                    return EQUAL;
-            }
-        }
-        else
-        {
-            return UNDEFINED;
+                return EQUAL;
         }
     }
 
 
     /**
-     * @return a String representation of the RDN
-     */
-    public String toString()
-    {
-        return normName == null ? "" : normName;
-    }
-
-
-    /**
      * @return the user provided name
      */
     public String getUpName()
@@ -990,7 +975,7 @@ public class RDN implements Cloneable, C
             return false;
         }
 
-        return compareTo( rdn ) == EQUAL;
+        return compareTo( (RDN)rdn ) == EQUAL;
     }
 
 
@@ -1465,4 +1450,13 @@ public class RDN implements Cloneable, C
                 break;
         }
     }
+
+
+    /**
+     * @return a String representation of the RDN
+     */
+    public String toString()
+    {
+        return upName == null ? "" : upName;
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnBranchNode.java
Sun Mar 21 23:14:20 2010
@@ -87,7 +87,7 @@ public class DnBranchNode<N> implements 
      */
     private DnNode<N> recursivelyAddElement( DnBranchNode<N> current, DN dn,
int index, N element ) throws LdapException
     {
-        String rdnAtIndex = dn.getRdn( index ).toString();
+        String rdnAtIndex = dn.getRdn( index ).getNormName();
         
         if ( index == dn.size() - 1 )
         {

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=925929&r1=925928&r2=925929&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
Sun Mar 21 23:14:20 2010
@@ -50,6 +50,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -538,7 +539,7 @@ public class DNTest
         DN dn = new DN( "a=b, c=d, e=f" );
 
         assertTrue( DN.isValid( "a=b, c=d, e=f" ) );
-        assertEquals( "e=f", dn.remove( 0 ).toString() );
+        assertEquals( "e=f", dn.remove( 0 ).getNormName() );
         assertEquals( "a=b,c=d", dn.getNormName() );
         assertEquals( "a=b, c=d", dn.getName() );
     }
@@ -553,7 +554,7 @@ public class DNTest
         DN dn = new DN( "a=b, c=d, e=f" );
 
         assertTrue( DN.isValid( "a=b, c=d, e=f" ) );
-        assertEquals( "c=d", dn.remove( 1 ).toString() );
+        assertEquals( "c=d", dn.remove( 1 ).getNormName() );
         assertEquals( "a=b, e=f", dn.getName() );
     }
 
@@ -581,7 +582,7 @@ public class DNTest
         DN dn = new DN( "a=b, c=d; e=f" );
 
         assertTrue( DN.isValid( "a=b, c=d; e=f" ) );
-        assertEquals( "c=d", dn.remove( 1 ).toString() );
+        assertEquals( "c=d", dn.remove( 1 ).getNormName() );
         assertEquals( "a=b, e=f", dn.getName() );
     }
 
@@ -1332,7 +1333,6 @@ public class DNTest
         assertEquals( "a=b", nc.nextElement() );
         assertEquals( true, nc.hasMoreElements() );
 
-        // The lowest atav should be the first one
         assertEquals( "e=f+g=h", nc.nextElement() );
         assertEquals( false, nc.hasMoreElements() );
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=925929&r1=925928&r2=925929&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Sun Mar 21 23:14:20 2010
@@ -78,7 +78,7 @@ public class RdnTest
     @Test
     public void testRdnSimple() throws LdapException
     {
-        assertEquals( "a=b", new RDN( "a = b" ).toString() );
+        assertEquals( "a=b", new RDN( "a = b" ).getNormName() );
     }
 
 
@@ -90,7 +90,7 @@ public class RdnTest
     @Test
     public void testRdnComposite() throws LdapException
     {
-        assertEquals( "a=b+c=d", new RDN( "a = b + c = d" ).toString() );
+        assertEquals( "a=b+c=d", new RDN( "a = b + c = d" ).getNormName() );
     }
 
 
@@ -103,22 +103,22 @@ public class RdnTest
     @Test
     public void testRdnCompositeWithSpace() throws LdapException
     {
-        assertEquals( "a=b", new RDN( "a=b" ).toString() );
-        assertEquals( "a=b", new RDN( " a=b" ).toString() );
-        assertEquals( "a=b", new RDN( "a =b" ).toString() );
-        assertEquals( "a=b", new RDN( "a= b" ).toString() );
-        assertEquals( "a=b", new RDN( "a=b " ).toString() );
-        assertEquals( "a=b", new RDN( " a =b" ).toString() );
-        assertEquals( "a=b", new RDN( " a= b" ).toString() );
-        assertEquals( "a=b", new RDN( " a=b " ).toString() );
-        assertEquals( "a=b", new RDN( "a = b" ).toString() );
-        assertEquals( "a=b", new RDN( "a =b " ).toString() );
-        assertEquals( "a=b", new RDN( "a= b " ).toString() );
-        assertEquals( "a=b", new RDN( " a = b" ).toString() );
-        assertEquals( "a=b", new RDN( " a =b " ).toString() );
-        assertEquals( "a=b", new RDN( " a= b " ).toString() );
-        assertEquals( "a=b", new RDN( "a = b " ).toString() );
-        assertEquals( "a=b", new RDN( " a = b " ).toString() );
+        assertEquals( "a=b", new RDN( "a=b" ).getNormName() );
+        assertEquals( "a=b", new RDN( " a=b" ).getNormName() );
+        assertEquals( "a=b", new RDN( "a =b" ).getNormName() );
+        assertEquals( "a=b", new RDN( "a= b" ).getNormName() );
+        assertEquals( "a=b", new RDN( "a=b " ).getNormName() );
+        assertEquals( "a=b", new RDN( " a =b" ).getNormName() );
+        assertEquals( "a=b", new RDN( " a= b" ).getNormName() );
+        assertEquals( "a=b", new RDN( " a=b " ).getNormName() );
+        assertEquals( "a=b", new RDN( "a = b" ).getNormName() );
+        assertEquals( "a=b", new RDN( "a =b " ).getNormName() );
+        assertEquals( "a=b", new RDN( "a= b " ).getNormName() );
+        assertEquals( "a=b", new RDN( " a = b" ).getNormName() );
+        assertEquals( "a=b", new RDN( " a =b " ).getNormName() );
+        assertEquals( "a=b", new RDN( " a= b " ).getNormName() );
+        assertEquals( "a=b", new RDN( "a = b " ).getNormName() );
+        assertEquals( "a=b", new RDN( " a = b " ).getNormName() );
     }
 
 
@@ -130,7 +130,7 @@ public class RdnTest
     @Test
     public void testRdnSimpleMultivaluedAttribute() throws LdapException
     {
-        String result = new RDN( "a = b + c = d" ).toString();
+        String result = new RDN( "a = b + c = d" ).getNormName();
         assertEquals( "a=b+c=d", result );
     }
 
@@ -163,7 +163,7 @@ public class RdnTest
     @Test
     public void testRdnOidUpper() throws LdapException
     {
-        assertEquals( "oid.12.34.56=azerty", new RDN( "OID.12.34.56 =  azerty" ).toString()
);
+        assertEquals( "oid.12.34.56=azerty", new RDN( "OID.12.34.56 =  azerty" ).getNormName()
);
     }
 
 
@@ -175,7 +175,7 @@ public class RdnTest
     @Test
     public void testRdnOidLower() throws LdapException
     {
-        assertEquals( "oid.12.34.56=azerty", new RDN( "oid.12.34.56 = azerty" ).toString()
);
+        assertEquals( "oid.12.34.56=azerty", new RDN( "oid.12.34.56 = azerty" ).getNormName()
);
     }
 
 
@@ -188,7 +188,7 @@ public class RdnTest
     @Test
     public void testRdnOidWithoutPrefix() throws LdapException
     {
-        assertEquals( "12.34.56=azerty", new RDN( "12.34.56 = azerty" ).toString() );
+        assertEquals( "12.34.56=azerty", new RDN( "12.34.56 = azerty" ).getNormName() );
     }
 
 
@@ -201,7 +201,7 @@ public class RdnTest
     @Test
     public void testRdnCompositeOidWithoutPrefix() throws LdapException
     {
-        String result = new RDN( "12.34.56 = azerty + 7.8 = test" ).toString();
+        String result = new RDN( "12.34.56 = azerty + 7.8 = test" ).getNormName();
         assertEquals( "12.34.56=azerty+7.8=test", result );
     }
 
@@ -217,7 +217,7 @@ public class RdnTest
         String rdn = StringTools.utf8ToString( new byte[]
             { 'a', '=', '\\', ',', '=', '\\', '+', '\\', '<', '\\', '>', '#', '\\',
';', '\\', '\\', '\\', '"', '\\',
                 'C', '3', '\\', 'A', '9' } );
-        assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00E9", new RDN( rdn ).toString()
);
+        assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00E9", new RDN( rdn ).getNormName()
);
     }
 
 
@@ -227,7 +227,7 @@ public class RdnTest
     @Test
     public void testRdnHexStringAttributeValue() throws LdapException
     {
-        assertEquals( "a=#0010A0AAFF", new RDN( "a = #0010A0AAFF" ).toString() );
+        assertEquals( "a=#0010A0AAFF", new RDN( "a = #0010A0AAFF" ).getNormName() );
     }
 
     /**
@@ -255,7 +255,7 @@ public class RdnTest
     @Test
     public void testRdnQuotedAttributeValue() throws LdapException
     {
-        assertEquals( "a=quoted \\\"value", new RDN( "a = quoted \\\"value" ).toString()
);
+        assertEquals( "a=quoted \\\"value", new RDN( "a = quoted \\\"value" ).getNormName()
);
     }
 
 
@@ -566,20 +566,6 @@ public class RdnTest
 
 
     /**
-     * Compares with a bad object
-     * 
-     * @throws LdapException
-     */
-    @Test
-    public void testRDNCompareToBadObject() throws LdapException
-    {
-        RDN rdn1 = new RDN( " a = b " );
-
-        assertEquals( RDN.UNDEFINED, rdn1.compareTo( "test" ) );
-    }
-
-
-    /**
      * Compares a simple NC to a simple NC.
      * 
      * @throws LdapException
@@ -878,7 +864,7 @@ public class RdnTest
     public void testRdnWithSpaces() throws LdapException
     {
         RDN rdn = new RDN( "cn=a\\ b\\ c" );
-        assertEquals( "cn=a b c", rdn.toString() );
+        assertEquals( "cn=a b c", rdn.getNormName() );
     }
 
 
@@ -887,14 +873,14 @@ public class RdnTest
     {
         RDN rdn1 = new RDN( "cn=a b c" );
         RDN rdn2 = new RDN( "cn=a\\ b\\ c" );
-        assertEquals( "cn=a b c", rdn1.toString() );
-        assertEquals( "cn=a b c", rdn2.toString() );
+        assertEquals( "cn=a b c", rdn1.getNormName() );
+        assertEquals( "cn=a b c", rdn2.getNormName() );
         assertTrue( rdn1.equals( rdn2 ) );
 
         RDN rdn3 = new RDN( "cn=\\ a b c\\ " );
         RDN rdn4 = new RDN( "cn=\\ a\\ b\\ c\\ " );
-        assertEquals( "cn=\\ a b c\\ ", rdn3.toString() );
-        assertEquals( "cn=\\ a b c\\ ", rdn4.toString() );
+        assertEquals( "cn=\\ a b c\\ ", rdn3.getNormName() );
+        assertEquals( "cn=\\ a b c\\ ", rdn4.getNormName() );
         assertTrue( rdn3.equals( rdn4 ) );
     }
 
@@ -904,14 +890,14 @@ public class RdnTest
     {
         RDN rdn1 = new RDN( "cn=a#b#c" );
         RDN rdn2 = new RDN( "cn=a\\#b\\#c" );
-        assertEquals( "cn=a#b#c", rdn1.toString() );
-        assertEquals( "cn=a#b#c", rdn2.toString() );
+        assertEquals( "cn=a#b#c", rdn1.getNormName() );
+        assertEquals( "cn=a#b#c", rdn2.getNormName() );
         assertTrue( rdn1.equals( rdn2 ) );
 
         RDN rdn3 = new RDN( "cn=\\#a#b#c\\#" );
         RDN rdn4 = new RDN( "cn=\\#a\\#b\\#c\\#" );
-        assertEquals( "cn=\\#a#b#c#", rdn3.toString() );
-        assertEquals( "cn=\\#a#b#c#", rdn4.toString() );
+        assertEquals( "cn=\\#a#b#c#", rdn3.getNormName() );
+        assertEquals( "cn=\\#a#b#c#", rdn4.getNormName() );
         assertTrue( rdn3.equals( rdn4 ) );
     }
 
@@ -1365,8 +1351,8 @@ public class RdnTest
     {
         assertTrue( RdnParser.isValid( "a=" ) );
         assertTrue( RdnParser.isValid( "a=\"\"" ) );
-        assertEquals( "a=", new RDN( "a=\"\"" ).toString() );
-        assertEquals( "a=", new RDN( "a=" ).toString() );
+        assertEquals( "a=", new RDN( "a=\"\"" ).getNormName() );
+        assertEquals( "a=", new RDN( "a=" ).getNormName() );
     }
 
 
@@ -1377,16 +1363,16 @@ public class RdnTest
     public void testRdnWithEscapedComa() throws LdapException
     {
         assertTrue( RdnParser.isValid( "a=b\\,c" ) );
-        assertEquals( "a=b\\,c", new RDN( "a=b\\,c" ).toString() );
+        assertEquals( "a=b\\,c", new RDN( "a=b\\,c" ).getNormName() );
 
         assertTrue( RdnParser.isValid( "a=\"b,c\"" ) );
-        assertEquals( "a=b\\,c", new RDN( "a=\"b,c\"" ).toString() );
+        assertEquals( "a=b\\,c", new RDN( "a=\"b,c\"" ).getNormName() );
         assertEquals( "a=\"b,c\"", new RDN( "a=\"b,c\"" ).getUpName() );
 
         assertTrue( RdnParser.isValid( "a=\"b\\,c\"" ) );
         RDN rdn = new RDN( "a=\"b\\,c\"" );
         assertEquals( "a=\"b\\,c\"", rdn.getUpName() );
-        assertEquals( "a=b\\,c", rdn.toString() );
+        assertEquals( "a=b\\,c", rdn.getNormName() );
     }
 
 



Mime
View raw message