improved testcase from 1.1.x branch (BATCH-751)
This commit is contained in:
@@ -13,6 +13,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Tests for {@link AbstractStep}.
|
||||
@@ -103,11 +104,23 @@ public class AbstractStepTests extends TestCase {
|
||||
private static class JobRepositoryStub extends JobRepositorySupport {
|
||||
|
||||
ExecutionContext saved = new ExecutionContext();
|
||||
|
||||
static long counter = 0;
|
||||
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
Assert.state(stepExecution.getId() != null, "StepExecution must already be saved");
|
||||
saved = stepExecution.getExecutionContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(StepExecution stepExecution) {
|
||||
if (stepExecution.getId() == null) {
|
||||
stepExecution.setId(counter);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
|
||||
@@ -42,12 +42,6 @@ public class JobRepositorySupport implements JobRepository {
|
||||
public void update(JobExecution jobExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.container.common.repository.JobRepository#saveOrUpdate(org.springframework.batch.container.common.domain.StepExecution)
|
||||
*/
|
||||
public void saveOrUpdate(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.container.common.repository.JobRepository#update(org.springframework.batch.container.common.domain.Job)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user