@Test public void testListKeys() throws IOException { String network = "network1"; String snapshot = "snapshot1"; String node = "node1"; String content = "stuff"; Main.getWorkMgr().initNetwork(network, null); WorkMgrTestUtils.uploadTestSnapshot(network, snapshot, node, content, _folder); try (Response response = listKeysTarget(network, snapshot).get()) { assertThat(response.getStatus(), equalTo(OK.getStatusCode())); assertThat( response.readEntity(new GenericType<List<StoredObjectMetadata>>() {}), equalTo( ImmutableList.of( new StoredObjectMetadata("configs/" + node, content.getBytes().length)))); } }
@Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull public Response listKeys() throws IOException { List<StoredObjectMetadata> keys = Main.getWorkMgr().getSnapshotInputObjectsMetadata(_network, _snapshot); if (keys == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(keys).build(); }
SnapshotInputObjectsResource { @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull public Response listKeys() throws IOException { List<StoredObjectMetadata> keys = Main.getWorkMgr().getSnapshotInputObjectsMetadata(_network, _snapshot); if (keys == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(keys).build(); } }
SnapshotInputObjectsResource { @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull public Response listKeys() throws IOException { List<StoredObjectMetadata> keys = Main.getWorkMgr().getSnapshotInputObjectsMetadata(_network, _snapshot); if (keys == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(keys).build(); } SnapshotInputObjectsResource(String network, String snapshot); }
SnapshotInputObjectsResource { @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull public Response listKeys() throws IOException { List<StoredObjectMetadata> keys = Main.getWorkMgr().getSnapshotInputObjectsMetadata(_network, _snapshot); if (keys == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(keys).build(); } SnapshotInputObjectsResource(String network, String snapshot); @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings({"MustBeClosedChecker", "PMD.CloseResource"}) // Response eventually closes it. Response get(@QueryParam(QP_KEY) String key); @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull Response listKeys(); }
SnapshotInputObjectsResource { @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull public Response listKeys() throws IOException { List<StoredObjectMetadata> keys = Main.getWorkMgr().getSnapshotInputObjectsMetadata(_network, _snapshot); if (keys == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(keys).build(); } SnapshotInputObjectsResource(String network, String snapshot); @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) @SuppressWarnings({"MustBeClosedChecker", "PMD.CloseResource"}) // Response eventually closes it. Response get(@QueryParam(QP_KEY) String key); @Path(RSC_LIST) @GET @Produces(MediaType.APPLICATION_JSON) @Nonnull Response listKeys();  }