client.done(me);
}
public void testXQueryInline() throws Exception {
DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
InOut me = client.createInOutExchange();
me.setService(new QName("urn:test", "xquery-inline"));
me.getInMessage().setContent(new StreamSource(getClass().getResourceAsStream("/books.xml")));
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(new QName("http://saxon.sf.net/xquery-results", "sequence"), DOMUtil.getQName(el));
el = DOMUtil.getFirstChildElement(el);
assertEquals(new QName("http://saxon.sf.net/xquery-results", "element"), DOMUtil.getQName(el));
el = DOMUtil.getFirstChildElement(el);
assertEquals(new QName("title"), DOMUtil.getQName(el));