public void test() throws IOException, SAXException {
Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config.xml"));
for(int i = 0; i < TestConstants.NUM_WARMUPS; i++) {
JavaResult javaResult = new JavaResult();
smooks.filterSource(new StreamSource(TestConstants.getMessageReader()), javaResult);
}
long start = System.currentTimeMillis();
JavaResult javaResult = null;
NoddyObserver nobserver = new NoddyObserver();
for(int i = 0; i < TestConstants.NUM_ITERATIONS; i++) {
ExecutionContext execContext = smooks.createExecutionContext();
BeanContext beanCtx = execContext.getBeanContext();
for(int ii = 0; ii < 15; ii++) {
beanCtx.addObserver(nobserver);
}
javaResult = new JavaResult();
smooks.filterSource(execContext, new StreamSource(TestConstants.getMessageReader()), javaResult);
}
System.out.println("Smooks took: " + (System.currentTimeMillis() - start));
Order order = (Order) javaResult.getBean("order");
if(order != null) {
System.out.println("Num order items: " + order.getOrderItems().size());
}
}