assertTrue(timerTaskFlag.wasCalled());
filter.destroy();
}
public void testDelaysFirstCleanAll() throws Exception {
final MethodFlag timerTaskFlag = new MethodFlag();
final Cas20ProxyReceivingTicketValidationFilter filter = newCas20ProxyReceivingTicketValidationFilter();
final TimerTask timerTask = new TimerTask() {
public void run() {
timerTaskFlag.setCalled();
}
};
final int millisBetweenCleanUps = 250;
filter.setProxyGrantingTicketStorage(storage);
filter.setMillisBetweenCleanUps(millisBetweenCleanUps);
filter.setTimer(defaultTimer);
filter.setTimerTask(timerTask);
filter.init();
assertFalse(timerTaskFlag.wasCalled());
// wait long enough for the clean up to occur
Thread.sleep(millisBetweenCleanUps * 2);
assertTrue(timerTaskFlag.wasCalled());
filter.destroy();
}