NodeIdRepresentation { public void deleteResource(final String resourceName, final long nodeId) throws JaxRxException { synchronized (resourceName) { Session session = null; Database database = null; NodeWriteTrx wtx = null; boolean abort = false; if (WorkerHelper.checkExistingResource(mStoragePath, resourceName)) { try { database = Databases.openDatabase(mStoragePath); session = database.getSession(new SessionConfiguration.Builder( resourceName).build()); wtx = session.beginNodeWriteTrx(); if (wtx.moveTo(nodeId).hasMoved()) { wtx.remove(); wtx.commit(); } else { throw new JaxRxException(404, NOTFOUND); } } catch (final SirixException exce) { abort = true; throw new JaxRxException(exce); } finally { try { WorkerHelper.closeWTX(abort, wtx, session, database); } catch (final SirixException exce) { throw new JaxRxException(exce); } } } else { throw new JaxRxException(404, "DB not found"); } } } NodeIdRepresentation(final File storagePath); StreamingOutput getResource(final String resourceName,
			final long nodeId, final Map<QueryParameter, String> queryParams); StreamingOutput getResourceByAT(final String resourceName,
			final long nodeId, final Map<QueryParameter, String> queryParams,
			final IDAccessType accessType); StreamingOutput performQueryOnResource(final String resourceName,
			final long nodeId, final String query,
			final Map<QueryParameter, String> queryParams); void deleteResource(final String resourceName, final long nodeId); void modifyResource(final String resourceName, final long nodeId,
			final InputStream newValue); void addSubResource(final String resourceName, final long nodeId,
			final InputStream input, final IDAccessType type);  }
@Test public final void testDeleteResource() throws WebApplicationException, IOException, ParserConfigurationException, SAXException, InterruptedException { ridWorker.deleteResource(RESOURCENAME, NODEIDGETRESOURCE); final Map<QueryParameter, String> queryParams = new HashMap<QueryParameter, String>(); queryParams.put(QueryParameter.OUTPUT, LITERALSTRUE); queryParams.put(QueryParameter.WRAP, LITERALSFALSE); final StreamingOutput result = ridWorker.performQueryOnResource( RESOURCENAME, 1, " final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write("<resulti>".getBytes()); result.write(outputStream); outputStream.write("</resulti>".getBytes()); final Document doc = DOMHelper.buildDocument(outputStream); final NodeList list = doc.getElementsByTagName("country"); Node searchedNode = null; for (int i = 0; i < list.getLength(); i++) { final Element elem = (Element) list.item(i); final Attr name = elem.getAttributeNode(NAME); if (name.getTextContent().equals("Albania")) { searchedNode = list.item(i); break; } } outputStream.close(); assertNull("Country Albania does not exist anymore", searchedNode); }