assertXpathEvaluatesTo("Paragraph4", "/test/para[2]/text()", newDocXml);
}
@Test
public void queryRemoveResource() throws XMLDBException {
Resource resource = null;
Collection testCollection = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
assertNotNull(testCollection);
String resourceName = "QueryTestPerson.xml";
String id = "test." + System.currentTimeMillis();
String content = "<?xml version='1.0'?><person id=\"" + id + "\"><name>Jason</name></person>";
resource = testCollection.createResource(resourceName, "XMLResource");
resource.setContent(content);
testCollection.storeResource(resource);
XPathQueryService service = (XPathQueryService) testCollection.getService("XPathQueryService", "1.0");
ResourceSet rs = service.query("/person[@id='" + id + "']");
for (ResourceIterator iterator = rs.getIterator(); iterator.hasMoreResources();) {
Resource r = iterator.nextResource();
System.err.println("Resource id=" + r.getId() + " xml=" + r.getContent());
testCollection.removeResource(r);
resource = null;
}
}