Fix for LDAP-74: Change the append method in DistinguishedName.

This commit is contained in:
Mattias Arthursson
2007-08-15 11:26:07 +00:00
parent abb4f8cba6
commit 4c72019b35
2 changed files with 25 additions and 2 deletions

View File

@@ -347,9 +347,25 @@ public class DistinguishedName implements Name {
*
* @param path
* the path to append.
* @return this instance.
*/
public void append(DistinguishedName path) {
public DistinguishedName append(DistinguishedName path) {
getNames().addAll(path.getNames());
return this;
}
/**
* Append a new LdapRdn using the supplied key and value.
*
* @param key
* the key of the LdapRdn.
* @param value
* the value of the LdapRdn.
* @return this instance.
*/
public DistinguishedName append(String key, String value){
add(key, value);
return this;
}
/**

View File

@@ -519,4 +519,11 @@ public class DistinguishedNameTest extends TestCase {
assertTrue(true);
}
}
}
public void testAppendChained() {
DistinguishedName tested = new DistinguishedName("dc=mycompany,dc=com");
tested.append("ou", "company1").append("cn", "john doe");
assertEquals("cn=john doe, ou=company1, dc=mycompany, dc=com", tested.toString());
}
}