bean = home.create();
int initialCount = bean.listTimers().size();
TimersID id = new TimersID("testCurrentSession", "*:ejb=None");
Timers timer = new Timers(id);
Date now = new Date();
Long interval = new Long(5*1000);
Key key = new Key("key2", 123456789);
Info info = new Info(System.getProperties());
timer.setInitialDate(now);
timer.setInstancePK(serialize(key));
timer.setTimerInterval(interval);
timer.setInfo(serialize(info));
bean.persist(timer);
log.info("Timers created with id = " + id);
List timers = bean.listTimers();
assertNotNull(timers);
assertEquals("Incorrect result size", initialCount + 1, timers.size());
Timers found = null;
Iterator itr = timers.iterator();
while (itr.hasNext())
{
Timers t = (Timers) itr.next();
if (id.equals(t.getId()))
{
found = t;
}
}
assertNotNull("Saved timer found in list", found);