}
}
}
public void testFindUser() throws RepositoryException {
User u = null;
try {
Principal p = getTestPrincipal();
String uid = "UID" + p.getName();
u = userMgr.createUser(uid, buildPassword(uid, false), p, null);
boolean found = false;
Iterator it = userMgr.findAuthorizables(pPrincipalName, null, UserManager.SEARCH_TYPE_USER);
while (it.hasNext() && !found) {
User nu = (User) it.next();
found = nu.getID().equals(uid);
}
assertTrue("Searching for 'null' must find the created user.", found);
it = userMgr.findAuthorizables(pPrincipalName, p.getName(), UserManager.SEARCH_TYPE_USER);
found = false;
while (it.hasNext() && !found) {
User nu = (User) it.next();
found = nu.getPrincipal().getName().equals(p.getName());
}
assertTrue("Searching for principal-name must find the created user.", found);
it = userMgr.findAuthorizables(pUserID, uid, UserManager.SEARCH_TYPE_USER);
found = false;
while (it.hasNext() && !found) {
User nu = (User) it.next();
found = nu.getID().equals(uid);
}
assertTrue("Searching for user id must find the created user.", found);
// but search groups should not find anything
it = userMgr.findAuthorizables(pPrincipalName, p.getName(), UserManager.SEARCH_TYPE_GROUP);