@Ignore @Test public void testGetWithId() throws URISyntaxException { String id = resourceService.postEntity(resource, createTestEntity()); setupMocks(BASE_URI + "/" + id); Response response = defaultResource.getWithId(id, uriInfo); EntityResponse entityResponse = (EntityResponse) response.getEntity(); EntityBody body = (EntityBody) entityResponse.getEntity(); assertEquals("Status code should be OK", Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals("Should match", id, body.get("id")); assertEquals("Should match", 1234, body.get("studentUniqueStateId")); }
@GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitiesByIds(resource, id, uriInfo.getRequestUri()); } }); }
DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitiesByIds(resource, id, uriInfo.getRequestUri()); } }); } }
DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitiesByIds(resource, id, uriInfo.getRequestUri()); } }); } DefaultResource(); }
DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitiesByIds(resource, id, uriInfo.getRequestUri()); } }); } DefaultResource(); @GET Response getAll(@Context final UriInfo uriInfo); @POST Response post(final EntityBody entityBody,
                         @Context final UriInfo uriInfo); @GET @Path("{id}") Response getWithId(@PathParam("id") final String id,
                              @Context final UriInfo uriInfo); @PUT @Path("{id}") Response put(@PathParam("id") final String id,
                        final EntityBody entityBody,
                        @Context final UriInfo uriInfo); @DELETE @Path("{id}") Response delete(@PathParam("id") final String id,
                           @Context final UriInfo uriInfo); @PATCH @Path("{id}") Response patch(@PathParam("id") final String id,
                          final EntityBody entityBody,
                          @Context final UriInfo uriInfo); @Override CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo); }
DefaultResource extends GenericResource implements CustomEntityReturnable { @GET @Path("{id}") public Response getWithId(@PathParam("id") final String id, @Context final UriInfo uriInfo) { return getResponseBuilder.build(uriInfo, twoPartTemplate, ResourceMethod.GET, new GenericResource.GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntitiesByIds(resource, id, uriInfo.getRequestUri()); } }); } DefaultResource(); @GET Response getAll(@Context final UriInfo uriInfo); @POST Response post(final EntityBody entityBody,
                         @Context final UriInfo uriInfo); @GET @Path("{id}") Response getWithId(@PathParam("id") final String id,
                              @Context final UriInfo uriInfo); @PUT @Path("{id}") Response put(@PathParam("id") final String id,
                        final EntityBody entityBody,
                        @Context final UriInfo uriInfo); @DELETE @Path("{id}") Response delete(@PathParam("id") final String id,
                           @Context final UriInfo uriInfo); @PATCH @Path("{id}") Response patch(@PathParam("id") final String id,
                          final EntityBody entityBody,
                          @Context final UriInfo uriInfo); @Override CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo);  }