Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RunWith(FrameworkRunner.class)
- @CreateLdapServer(
- transports =
- {
- @CreateTransport(protocol = "LDAP")
- })
- public class SearchTests extends AbstractLdapTestUnit {
- public static LdapServer ldapServer;
- @Test
- public void testSearchAllAttrs() throws Exception {
- LdapContext ctx = (LdapContext) getWiredContext(ldapServer, null).lookup("ou=system");
- SearchControls controls = new SearchControls();
- controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
- controls.setReturningAttributes(new String[]
- {"+", "*"});
- NamingEnumeration<SearchResult> res = ctx.search("", "(ObjectClass=*)", controls);
- assertTrue(res.hasMore());
- while (res.hasMoreElements()) {
- SearchResult result = (SearchResult) res.next();
- System.out.println(result.getName());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement