@Test public void getWrongLicense() throws UnknownHostException{ WebResource resource = client().resource("/" + ServerAPI.LICENSE_RESOURCE + "/license"); ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); assertNotNull(response); assertEquals(HttpStatus.NOT_FOUND_404, response.getStatus()); }
@GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") public Response get(@PathParam("name") final String name){ LOG.info("Got a get license request."); final LicenseView view = new LicenseView(); final DbLicense dbLicense = getLicenseHandler().getLicense(name); final License license = getModelMapper().getLicense(dbLicense); view.setLicense(license); return Response.ok(view).build(); }
LicenseResource extends AbstractResource { @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") public Response get(@PathParam("name") final String name){ LOG.info("Got a get license request."); final LicenseView view = new LicenseView(); final DbLicense dbLicense = getLicenseHandler().getLicense(name); final License license = getModelMapper().getLicense(dbLicense); view.setLicense(license); return Response.ok(view).build(); } }
LicenseResource extends AbstractResource { @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") public Response get(@PathParam("name") final String name){ LOG.info("Got a get license request."); final LicenseView view = new LicenseView(); final DbLicense dbLicense = getLicenseHandler().getLicense(name); final License license = getModelMapper().getLicense(dbLicense); view.setLicense(license); return Response.ok(view).build(); } LicenseResource(final RepositoryHandler repoHandler, final GrapesServerConfig dmConfig); }
LicenseResource extends AbstractResource { @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") public Response get(@PathParam("name") final String name){ LOG.info("Got a get license request."); final LicenseView view = new LicenseView(); final DbLicense dbLicense = getLicenseHandler().getLicense(name); final License license = getModelMapper().getLicense(dbLicense); view.setLicense(license); return Response.ok(view).build(); } LicenseResource(final RepositoryHandler repoHandler, final GrapesServerConfig dmConfig); @POST Response postLicense(@Auth final DbCredential credential, final License license); @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_NAMES) Response getNames(@Context final UriInfo uriInfo); @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response get(@PathParam("name") final String name); @DELETE @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response delete(@Auth final DbCredential credential, @PathParam("name") final String name); @POST @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response approve(@Auth final DbCredential credential, @PathParam("name") final String name, @QueryParam(ServerAPI.APPROVED_PARAM) final BooleanParam approved); }
LicenseResource extends AbstractResource { @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") public Response get(@PathParam("name") final String name){ LOG.info("Got a get license request."); final LicenseView view = new LicenseView(); final DbLicense dbLicense = getLicenseHandler().getLicense(name); final License license = getModelMapper().getLicense(dbLicense); view.setLicense(license); return Response.ok(view).build(); } LicenseResource(final RepositoryHandler repoHandler, final GrapesServerConfig dmConfig); @POST Response postLicense(@Auth final DbCredential credential, final License license); @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path(ServerAPI.GET_NAMES) Response getNames(@Context final UriInfo uriInfo); @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response get(@PathParam("name") final String name); @DELETE @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response delete(@Auth final DbCredential credential, @PathParam("name") final String name); @POST @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) @Path("/{name}") Response approve(@Auth final DbCredential credential, @PathParam("name") final String name, @QueryParam(ServerAPI.APPROVED_PARAM) final BooleanParam approved);  }