ReportingService { @GET @Path("job/{jobId}/{date}") @Produces(MediaType.APPLICATION_JSON) public String getSingleJobReport(@PathParam("jobId") String jobId, @PathParam("date") String date) { try { UsageStatistic singleStatistic = jsonExtractor.getSingleStatistic(jobId, date); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(singleStatistic); } catch (IOException exception) { return getErrorResponse(exception); } } ReportingService(); @GET @Path("job/{jobId}/{date}") @Produces(MediaType.APPLICATION_JSON) String getSingleJobReport(@PathParam("jobId") String jobId, @PathParam("date") String date); @GET @Path("{user}") @Produces(MediaType.APPLICATION_JSON) String getAllJobReportsForUser(@PathParam("user") String user); @GET @Path("/all/users") @Produces(MediaType.APPLICATION_JSON) String getUserAggregatedJobReports(); @GET @Path("{user}/time/{year}") @Produces(MediaType.APPLICATION_JSON) String getYearlyJobReportTxt(@PathParam("user") String user, @PathParam("year") String year); @GET @Path("{user}/time/{year}/{month}") @Produces(MediaType.APPLICATION_JSON) String getMonthlyJobReportTxt(@PathParam("user") String user,
                                         @PathParam("year") String year,
                                         @PathParam("month") String month); @GET @Path("{user}/time/{year}/{month}/{day}") @Produces(MediaType.APPLICATION_JSON) String getMonthlyJobReportTxt(@PathParam("user") String user,
                                         @PathParam("year") String year,
                                         @PathParam("month") String month,
                                         @PathParam("day") String day); @GET @Path("{user}/range/{date_start}/{date_end}") @Produces(MediaType.APPLICATION_JSON) String getTimeSpecificJobReportTxt(@PathParam("user") String user,
                                              @PathParam("date_start") String start,
                                              @PathParam("date_end") String end); @GET @Path("/range-user/{date_start}/{date_end}") @Produces(MediaType.APPLICATION_JSON) String getRangeUserBetween(@PathParam("date_start") String start, @PathParam("date_end") String end); @GET @Path("/range-date/{date_start}/{date_end}") @Produces(MediaType.APPLICATION_JSON) String getRangeDateBetween(@PathParam("date_start") String start, @PathParam("date_end") String end); @GET @Path("/range-queue/{date_start}/{date_end}") @Produces(MediaType.APPLICATION_JSON) String getRangeQueueBetween(@PathParam("date_start") String start, @PathParam("date_end") String end); @GET @Path("/date/{date_start}") @Produces(MediaType.APPLICATION_JSON) String getFromDate(@PathParam("date_start") String startDate);  }
@Test public void canGetSingleJobReport() { String singleJobStatistic = reportingService.getSingleJobReport("job_1484837520075_13150", "2017-02-01"); assertThat(singleJobStatistic, equalTo("{\n" + " \"jobId\": \"job_1484837520075_13150\",\n" + " \"user\": \"cvop\",\n" + " \"queue\": \"consolidation\",\n" + " \"submitTime\": 0,\n" + " \"startTime\": 1486060805105,\n" + " \"finishTime\": 1486061123937,\n" + " \"state\": \"SUCCEEDED\",\n" + " \"jobName\": \"ql S2A_MSIL1C_20170202T104241_N0204_R008_T32UMA_20170202T104536\",\n" + " \"inputPath\": \"hdfs: " \"mapsCompleted\": 1,\n" + " \"totalMaps\": 1,\n" + " \"reducesCompleted\": 0,\n" + " \"fileBytesRead\": 0,\n" + " \"inputFileBytesRead\": 0,\n" + " \"fileSplitBytesRead\": 0,\n" + " \"fileBytesWritten\": 264225,\n" + " \"hdfsBytesRead\": 315351229,\n" + " \"hdfsBytesWritten\": 325321,\n" + " \"mbMillisMapTotal\": 804208640,\n" + " \"mbMillisReduceTotal\": 0,\n" + " \"vCoresMillisTotal\": 314144,\n" + " \"cpuMilliseconds\": 321370\n" + "}")); }