DocumentResource { @GET @Timed @ApiOperation("Get Documents") public Response getDocuments(@PathParam("table") final String table, @QueryParam("id") @NotNull final List<String> ids) { return Response.ok(queryStore.getAll(table, ids)) .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);  }
@Test public void testGetDocuments() throws Exception { List<Document> documents = new ArrayList<Document>(); String id1 = UUID.randomUUID() .toString(); Document document1 = new Document(id1, System.currentTimeMillis(), getMapper().getNodeFactory() .objectNode() .put("D", "data")); String id2 = UUID.randomUUID() .toString(); Document document2 = new Document(id2, System.currentTimeMillis(), getMapper().getNodeFactory() .objectNode() .put("D", "data")); documents.add(document1); documents.add(document2); getQueryStore().save(TestUtils.TEST_TABLE_NAME, documents); getElasticsearchConnection().refresh(ElasticsearchUtils.getIndices(TestUtils.TEST_TABLE_NAME)); String response = resources.client() .target(String.format("/v1/document/%s", TestUtils.TEST_TABLE_NAME)) .queryParam("id", id1) .queryParam("id", id2) .request() .get(String.class); String expectedResponse = getMapper().writeValueAsString(documents); assertEquals(expectedResponse, response); }