@Test public void createJobFileChangedTest() throws PacManException, JsonParseException, JsonMappingException, IOException { JobDetails createJobDetails = getCreateJobDetailsRequest(); createJobDetails.setIsFileChanged(true); MultipartFile firstFile = getMockMultipartFile(); mockStatic(ByteBuffer.class); Map<String, Object> newJobParams = Maps.newHashMap(); newJobParams.put("jobName", "jobName123"); newJobParams.put("jobUuid", "jobUuid123"); newJobParams.put("jobType", "jobType123"); newJobParams.put("jobDesc", "jobDesc123"); when(mapper.readValue(anyString(), any(TypeReference.class))).thenReturn(newJobParams); when(mapper.writeValueAsString(any())).thenReturn("[]"); JobProperty jobProperty = buildJobProperty(); when(config.getJob()).thenReturn(jobProperty); when(putRuleRequest.withName(anyString()).withDescription(anyString()).withState(anyString())).thenReturn(putRuleRequest); when(amazonCloudWatchEvents.putRule(any())).thenReturn(putRuleResult); String ruleArn = "ruleArn123"; when(putRuleResult.getRuleArn()).thenReturn(ruleArn); when(amazonCloudWatchEvents.putTargets(any())).thenReturn(putTargetsResult); ByteBuffer params = ByteBuffer.wrap(createJobDetails.getJobParams().getBytes()); when(ByteBuffer.wrap(any())).thenReturn(params); when(awsLambdaClient.invoke(any())).thenReturn(invokeResult); when(invokeResult.getStatusCode()).thenReturn(200); when(invokeRequest.withFunctionName(anyString()).withPayload(any(ByteBuffer.class))).thenReturn(invokeRequest); int count = 0; when(putTargetsResult.getFailedEntryCount()).thenReturn(count); Map<String, Object> ruleParamDetails = Maps.newHashMap(); when(mapper.readValue(anyString(), any(TypeReference.class))).thenReturn(ruleParamDetails); assertThat(jobExecutionManagerService.createJob(firstFile, createJobDetails, "user123"), is(JOB_CREATION_SUCCESS)); }
@Override public String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId) throws PacManException { return addJobExecutionManager(fileToUpload, jobDetails, userId); }
JobExecutionManagerServiceImpl implements JobExecutionManagerService { @Override public String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId) throws PacManException { return addJobExecutionManager(fileToUpload, jobDetails, userId); } }
JobExecutionManagerServiceImpl implements JobExecutionManagerService { @Override public String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId) throws PacManException { return addJobExecutionManager(fileToUpload, jobDetails, userId); }  }
JobExecutionManagerServiceImpl implements JobExecutionManagerService { @Override public String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId) throws PacManException { return addJobExecutionManager(fileToUpload, jobDetails, userId); }  @Override Page<JobExecutionManagerListProjections> getAllJobExecutionManagers(final Integer page, final Integer size, final String searchTerm); @Override String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId); @Override String updateJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId); @Override Collection<String> getAllJobIds(); @Override JobExecutionManager getByJobId(final String jobId); @Override String enableDisableJob(final String jobId, final String action, final String userId); }
JobExecutionManagerServiceImpl implements JobExecutionManagerService { @Override public String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId) throws PacManException { return addJobExecutionManager(fileToUpload, jobDetails, userId); }  @Override Page<JobExecutionManagerListProjections> getAllJobExecutionManagers(final Integer page, final Integer size, final String searchTerm); @Override String createJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId); @Override String updateJob(final MultipartFile fileToUpload, final JobDetails jobDetails, final String userId); @Override Collection<String> getAllJobIds(); @Override JobExecutionManager getByJobId(final String jobId); @Override String enableDisableJob(final String jobId, final String action, final String userId);  }