@Test public void testDeleteAbsent() throws IOException { String network = "network1"; String snapshot = "snapshot1"; Main.getWorkMgr().initNetwork(network, null); WorkMgrTestUtils.initSnapshotWithTopology(network, snapshot, ImmutableSet.of()); String key = "foo/bar"; try (Response response = getTarget(network, snapshot, key).delete()) { assertThat(response.getStatus(), equalTo(NOT_FOUND.getStatusCode())); } }
@DELETE public Response delete(@QueryParam(QP_KEY) String key) throws IOException { if (Main.getWorkMgr().deleteSnapshotObject(_network, _snapshot, key)) { return Response.ok().build(); } else { return Response.status(Status.NOT_FOUND).build(); } }
SnapshotObjectsResource { @DELETE public Response delete(@QueryParam(QP_KEY) String key) throws IOException { if (Main.getWorkMgr().deleteSnapshotObject(_network, _snapshot, key)) { return Response.ok().build(); } else { return Response.status(Status.NOT_FOUND).build(); } } }
SnapshotObjectsResource { @DELETE public Response delete(@QueryParam(QP_KEY) String key) throws IOException { if (Main.getWorkMgr().deleteSnapshotObject(_network, _snapshot, key)) { return Response.ok().build(); } else { return Response.status(Status.NOT_FOUND).build(); } } SnapshotObjectsResource(String network, String snapshot); }
SnapshotObjectsResource { @DELETE public Response delete(@QueryParam(QP_KEY) String key) throws IOException { if (Main.getWorkMgr().deleteSnapshotObject(_network, _snapshot, key)) { return Response.ok().build(); } else { return Response.status(Status.NOT_FOUND).build(); } } SnapshotObjectsResource(String network, String snapshot); @DELETE Response delete(@QueryParam(QP_KEY) String key); @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings({"MustBeClosedChecker", "PMD.CloseResource"}) // Response eventually closes it. Response get(@QueryParam(QP_KEY) String key); @PUT @Consumes(MediaType.APPLICATION_OCTET_STREAM) Response put(InputStream inputStream, @QueryParam(QP_KEY) String key); @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull Response listKeys(); }
SnapshotObjectsResource { @DELETE public Response delete(@QueryParam(QP_KEY) String key) throws IOException { if (Main.getWorkMgr().deleteSnapshotObject(_network, _snapshot, key)) { return Response.ok().build(); } else { return Response.status(Status.NOT_FOUND).build(); } } SnapshotObjectsResource(String network, String snapshot); @DELETE Response delete(@QueryParam(QP_KEY) String key); @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings({"MustBeClosedChecker", "PMD.CloseResource"}) // Response eventually closes it. Response get(@QueryParam(QP_KEY) String key); @PUT @Consumes(MediaType.APPLICATION_OCTET_STREAM) Response put(InputStream inputStream, @QueryParam(QP_KEY) String key); @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull Response listKeys();  }