JobsController { @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs", method = GET, produces = "text/html") public ModelAndView getJobsAsHtml(@RequestParam(value = "type", required = false) String type, @RequestParam(value = "count", defaultValue = "100") int count, @RequestParam(value = "distinct", defaultValue = "true", required = false) boolean distinct, HttpServletRequest request) { final List<JobRepresentation> jobRepresentations = getJobInfos(type, count, distinct).stream() .map((j) -> representationOf(j, getJobMeta(j.getJobType()), true, baseUriOf(request), applicationProperties.getManagement().getBasePath())) .collect(toList()); final ModelAndView modelAndView = new ModelAndView("jobs"); modelAndView.addObject("jobs", jobRepresentations); if (type != null) { modelAndView.addObject("typeFilter", type); } modelAndView.addObject("baseUri", baseUriOf(request)); return modelAndView; } @Autowired  JobsController(final JobService jobService,
                   final JobMetaService jobMetaService,
                   final NavBar rightNavBar,
                   final EdisonApplicationProperties applicationProperties); @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs", method = GET, produces = "text/html") ModelAndView getJobsAsHtml(@RequestParam(value = "type", required = false) String type,
                                      @RequestParam(value = "count", defaultValue = "100") int count,
                                      @RequestParam(value = "distinct", defaultValue = "true", required = false) boolean distinct,
                                      HttpServletRequest request); @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs", method = GET, produces = "application/json") @ResponseBody List<JobRepresentation> getJobsAsJson(@RequestParam(name = "type", required = false) String type,
                                                 @RequestParam(name = "count", defaultValue = "10") int count,
                                                 @RequestParam(name = "distinct", defaultValue = "true", required = false) boolean distinct,
                                                 @RequestParam(name = "humanReadable", defaultValue = "false", required = false) boolean humanReadable,
                                                 HttpServletRequest request); @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs", method = DELETE) void deleteJobs(@RequestParam(value = "type", required = false) String type); @RequestMapping( value = "${edison.application.management.base-path:/internal}/jobs/{jobType}", method = POST) void startJob(final @PathVariable String jobType,
                         final HttpServletRequest request,
                         final HttpServletResponse response); @RequestMapping( value = "${edison.application.management.base-path:/internal}/jobs/{jobType}/disable", method = POST ) String disableJobType(final @PathVariable String jobType,
                                 final @RequestParam(required = false) String disabledComment); @RequestMapping( value = "${edison.application.management.base-path:/internal}/jobs/{jobType}/enable", method = POST ) String enableJobType(final @PathVariable String jobType); @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs/{id}", method = GET, produces = "text/html") ModelAndView getJobAsHtml(final HttpServletRequest request,
                                     final HttpServletResponse response,
                                     @PathVariable("id") final String jobId); @RequestMapping(value = "${edison.application.management.base-path:/internal}/jobs/{id}", method = GET, produces = "application/json") @ResponseBody JobRepresentation getJob(final HttpServletRequest request,
                                    final HttpServletResponse response,
                                    @PathVariable("id") final String jobId,
                                    @RequestParam(name = "humanReadable", defaultValue = "false", required = false) boolean humanReadable
    );  }
@Test @SuppressWarnings("unchecked") public void shouldReturnAllJobsOfTypeAsHtml() { JobInfo firstJob = newJobInfo("42", "SOME_TYPE", systemDefaultZone(), "localhost"); when(jobService.findJobs(Optional.of("SOME_TYPE"), 100)).thenReturn(asList(firstJob)); ModelAndView modelAndView = jobsController.getJobsAsHtml("SOME_TYPE", 100, false, mock(HttpServletRequest.class)); List<JobRepresentation> jobs = (List<JobRepresentation>) modelAndView.getModel().get("jobs"); assertThat(jobs, is(asList(representationOf(firstJob, null, false, "", "")))); }