@Test public void deleteInvalid() throws IOException, ServletException { for (int i = 0; i < URIS_INVALID.size(); i++) { when(_request.getRequestURL()).thenReturn(new StringBuffer(URIS_INVALID.get(i))); _ld_servlet.doDelete(_request, _response); verify(_response).setStatus(HttpServletResponse.SC_NOT_FOUND); } }
@Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final Store store = ((Store) getServletContext().getAttribute(ConfigParams.STORE)); if ((store == null) || !store.isOpen()) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG + " Store was null or not initialized."); sendError( req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG); return; } final Iterator<Statement> removeIterator = store.describe(ValueFactoryImpl.getInstance().createURI(req.getRequestURL().toString()), false); if (removeIterator.hasNext()) { store.removeData(removeIterator); resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception exception) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); sendError(req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG, exception); } }
LinkedDataServlet extends AbstractCumulusServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final Store store = ((Store) getServletContext().getAttribute(ConfigParams.STORE)); if ((store == null) || !store.isOpen()) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG + " Store was null or not initialized."); sendError( req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG); return; } final Iterator<Statement> removeIterator = store.describe(ValueFactoryImpl.getInstance().createURI(req.getRequestURL().toString()), false); if (removeIterator.hasNext()) { store.removeData(removeIterator); resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception exception) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); sendError(req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG, exception); } } }
LinkedDataServlet extends AbstractCumulusServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final Store store = ((Store) getServletContext().getAttribute(ConfigParams.STORE)); if ((store == null) || !store.isOpen()) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG + " Store was null or not initialized."); sendError( req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG); return; } final Iterator<Statement> removeIterator = store.describe(ValueFactoryImpl.getInstance().createURI(req.getRequestURL().toString()), false); if (removeIterator.hasNext()) { store.removeData(removeIterator); resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception exception) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); sendError(req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG, exception); } }  }
LinkedDataServlet extends AbstractCumulusServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final Store store = ((Store) getServletContext().getAttribute(ConfigParams.STORE)); if ((store == null) || !store.isOpen()) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG + " Store was null or not initialized."); sendError( req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG); return; } final Iterator<Statement> removeIterator = store.describe(ValueFactoryImpl.getInstance().createURI(req.getRequestURL().toString()), false); if (removeIterator.hasNext()) { store.removeData(removeIterator); resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception exception) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); sendError(req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG, exception); } }  @Override void doDelete(HttpServletRequest req, HttpServletResponse resp); @Override void doGet(HttpServletRequest req, HttpServletResponse resp); @Override void doPost(HttpServletRequest req, HttpServletResponse resp); @Override void doPut(HttpServletRequest req, HttpServletResponse resp); @Override void init(); }
LinkedDataServlet extends AbstractCumulusServlet { @Override public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final Store store = ((Store) getServletContext().getAttribute(ConfigParams.STORE)); if ((store == null) || !store.isOpen()) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG + " Store was null or not initialized."); sendError( req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG); return; } final Iterator<Statement> removeIterator = store.describe(ValueFactoryImpl.getInstance().createURI(req.getRequestURL().toString()), false); if (removeIterator.hasNext()) { store.removeData(removeIterator); resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception exception) { _log.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); sendError(req, resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE_MSG, exception); } }  @Override void doDelete(HttpServletRequest req, HttpServletResponse resp); @Override void doGet(HttpServletRequest req, HttpServletResponse resp); @Override void doPost(HttpServletRequest req, HttpServletResponse resp); @Override void doPut(HttpServletRequest req, HttpServletResponse resp); @Override void init();  }