BatchToResourceMapper { public static JobExecution map(final org.springframework.batch.core.JobExecution jobExecution) { final JobExecution response = new JobExecution(); response.setId(jobExecution.getId()); response.setCreateTime(jobExecution.getCreateTime()); response.setEndTime(jobExecution.getEndTime()); response.setExitStatus(map(jobExecution.getExitStatus())); response.setFailureExceptions(jobExecution.getFailureExceptions()); response.setJobConfigurationName(jobExecution.getJobConfigurationName()); response.setJobInstance(map(jobExecution.getJobInstance())); response.setJobParameters(map(jobExecution.getJobParameters())); response.setLastUpdated(jobExecution.getLastUpdated()); response.setStartTime(jobExecution.getStartTime()); response.setStatus(map(jobExecution.getStatus())); response.setStepExecutions(mapStepExecutions(jobExecution.getStepExecutions())); response.setVersion(jobExecution.getVersion()); return response; } private  BatchToResourceMapper(); static List<JobExecution> mapExecutions(final Collection<org.springframework.batch.core.JobExecution>
                                                           jobExecutions); static JobExecution map(final org.springframework.batch.core.JobExecution jobExecution); static List<JobInstance> mapInstances(final Collection<org.springframework.batch.core.JobInstance>
                                                         jobInstances); static JobInstance map(final org.springframework.batch.core.JobInstance jobInstance); static JobParameters map(final org.springframework.batch.core.JobParameters jobParameters); static StepExecution map(final org.springframework.batch.core.StepExecution stepExecution); static ExitStatus map(final org.springframework.batch.core.ExitStatus exitStatus); static BatchStatus map(final org.springframework.batch.core.BatchStatus batchStatus); static ParameterType map(final org.springframework.batch.core.JobParameter.ParameterType parameterType);  }
@Test public void testMapExecution() { final org.springframework.batch.core.JobExecution jobExecution = DomainTestHelper.createJobExecution((long) 1); final org.springframework.batch.core.JobInstance jobInstance = DomainTestHelper.createJobInstance((long) 1, "test"); jobExecution.setJobInstance(jobInstance); final JobExecution result = BatchToResourceMapper.map(jobExecution); this.assertJobExecution(result, jobExecution); }
@Test public void testMapStepExecution() { final org.springframework.batch.core.StepExecution stepExecution = DomainTestHelper.createStepExecution("testStep", DomainTestHelper.createJobExecution(1L)); final StepExecution result = BatchToResourceMapper.map(stepExecution); this.assertStepExecution(result, stepExecution); }
@Test public void tesMapJobInstance() { final org.springframework.batch.core.JobInstance jobInstance = DomainTestHelper.createJobInstance(1L, "testJob"); final JobInstance result = BatchToResourceMapper.map(jobInstance); this.assertJobInstance(result, jobInstance); }
@Test public void testMapJobParameter() { final String parameterName = "Long"; final Long value = 10L; final org.springframework.batch.core.JobParameters jobParameters = new JobParametersBuilder().addLong(parameterName, value).toJobParameters(); final JobParameters result = BatchToResourceMapper.map(jobParameters); final Map<String, JobParameter> resultMap = result.getParameters(); assertThat(resultMap.containsKey(parameterName)).isTrue(); assertThat(resultMap.get(parameterName).getParameter()).isEqualTo(value); }
@Test public void testMapExitStatus() { final String exitCode = "exitCode"; final String exitDescription = "exitDescription"; final org.springframework.batch.core.ExitStatus exitStatus = new org.springframework.batch.core.ExitStatus(exitCode, exitDescription); final ExitStatus result = BatchToResourceMapper.map(exitStatus); assertThat(result.getExitCode()).isEqualTo(exitCode); assertThat(result.getExitDescription()).isEqualTo(exitDescription); }