SystemJobRestController extends HerdBaseController { @RequestMapping(value = "/systemJobs", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_SYSTEM_JOBS_POST) public SystemJobRunResponse runSystemJob(@RequestBody SystemJobRunRequest request) throws Exception { return systemJobService.runSystemJob(request); }  @RequestMapping(value = "/systemJobs", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_SYSTEM_JOBS_POST) SystemJobRunResponse runSystemJob(@RequestBody SystemJobRunRequest request);  }
@Test public void testRunSystemJobFileUploadCleanup() throws Exception { SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(FileUploadCleanupJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.FILE_UPLOAD_CLEANUP_JOB_THRESHOLD_MINUTES.getKey(), String.valueOf(INTEGER_VALUE)))); SystemJobRunResponse systemJobRunResponse = new SystemJobRunResponse(FileUploadCleanupJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.FILE_UPLOAD_CLEANUP_JOB_THRESHOLD_MINUTES.getKey(), String.valueOf(INTEGER_VALUE)))); when(systemJobService.runSystemJob(systemJobRunRequest)).thenReturn(systemJobRunResponse); SystemJobRunResponse resultSystemJobRunResponse = systemJobRestController.runSystemJob(systemJobRunRequest); verify(systemJobService).runSystemJob(systemJobRunRequest); verifyNoMoreInteractions(systemJobService); assertEquals(systemJobRunResponse, resultSystemJobRunResponse); }
@Test public void testRunSystemJobJmsPublisher() throws Exception { SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(JmsPublishingJob.JOB_NAME, null); SystemJobRunResponse systemJobRunResponse = new SystemJobRunResponse(JmsPublishingJob.JOB_NAME, null); when(systemJobService.runSystemJob(systemJobRunRequest)).thenReturn(systemJobRunResponse); SystemJobRunResponse resultSystemJobRunResponse = systemJobRestController.runSystemJob(systemJobRunRequest); verify(systemJobService).runSystemJob(systemJobRunRequest); verifyNoMoreInteractions(systemJobService); assertEquals(systemJobRunResponse, resultSystemJobRunResponse); }
@Test public void testRunSystemJobStoragePolicySelector() throws Exception { SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(StoragePolicySelectorJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.STORAGE_POLICY_SELECTOR_JOB_MAX_BDATA_INSTANCES.getKey(), String.valueOf(INTEGER_VALUE)))); SystemJobRunResponse systemJobRunResponse = new SystemJobRunResponse(StoragePolicySelectorJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.STORAGE_POLICY_SELECTOR_JOB_MAX_BDATA_INSTANCES.getKey(), String.valueOf(INTEGER_VALUE)))); when(systemJobService.runSystemJob(systemJobRunRequest)).thenReturn(systemJobRunResponse); SystemJobRunResponse resultSystemJobRunResponse = systemJobRestController.runSystemJob(systemJobRunRequest); verify(systemJobService).runSystemJob(systemJobRunRequest); verifyNoMoreInteractions(systemJobService); assertEquals(systemJobRunResponse, resultSystemJobRunResponse); }