DocumentResource { @GET public Response getDocuments(@PathParam("table") final String table, @QueryParam("id") @NotNull final List<String> ids) { try { return Response.ok(queryStore.get(table, ids)).build(); } catch (QueryStoreException ex) { logger.error("Get error : ", ex); switch (ex.getErrorCode()) { case DOCUMENT_NOT_FOUND: return Response.status(Response.Status.NOT_FOUND) .entity(Collections.singletonMap("error", ex.getErrorCode())) .build(); case DOCUMENT_GET_ERROR: default: return Response.serverError() .entity(Collections.singletonMap("error", ex.getErrorCode())) .build(); } } } DocumentResource(QueryStore queryStore); @POST Response saveDocument(@PathParam("table") final String table, @Valid final Document document); @POST @Path("/bulk") Response saveDocuments(@PathParam("table") final String table, @Valid final List<Document> document); @GET @Path("/{id}") Response getDocument(@PathParam("table") final String table, @PathParam("id") @NotNull final String id); @GET 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(), factory.objectNode().put("D", "data")); String id2 = UUID.randomUUID().toString(); Document document2 = new Document(id2, System.currentTimeMillis(), factory.objectNode().put("D", "data")); documents.add(document1); documents.add(document2); queryStore.save(TestUtils.TEST_TABLE_NAME, documents); String response = client().resource(String.format("/v1/document/%s", TestUtils.TEST_TABLE_NAME)) .queryParam("id", id1) .queryParam("id", id2) .get(String.class); String expectedResponse = mapper.writeValueAsString(documents); assertEquals(expectedResponse, response); }