TasksResource { @GET @Path("/{jobName}/{jobId}/tasks") @Produces(MediaType.APPLICATION_JSON) public Response getTasks( @PathParam("jobName") final String jobName, @PathParam("jobId") final String jobId) { try { return Response.ok(taskProxy.getTasks(new JobInstance(jobName, jobId))).build(); } catch (IllegalArgumentException e) { String message = String.format("Invalid arguments for getTasks. jobName: %s, jobId: %s.", jobName, jobId); LOG.error(message, e); return Responses.badRequestResponse(message); } catch (Exception e) { LOG.error(String.format("Error in getTasks with arguments jobName: %s, jobId: %s.", jobName, jobId), e); return Responses.errorResponse(e.getMessage()); } } TasksResource(TaskResourceConfig config); @GET @Path("/{jobName}/{jobId}/tasks") @Produces(MediaType.APPLICATION_JSON) Response getTasks(
      @PathParam("jobName") final String jobName,
      @PathParam("jobId") final String jobId);  }
@Test public void testGetTasks() throws IOException { String requestUrl = String.format("v1/jobs/%s/%s/tasks", "testJobName", "testJobId"); Response response = target(requestUrl).request().get(); assertEquals(200, response.getStatus()); Task[] tasks = objectMapper.readValue(response.readEntity(String.class), Task[].class); assertEquals(2, tasks.length); assertEquals(MockTaskProxy.TASK_1_PREFERRED_HOST, tasks[0].getPreferredHost()); assertEquals(MockTaskProxy.TASK_1_CONTAINER_ID, tasks[0].getContainerId()); assertEquals(MockTaskProxy.TASK_1_NAME, tasks[0].getTaskName()); assertEquals(MockTaskProxy.PARTITIONS, tasks[0].getPartitions()); assertEquals(MockTaskProxy.TASK_2_PREFERRED_HOST, tasks[1].getPreferredHost()); assertEquals(MockTaskProxy.TASK_2_CONTAINER_ID, tasks[1].getContainerId()); assertEquals(MockTaskProxy.TASK_2_NAME, tasks[1].getTaskName()); assertEquals(MockTaskProxy.PARTITIONS, tasks[1].getPartitions()); }