Added search method which will be used for finding roles.

This commit is contained in:
Luke Taylor
2006-04-30 21:37:18 +00:00
parent 8e5b0a5d5f
commit 0b2be28def
2 changed files with 82 additions and 0 deletions

View File

@@ -15,7 +15,10 @@
package org.acegisecurity.ldap;
import java.util.Set;
/**
*
* @author Luke Taylor
* @version $Id$
*/
@@ -41,5 +44,15 @@ public class LdapTemplateTests extends AbstractLdapServerTestCase {
// assertFalse(template.compare("uid=bob,ou=people", "userPassword", LdapUtils.getUtf8Bytes("wrongvalue")));
}
public void testSearchForSingleAttributeValues() {
LdapTemplate template = new LdapTemplate(getInitialCtxFactory());
String param = "uid=ben,ou=people," + getInitialCtxFactory().getRootDn();
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "ou");
assertEquals("Expected 2 results from search", 2, values.size());
assertTrue(values.contains("developer"));
assertTrue(values.contains("manager"));
}
}