public void testReactivateUser() throws Exception {
String username = "username_test";
String token = "token_test";
try {
User user = new User();
user.setDisabled(true);
user.setUsername(username);
user.setPassword("password");
_userManager.addUser(user);
_userRegDAO.addActivationToken(username, token, new Date(), IUserRegDAO.REACTIVATION_RECOVER_TOKEN_TYPE);
_userRegManager.reactivateUser(username, "password", token);
user = (User) _userManager.getUser(username);
assertNotNull(user);
assertNotNull(user.getAuthorities());
List<IApsAuthority> groups = ((IApsAuthorityManager) this._groupManager).getAuthorizationsByUser(user);
List<IApsAuthority> roles = ((IApsAuthorityManager) this._roleManager).getAuthorizationsByUser(user);
assertEquals(0, groups.size());
assertEquals(0, roles.size());
assertFalse(user.isDisabled());
} finally {
// clean
_userManager.removeUser(username);
}
}