resource = root.createResource("data.xml", "XMLResource");
resource.setContent(DOCUMENT_CONTENT);
root.storeResource(resource);
XQueryService qs = (XQueryService) root.getService("XQueryService", "1.0");
ResourceSet result = qs.query("if (doc-available('" + testCollection + "/messages.xml')) then doc('" + testCollection + "/messages.xml')/events/event[@id = 'STORE-DOCUMENT']/string(@collection) else ()");
assertEquals(1, result.getSize());
assertEquals(testCollection, result.getResource(0).getContent());
} catch (XMLDBException e) {
e.printStackTrace();
fail(e.getMessage());