JobExecutionFeService extends CommonFeService { public JobExecutionDetailsModel getJobExecutionDetailsModel(final Long jobExecutionId, final String applicationInstanceId) { final LightminClientApplication lightminClientApplication = this.findLightminClientApplicatonById(applicationInstanceId); final JobExecution jobExecution = this.jobServerService.getJobExecution(jobExecutionId, lightminClientApplication); final List<StepExecutionModel> stepExecutionModels = this.mapStepExecutions(jobExecution.getStepExecutions()); final List<JobParameterModel> jobParameterModels = this.mapJobParameters(jobExecution.getJobParameters()); final JobExecutionDetailsModel jobExecutionDetailsModel = new JobExecutionDetailsModel(); this.mapJobExecution(jobExecution, jobExecutionDetailsModel); jobExecutionDetailsModel.setExitMessage(jobExecution.getExitStatus().getExitDescription()); jobExecutionDetailsModel.setStepExecutions(stepExecutionModels); jobExecutionDetailsModel.setJobParameters(jobParameterModels); return jobExecutionDetailsModel; } JobExecutionFeService(final RegistrationBean registrationBean, final JobServerService jobServerService); ContentPageModel<List<JobExecutionModel>> getJobExecutionModelPage(final String applicationInstanceId,
                                                                              final String jobName,
                                                                              final Integer startIndex,
                                                                              final Integer pageSize); JobExecutionDetailsModel getJobExecutionDetailsModel(final Long jobExecutionId,
                                                                final String applicationInstanceId); void restartJobExecution(final Long jobExecutionId, final String applicationInstanceId); void stopJobExecution(final Long jobExecutionId, final String applicationInstanceId);  }
@Test public void testGetJobExecutionDetailsModel() { final LightminClientApplication applicationInstance = new LightminClientApplication(); when(this.registrationBean.findById(APPLICATION_INSTANCE_ID)).thenReturn(applicationInstance); final JobExecution jobExecution = ApiTestHelper.createJobExecution(JOB_EXECUTION_ID); when(this.jobServerService.getJobExecution(JOB_EXECUTION_ID, applicationInstance)).thenReturn(jobExecution); final JobExecutionDetailsModel result = this.jobExecutionFeService.getJobExecutionDetailsModel(JOB_EXECUTION_ID, APPLICATION_INSTANCE_ID); BDDAssertions.then(result).isNotNull(); BDDAssertions.then(result.getId()).isEqualTo(jobExecution.getId()); }