@Test public void testGetNonExistingDeploymentGroup() throws Exception { when(model.getDeploymentGroup(anyString())).thenThrow( new DeploymentGroupDoesNotExistException("")); final Response response = resource.getDeploymentGroup("foobar"); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); }
@GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } }
DeploymentGroupResource { @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } } }
DeploymentGroupResource { @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } } DeploymentGroupResource(final MasterModel model); }
DeploymentGroupResource { @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } } DeploymentGroupResource(final MasterModel model); @POST @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response createDeploymentGroup(@Valid final DeploymentGroup deploymentGroup); @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroup(@PathParam("name") final String name); @GET @Produces(APPLICATION_JSON) @Timed @ExceptionMetered List<String> getDeploymentGroup(); @DELETE @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response removeDeploymentGroup(@PathParam("name") @Valid final String name); @POST @Path("/{name}/rolling-update") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response rollingUpdate(@PathParam("name") @Valid final String name,
                                @Valid final RollingUpdateRequest args); @POST @Path("/{name}/stop") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response stopDeploymentGroup(@PathParam("name") @Valid final String name); @GET @Path("/{name}/status") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroupStatus(@PathParam("name") @Valid final String name); }
DeploymentGroupResource { @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response getDeploymentGroup(@PathParam("name") final String name) { try { return Response.ok(model.getDeploymentGroup(name)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.status(Response.Status.NOT_FOUND).build(); } } DeploymentGroupResource(final MasterModel model); @POST @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response createDeploymentGroup(@Valid final DeploymentGroup deploymentGroup); @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroup(@PathParam("name") final String name); @GET @Produces(APPLICATION_JSON) @Timed @ExceptionMetered List<String> getDeploymentGroup(); @DELETE @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response removeDeploymentGroup(@PathParam("name") @Valid final String name); @POST @Path("/{name}/rolling-update") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response rollingUpdate(@PathParam("name") @Valid final String name,
                                @Valid final RollingUpdateRequest args); @POST @Path("/{name}/stop") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response stopDeploymentGroup(@PathParam("name") @Valid final String name); @GET @Path("/{name}/status") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroupStatus(@PathParam("name") @Valid final String name);  }