}
public void testBasic() throws Exception {
OpenJPAEntityManagerSPI em = emf.createEntityManager();
OpenJPAConfiguration conf = ((OpenJPAEntityManagerSPI) em).getConfiguration();
ClearableScheduler scheduler = new ClearableScheduler(conf);
// Make the scheduler run every 1 minute
scheduler.setInterval(1);
DummyCache cache1 = new DummyCache();
DummyCache cache2 = new DummyCache();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
int currMin = cal.get(Calendar.MINUTE);
int plusOne = currMin+1;
int plusTwo = plusOne+1;
if(plusOne>=60){
plusOne-=60;
}
if(plusTwo>=60){
plusTwo-=60;
}
// Schedule eviction to happen the next two minutes
scheduler.scheduleEviction(cache2, plusOne+","+plusTwo+" * * * *");
// Schedule eviction to happen every mintue on cache 1
scheduler.scheduleEviction(cache1, ("+1"));
Thread.currentThread().sleep(61000);
assertEquals(1,cache1.getClearCount());
assertEquals(1,cache2.getClearCount());