.getResourceAsStream("/TestApproveUserAccount-input.xml"));
}
@SuppressWarnings("unchecked")
public void testDoApproveActivationRequestion() throws Exception{
SimpleSmtpServer mailServer = SimpleSmtpServer.start();
User user = userManager.getUser(username);
assertEquals(AccountStatus.INACTIVE,user.getAccountStatus().intValue());
try{
action.setUsername(username);
action.setToken(token);
String op = action.doApproveActivationRequest();
assertEquals(ActionSupport.SUCCESS,op);
}finally{
mailServer.stop();
}
user = userManager.getUser(username);
assertEquals(AccountStatus.ACTIVE,user.getAccountStatus().intValue());
assertFalse(tokenManager.isValidResetToken(token, user));
assertTrue(mailServer.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
SmtpMessage email = (SmtpMessage) emailIter.next();
assertTrue(email.getHeaderValue("Subject").equals("Welcome"));
assertNotNull(email.getBody());
assertTrue(email.getBody().contains("WelcomeEmail"));
assertTrue(email.getBody().contains("Username(hchen1)"));