}
@SuppressWarnings("unchecked")
private void test_appContextTime(Smooks smooks) throws IOException, SAXException, InterruptedException {
ExecutionContext execContext = smooks.createExecutionContext();
BeanContext beanContext = execContext.getBeanContext();
smooks.filterSource(execContext, new StringSource("<doc/>"), null);
List orders11 = (List) beanContext.getBean("orders1");
List orders12 = (List) beanContext.getBean("orders2");
smooks.filterSource(execContext, new StringSource("<doc/>"), null);
List orders21 = (List) beanContext.getBean("orders1");
List orders22 = (List) beanContext.getBean("orders2");
assertTrue(orders11 != orders21);
assertTrue(orders12 == orders22); // order12 should come from the app context cache
// timeout the cached resultset...
Thread.sleep(2050);
smooks.filterSource(execContext, new StringSource("<doc/>"), null);
List orders31 = (List) beanContext.getBean("orders1");
List orders32 = (List) beanContext.getBean("orders2");
assertTrue(orders11 != orders31);
assertTrue(orders12 != orders32); // order12 shouldn't come from the app context cache - timed out ala TTL
smooks.filterSource(execContext, new StringSource("<doc/>"), null);
List orders41 = (List) beanContext.getBean("orders1");
List orders42 = (List) beanContext.getBean("orders2");
assertTrue(orders31 != orders41);
assertTrue(orders32 == orders42); // order42 should come from the app context cache
}