ReportingService { @GET @Path("/date/{date_start}") @Produces(MediaType.APPLICATION_JSON) public String getFromDate(@PathParam("date_start") String startDate) { try { List<UsageStatistic> usageStatisticsSince = jsonExtractor.getUsageStatisticsSince(startDate); Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(usageStatisticsSince); } catch (IOException | DatabaseFileNotFoundException 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 canGetFromDate() { String usageStatistics = reportingService.getFromDate("2017-06-01T00:01:42Z"); assertThat(usageStatistics, equalTo("[\n" + " {\n" + " \"jobId\": \"job_1495452880837_5073\",\n" + " \"user\": \"cvop\",\n" + " \"queue\": \"consolidation\",\n" + " \"submitTime\": 0,\n" + " \"startTime\": 1496275056280,\n" + " \"finishTime\": 1496275302818,\n" + " \"state\": \"SUCCEEDED\",\n" + " \"jobName\": \"ql S2A_MSIL1C_20170530T103021_N0205_R108_T32UNA_20170530T103024\",\n" + " \"workflowType\": \"QL\",\n" + " \"inputPath\": \"hdfs: " \"inProductType\": \"/calvalus/eodata/S2_L1C/v2/2017/05/30/S2A_MSIL1C_20170530T103021_N0205_R108_T32UNA_20170530T103024.zip\",\n" + " \"mapsCompleted\": 1,\n" + " \"totalMaps\": 1,\n" + " \"reducesCompleted\": 0,\n" + " \"fileBytesRead\": 0,\n" + " \"inputFileBytesRead\": 0,\n" + " \"fileSplitBytesRead\": 0,\n" + " \"fileBytesWritten\": 274389,\n" + " \"hdfsBytesRead\": 809763005,\n" + " \"hdfsBytesWritten\": 548207,\n" + " \"mbMillisMapTotal\": 622668800,\n" + " \"mbMillisReduceTotal\": 0,\n" + " \"vCoresMillisTotal\": 243230,\n" + " \"cpuMilliseconds\": 250370\n" + " }\n" + "]")); }