@Test public void getPoliciesTest() throws Exception { List<JobExecutionManagerListProjections> jobExecutionManagerDetails = Lists.newArrayList(); jobExecutionManagerDetails.add(getjobExecutionManagerDetailsProjections()); Page<JobExecutionManagerListProjections> allJobExecutionManagerDetails = new PageImpl<JobExecutionManagerListProjections>(jobExecutionManagerDetails,new PageRequest(0, 1), jobExecutionManagerDetails.size()); when(jobExecutionManagerService.getAllJobExecutionManagers(anyInt(), anyInt(), anyString())).thenReturn(allJobExecutionManagerDetails); mockMvc.perform(get("/job-execution-manager/list").principal(principal) .param("page", "0") .param("size", "1") .param("searchTerm", StringUtils.EMPTY)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.message", is("success"))); }
@ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAllJobExecutionManagers( @ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page, @ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size, @ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) { try { return ResponseUtils.buildSucessResponse(jobExecutionManagerService.getAllJobExecutionManagers(page, size, searchTerm.trim())); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }
JobExecutionManagerController { @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAllJobExecutionManagers( @ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page, @ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size, @ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) { try { return ResponseUtils.buildSucessResponse(jobExecutionManagerService.getAllJobExecutionManagers(page, size, searchTerm.trim())); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } } }
JobExecutionManagerController { @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAllJobExecutionManagers( @ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page, @ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size, @ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) { try { return ResponseUtils.buildSucessResponse(jobExecutionManagerService.getAllJobExecutionManagers(page, size, searchTerm.trim())); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  }
JobExecutionManagerController { @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAllJobExecutionManagers( @ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page, @ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size, @ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) { try { return ResponseUtils.buildSucessResponse(jobExecutionManagerService.getAllJobExecutionManagers(page, size, searchTerm.trim())); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllJobExecutionManagers(
			@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
			@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
			@ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm); @ApiOperation(httpMethod = "POST", value = "API to create new job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @RequestMapping(path = "/create", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) ResponseEntity<Object> createJob(@AuthenticationPrincipal Principal user,
			 @ApiParam(value = "provide valid job details", required = false) @RequestParam(defaultValue = StringUtils.EMPTY, value = "file", required = false) MultipartFile fileToUpload, JobDetails createJobDetails); @ApiOperation(httpMethod = "POST", value = "API to update existing job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @RequestMapping(path = "/update", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) ResponseEntity<Object> updateJob(@AuthenticationPrincipal Principal user,
			 @ApiParam(value = "provide valid job details", required = false) @RequestParam(value = "file", required = false) MultipartFile fileToUpload, JobDetails updateJobDetails); @ApiOperation(httpMethod = "GET", value = "API to get all Job Id's", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/job-ids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllJobIds(); @ApiOperation(httpMethod = "GET", value = "API to get job by id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/details-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getRulesById(
			@ApiParam(value = "provide valid job id", required = true) @RequestParam(defaultValue = StringUtils.EMPTY, name = "jobId", required = true) String jobId); }
JobExecutionManagerController { @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> getAllJobExecutionManagers( @ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page, @ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size, @ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm) { try { return ResponseUtils.buildSucessResponse(jobExecutionManagerService.getAllJobExecutionManagers(page, size, searchTerm.trim())); } catch (Exception exception) { log.error(UNEXPECTED_ERROR_OCCURRED, exception); return ResponseUtils.buildFailureResponse(new Exception(UNEXPECTED_ERROR_OCCURRED), exception.getMessage()); } }  @ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllJobExecutionManagers(
			@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
			@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
			@ApiParam(value = "provide valid search term", required = false) @RequestParam(defaultValue="", name = "searchTerm", required = false) String searchTerm); @ApiOperation(httpMethod = "POST", value = "API to create new job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @RequestMapping(path = "/create", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) ResponseEntity<Object> createJob(@AuthenticationPrincipal Principal user,
			 @ApiParam(value = "provide valid job details", required = false) @RequestParam(defaultValue = StringUtils.EMPTY, value = "file", required = false) MultipartFile fileToUpload, JobDetails createJobDetails); @ApiOperation(httpMethod = "POST", value = "API to update existing job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @RequestMapping(path = "/update", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) ResponseEntity<Object> updateJob(@AuthenticationPrincipal Principal user,
			 @ApiParam(value = "provide valid job details", required = false) @RequestParam(value = "file", required = false) MultipartFile fileToUpload, JobDetails updateJobDetails); @ApiOperation(httpMethod = "GET", value = "API to get all Job Id's", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/job-ids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getAllJobIds(); @ApiOperation(httpMethod = "GET", value = "API to get job by id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(path = "/details-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Object> getRulesById(
			@ApiParam(value = "provide valid job id", required = true) @RequestParam(defaultValue = StringUtils.EMPTY, name = "jobId", required = true) String jobId);  }