client.done(me);
}
public void testXsltDynamic() throws Exception {
DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
InOut me = client.createInOutExchange();
me.setService(new QName("urn:test", "xslt-dynamic"));
Element e = transformer.toDOMElement(new StreamSource(getClass().getResourceAsStream("/books.xml")));
e = DOMUtil.getFirstChildElement(e);
me.getInMessage().setContent(new DOMSource(e));
me.getInMessage().setProperty("xslt.source", "classpath:transform.xsl");
client.sendSync(me);
if (me.getStatus() == ExchangeStatus.ERROR) {
if (me.getError() != null) {
throw me.getError();
} else {
fail("Received ERROR status");
}
} else if (me.getFault() != null) {
fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
}
log.info(transformer.toString(me.getOutMessage().getContent()));
Element el = transformer.toDOMElement(me.getOutMessage());
assertEquals("2005", textValueOfXPath(el, "/transformed/book/year"));
client.done(me);
}