SlaveRunnerService extends Service { @Override protected ServiceDescriptor createServiceDescriptor() { return DtoFactory.getInstance().createDto(RunnerServerDescriptor.class).withAssignedWorkspace(assignedWorkspace) .withAssignedProject(assignedProject); }  @GenerateLink(rel = Constants.LINK_REL_RUN) @Path("run") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) ApplicationProcessDescriptor run(@Description("Parameters for run task in JSON format") RunRequest request); @GET @Path("status/{runner:.*}/{id}") @Produces(MediaType.APPLICATION_JSON) ApplicationProcessDescriptor getStatus(@PathParam("runner") String runner, @PathParam("id") Long id); @POST @Path("stop/{runner:.*}/{id}") @RolesAllowed({"user", "temp_user"}) @Produces(MediaType.APPLICATION_JSON) ApplicationProcessDescriptor stop(@PathParam("runner") String runner, @PathParam("id") Long id); @GET @Path("logs/{runner:.*}/{id}") @RolesAllowed({"user", "temp_user"}) void getLogs(@PathParam("runner") String runner,
                        @PathParam("id") Long id,
                        @Context HttpServletResponse httpServletResponse); @GET @Path("recipe/{runner:.*}/{id}") @RolesAllowed({"user", "temp_user"}) void getRecipeFile(@PathParam("runner") String runner,
                              @PathParam("id") Long id,
                              @Context HttpServletResponse httpServletResponse); @GenerateLink(rel = Constants.LINK_REL_SERVER_STATE) @GET @Path("server-state") @Produces(MediaType.APPLICATION_JSON) ServerState getServerState(); @GenerateLink(rel = Constants.LINK_REL_AVAILABLE_RUNNERS) @GET @Path("available") @Produces(MediaType.APPLICATION_JSON) List<RunnerDescriptor> getAvailableRunners(); @GenerateLink(rel = Constants.LINK_REL_RUNNER_STATE) @GET @Path("state") @Produces(MediaType.APPLICATION_JSON) RunnerState getRunnerState(@Required
                                      @Description("Name of the runner")
                                      @QueryParam("runner") String runner); @GenerateLink(rel = Constants.LINK_REL_RUNNER_ENVIRONMENTS) @GET @Path("environments") @Produces(MediaType.APPLICATION_JSON) List<RunnerEnvironment> getRunnerEnvironments(@Required
                                                         @Description("Name of the runner")
                                                         @QueryParam("runner") String runner); @GenerateLink(rel = Constants.LINK_REL_GET_CURRENT_RECIPE) @GET @Path("/recipe") @RolesAllowed({"user", "temp_user"}) @Produces(MediaType.APPLICATION_JSON) Response getRecipe(@QueryParam("id") String id);  }
@Test public void testGetRunnerServerDescriptor() throws Exception { doReturn(dto(RunnerServerDescriptor.class).withAssignedWorkspace("my_ws").withAssignedProject("my_project")) .when(service).createServiceDescriptor(); RunnerServerDescriptor descriptor = (RunnerServerDescriptor)service.getServiceDescriptor(); Assert.assertEquals(descriptor.getHref(), "http: Assert.assertEquals(descriptor.getAssignedWorkspace(), "my_ws"); Assert.assertEquals(descriptor.getAssignedProject(), "my_project"); }