@Test public void testGetDocument() throws Exception { String id = UUID.randomUUID() .toString(); Document document = new Document(id, System.currentTimeMillis(), getMapper().getNodeFactory() .objectNode() .put("D", "data")); getQueryStore().save(TestUtils.TEST_TABLE_NAME, document); getElasticsearchConnection().refresh(ElasticsearchUtils.getIndices(TestUtils.TEST_TABLE_NAME)); Document response = resources.client() .target(String.format("/v1/document/%s/%s", TestUtils.TEST_TABLE_NAME, id)) .request() .get(Document.class); compare(document, response); }
@GET @Path("/{id}") @Timed @ApiOperation("Get Document") public Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id) { return Response.ok(queryStore.get(table, id)) .build(); }
DocumentResource { @GET @Path("/{id}") @Timed @ApiOperation("Get Document") public Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id) { return Response.ok(queryStore.get(table, id)) .build(); } }
DocumentResource { @GET @Path("/{id}") @Timed @ApiOperation("Get Document") public Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id) { return Response.ok(queryStore.get(table, id)) .build(); } @Inject  DocumentResource(QueryStore queryStore, TableTranslator tableTranslator); }
DocumentResource { @GET @Path("/{id}") @Timed @ApiOperation("Get Document") public Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id) { return Response.ok(queryStore.get(table, id)) .build(); } @Inject  DocumentResource(QueryStore queryStore, TableTranslator tableTranslator); @POST @Consumes(MediaType.APPLICATION_JSON) @Timed @ApiOperation("Save Document") Response saveDocument(@PathParam("table") String table, @Valid final Document document); @POST @Path("/bulk") @Consumes(MediaType.APPLICATION_JSON) @Timed @ApiOperation("Save list of documents") Response saveDocuments(@PathParam("table") String table, @Valid final List<Document> documents); @GET @Path("/{id}") @Timed @ApiOperation("Get Document") Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id); @GET @Timed @ApiOperation("Get Documents") Response getDocuments(@PathParam("table") final String table, @QueryParam("id") @NotNull final List<String> ids); }
DocumentResource { @GET @Path("/{id}") @Timed @ApiOperation("Get Document") public Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id) { return Response.ok(queryStore.get(table, id)) .build(); } @Inject  DocumentResource(QueryStore queryStore, TableTranslator tableTranslator); @POST @Consumes(MediaType.APPLICATION_JSON) @Timed @ApiOperation("Save Document") Response saveDocument(@PathParam("table") String table, @Valid final Document document); @POST @Path("/bulk") @Consumes(MediaType.APPLICATION_JSON) @Timed @ApiOperation("Save list of documents") Response saveDocuments(@PathParam("table") String table, @Valid final List<Document> documents); @GET @Path("/{id}") @Timed @ApiOperation("Get Document") Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id); @GET @Timed @ApiOperation("Get Documents") Response getDocuments(@PathParam("table") final String table, @QueryParam("id") @NotNull final List<String> ids);  }