XD-1390: Updated SimpleJobRepository to return StepExecutions from previous run so UNKNOWN check will apply

This commit is contained in:
Michael Minella
2014-05-27 11:06:18 -05:00
parent 88f73791fb
commit e3e16f864b
2 changed files with 17 additions and 11 deletions

View File

@@ -15,12 +15,6 @@
*/
package org.springframework.batch.core.repository.support;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.Date;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
@@ -38,6 +32,13 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
* Repository tests using JDBC DAOs (rather than mocks).
*
@@ -199,7 +200,11 @@ public class SimpleJobRepositoryIntegrationTests {
jobRepository.update(jobExecution);
Thread.sleep(10);
jobExecution = jobRepository.createJobExecution(job.getName(), jobParameters);
StepExecution stepExecution = new StepExecution("step1", jobExecution);
jobRepository.add(stepExecution);
jobExecution.addStepExecutions(Arrays.asList(stepExecution));
assertEquals(jobExecution, jobRepository.getLastJobExecution(job.getName(), jobParameters));
assertEquals(stepExecution, jobExecution.getStepExecutions().iterator().next());
}
}