Made sure integration tests for article sample automatically start in-process LDAP server.
DirContextAdapter#setDn() now throws IllegalStateException if setDn is called on an instance in update mode (this was previously silently ignored) Fixed problem in LdapTreeBuilder caused by the new behaviour of DN in DirContextAdapter (i.e. that the actual DN instance of the DirContextAdapter is no longer returned by getDn()).
This commit is contained in:
@@ -14,22 +14,24 @@ public class LdapTreeBuilder {
|
||||
}
|
||||
|
||||
public LdapTree getLdapTree(DistinguishedName root) {
|
||||
DirContextOperations context = ldapTemplate.lookupContext(root.toString());
|
||||
DirContextOperations context = ldapTemplate.lookupContext(root
|
||||
.toString());
|
||||
return getLdapTree(context);
|
||||
}
|
||||
|
||||
private LdapTree getLdapTree(final DirContextOperations rootContext) {
|
||||
final LdapTree ldapTree = new LdapTree(rootContext);
|
||||
ldapTemplate.listBindings(rootContext.getDn(), new AbstractContextMapper() {
|
||||
@Override
|
||||
protected Object doMapFromContext(DirContextOperations ctx) {
|
||||
DistinguishedName dn = (DistinguishedName) ctx.getDn();
|
||||
dn.prepend((DistinguishedName) rootContext.getDn());
|
||||
|
||||
ldapTree.addSubTree(getLdapTree(ctx));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
ldapTemplate.listBindings(rootContext.getDn(),
|
||||
new AbstractContextMapper() {
|
||||
@Override
|
||||
protected Object doMapFromContext(DirContextOperations ctx) {
|
||||
DistinguishedName dn = (DistinguishedName) ctx.getDn();
|
||||
dn.prepend((DistinguishedName) rootContext.getDn());
|
||||
ldapTree.addSubTree(getLdapTree(ldapTemplate
|
||||
.lookupContext(dn)));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
return ldapTree;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user