improved testcase from 1.1.x branch (BATCH-751)

This commit is contained in:
robokaso
2008-07-30 08:23:43 +00:00
parent 9b5482af40
commit 21ed2d129d
2 changed files with 13 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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)
*/