public void testEntityBeanTimerHasTimerServiceAfterCancellationStd() throws Exception
{
String jndi = "ejb/test/timer/TimerEntityExtStd";
TimerEntityExtHome home = (TimerEntityExtHome) getEJBHome(jndi);
TimerEntityExt entity = home.create(new Integer(333));
entity.startTimer(SHORT_PERIOD);
Thread.sleep(12 * SHORT_PERIOD);
assertTrue("Timer service should be associated with bean." , entity.hasTimerService(jndi));
entity.stopTimer();
int lCount = entity.getTimeoutCount();
assertTrue("Timeout was expected to be called at least 10 times but was "
+ "only called: " + lCount + " times",
lCount >= 10);
Thread.sleep(5 * SHORT_PERIOD);
int lCount2 = entity.getTimeoutCount();
assertTrue("After the timer was stopped no timeout should happen but "
+ "it was called " + (lCount2 - lCount) + " more times",
lCount == lCount2);
Thread.sleep(40 * SHORT_PERIOD);
assertFalse("Timer service should have been passivated and timer service association removed."
, entity.hasTimerService(jndi));
entity.remove();
}