JobsResource { @GET @Path("/{jobName}/{jobId}") @Produces(MediaType.APPLICATION_JSON) public Response getJob( @PathParam("jobName") final String jobName, @PathParam("jobId") final String jobId) { JobInstance jobInstance = new JobInstance(jobName, jobId); try { if (!jobProxy.jobExists(jobInstance)) { return Response.status(Response.Status.NOT_FOUND).entity(Collections.singletonMap("message", String.format("%s does not exist.", jobInstance))).build(); } Job job = jobProxy.getJobStatus(jobInstance); return Response.ok(job).build(); } catch (Exception e) { log.error("Error in getJob.", e); return Responses.errorResponse(e.getMessage()); } } JobsResource(JobsResourceConfig config); @GET @Produces(MediaType.APPLICATION_JSON) Response getInstalledJobs(); @GET @Path("/{jobName}/{jobId}") @Produces(MediaType.APPLICATION_JSON) Response getJob(
      @PathParam("jobName") final String jobName,
      @PathParam("jobId") final String jobId); @PUT @Path("/{jobName}/{jobId}") @Produces(MediaType.APPLICATION_JSON) Response updateJobStatus(
      @PathParam("jobName") final String jobName,
      @PathParam("jobId") final String jobId,
      @QueryParam("status") String status);  }
@Test public void testGetJob() throws IOException { Response resp = target(String.format("v1/jobs/%s/%s", MockJobProxy.JOB_INSTANCE_2_NAME, MockJobProxy.JOB_INSTANCE_2_ID)).request().get(); assertEquals(200, resp.getStatus()); final Job job2 = objectMapper.readValue(resp.readEntity(String.class), Job.class); assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, job2.getJobName()); assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, job2.getJobId()); assertStatusNotDefault(job2); resp.close(); }