directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r447737 - in /directory/branches/shared/0.9.5/ldap/src: main/java/org/apache/directory/shared/ldap/name/LdapDN.java test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Date Tue, 19 Sep 2006 05:15:03 GMT
Author: akarasulu
Date: Mon Sep 18 22:15:02 2006
New Revision: 447737

URL: http://svn.apache.org/viewvc?view=rev&rev=447737
Log:
found bug with handling addAll with non-LdapDN Names

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
    directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?view=diff&rev=447737&r1=447736&r2=447737
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Mon Sep 18 22:15:02 2006
@@ -984,7 +984,7 @@
                return this;
            }
 
-           for ( int ii = 0; ii < name.size(); ii++ )
+           for ( int ii = name.size() - 1; ii >= 0; ii-- )
            {
                Rdn rdn = new Rdn( name.get( ii ) );
                rdns.add( size() - posn, rdn );

Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?view=diff&rev=447737&r1=447736&r2=447737
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Mon Sep 18 22:15:02 2006
@@ -34,7 +34,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
+import javax.naming.CompoundName;
 import javax.naming.InvalidNameException;
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -2652,5 +2654,28 @@
        LdapDN name = new LdapDN( "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"
);
        Assert.assertEquals( "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",
name.toString() );
        Assert.assertEquals( "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",
name.getUpName() );
+   }
+   
+   
+   public void testNameAddAll() throws NamingException
+   {
+       Properties props = new Properties();
+       props.setProperty( "jndi.syntax.direction", "right_to_left" );
+       props.setProperty( "jndi.syntax.separator", "," );
+       props.setProperty( "jndi.syntax.ignorecase", "true" );
+       props.setProperty( "jndi.syntax.trimblanks", "true" );
+
+       Name dn = new CompoundName( "cn=blah,dc=example,dc=com", props );
+       LdapDN ldapDn = new LdapDN();
+       ldapDn.addAll( 0, dn );
+       
+       assertEquals( "cn=blah,dc=example,dc=com", ldapDn.toString() );
+
+       dn = new CompoundName( "cn=blah,dc=example,dc=com", props );
+       ldapDn = new LdapDN( "cn=xyz" );
+       ldapDn.addAll( 0, dn );
+       
+       System.out.println( ldapDn.toString() );
+       assertEquals( "cn=xyz,cn=blah,dc=example,dc=com", ldapDn.toString() );
    }
 }



Mime
View raw message