Fix for LDAP-74: Change the append method in DistinguishedName.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user