@Override
protected void renderResponse() throws Exception
{
// Check the job exists
assert ((Boolean)getValue("#{accountHome.idDefined}"));
Account account = (Account) getValue("#{selectedAccount}");
assert account !=null;
assert account.getId() == 1;
assert account.getPayments().size() == 1;
Payment payment = (Payment) getValue("#{newPayment}");
assert payment.getPayee().equals("IRS");
assert payment.getAmount().equals(new BigDecimal("110.00"));
assert payment.getAccount() != null;
assert payment.getAccount().getId() == 1;
assert payment.getActive();
}
}.run();
// Start the triggerHandle, wait a lot shorter than the job takes
// At this point the job should have executed zero times
quartzTriggerHandle.resume();
pause((long) (REPEATING.getInterval() * 0.1));
quartzTriggerHandle.pause();
new FacesRequest("/search.xhtml", id)
{
@Override
protected void beforeRequest()
{
setParameter("accountId", "1");
}
@Override
protected void renderResponse() throws Exception
{
assert ((Boolean)getValue("#{accountHome.idDefined}"));
Account account = (Account) getValue("#{selectedAccount}");
assert account !=null;
assert account.getId() == 1;
assert account.getPayments().size() == 1;
Payment payment = account.getPayments().get(0);
assert new BigDecimal("110.00").equals(payment.getAmount());
assert payment.getActive();
assert new BigDecimal("1001.46").equals(account.getBalance());
}
}.run();
// Start the triggerHandle, wait until some short time after the
// job triggers once
quartzTriggerHandle.resume();
pause(REPEATING.getInterval());
quartzTriggerHandle.pause();
new FacesRequest("/search.xhtml", id)
{
@Override
protected void beforeRequest()
{
setParameter("accountId", "1");
}
@Override
protected void renderResponse() throws Exception
{
// Job should have run twice
assert ((Boolean)getValue("#{accountHome.idDefined}"));
Account account = (Account) getValue("#{selectedAccount}");
assert account !=null;
assert account.getId() == 1;
assert account.getPayments().size() == 1;
Payment payment = account.getPayments().get(0);
assert new BigDecimal("110.00").equals(payment.getAmount());
assert payment.getActive();
assert new BigDecimal("891.46").equals(account.getBalance());
paymentId = payment.getId();
}
}.run();
// Start the triggerHandle, wait until some short time after the
// job triggers once
quartzTriggerHandle.resume();
pause(REPEATING.getInterval());
// Thats the last job so need to pause
new FacesRequest("/search.xhtml", id)
{
@Override
protected void beforeRequest()
{
setParameter("accountId", "1");
}
@Override
protected void renderResponse() throws Exception
{
// Job should have run twice
assert ((Boolean)getValue("#{accountHome.idDefined}"));
Account account = (Account) getValue("#{selectedAccount}");
assert account !=null;
assert account.getId() == 1;
assert account.getPayments().size() == 1;
Payment payment = account.getPayments().get(0);
assert new BigDecimal("110.00").equals(payment.getAmount());
assert payment.getActive();
assert new BigDecimal("781.46").equals(account.getBalance());
paymentId = payment.getId();
}
}.run();
// Start the triggerHandle, wait until some short time after the
// job would trigger again - we should be way beyond the expiry now
pause(REPEATING.getInterval());
new FacesRequest("/search.xhtml", id)
{
@Override
protected void beforeRequest()
{
setParameter("accountId", "1");
}
@Override
protected void renderResponse() throws Exception
{
assert ((Boolean)getValue("#{accountHome.idDefined}"));
Account account = (Account) getValue("#{selectedAccount}");
assert account !=null;
assert account.getId() == 1;
assert account.getPayments().size() == 1;
Payment payment = account.getPayments().get(0);
assert new BigDecimal("110.00").equals(payment.getAmount());
assert payment.getActive();
assert payment.getLastPaid() != null;
assert new BigDecimal("781.46").equals(account.getBalance());
}
}.run();
}