Method name tweaks in JobRepository
This commit is contained in:
@@ -503,8 +503,8 @@ public class SimpleJobTests extends TestCase {
|
||||
passedInStepContext = new ExecutionContext(stepExecution.getExecutionContext());
|
||||
stepExecution.getExecutionContext().putString("stepKey", "stepValue");
|
||||
stepExecution.getJobExecution().getExecutionContext().putString("jobKey", "jobValue");
|
||||
jobRepository.save(stepExecution);
|
||||
jobRepository.persistExecutionContext(stepExecution);
|
||||
jobRepository.add(stepExecution);
|
||||
jobRepository.updateExecutionContext(stepExecution);
|
||||
|
||||
if (exception instanceof RuntimeException) {
|
||||
stepExecution.setExitStatus(ExitStatus.FAILED);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class SimpleJobRepositoryIntegrationTests {
|
||||
JobExecution firstJobExec = jobRepository.createJobExecution(job, jobParameters);
|
||||
StepExecution firstStepExec = new StepExecution(step.getName(), firstJobExec);
|
||||
jobRepository.update(firstJobExec);
|
||||
jobRepository.save(firstStepExec);
|
||||
jobRepository.add(firstStepExec);
|
||||
|
||||
assertEquals(1, jobRepository.getStepExecutionCount(firstJobExec.getJobInstance(), step));
|
||||
assertEquals(firstStepExec, jobRepository.getLastStepExecution(firstJobExec.getJobInstance(), step));
|
||||
@@ -139,7 +139,7 @@ public class SimpleJobRepositoryIntegrationTests {
|
||||
JobExecution secondJobExec = jobRepository.createJobExecution(job, jobParameters);
|
||||
StepExecution secondStepExec = new StepExecution(step.getName(), secondJobExec);
|
||||
jobRepository.update(secondJobExec);
|
||||
jobRepository.save(secondStepExec);
|
||||
jobRepository.add(secondStepExec);
|
||||
|
||||
assertEquals(2, jobRepository.getStepExecutionCount(secondJobExec.getJobInstance(), step));
|
||||
assertEquals(secondStepExec, jobRepository.getLastStepExecution(secondJobExec.getJobInstance(), step));
|
||||
@@ -162,8 +162,8 @@ public class SimpleJobRepositoryIntegrationTests {
|
||||
StepExecution stepExec = new StepExecution(step.getName(), jobExec);
|
||||
stepExec.setExecutionContext(ctx);
|
||||
|
||||
jobRepository.save(stepExec);
|
||||
jobRepository.persistExecutionContext(stepExec);
|
||||
jobRepository.add(stepExec);
|
||||
jobRepository.updateExecutionContext(stepExec);
|
||||
|
||||
StepExecution retrievedStepExec = jobRepository.getLastStepExecution(jobExec.getJobInstance(), step);
|
||||
assertEquals(stepExec, retrievedStepExec);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SimpleJobRepositoryTests extends TestCase {
|
||||
|
||||
// failure scenario -- no step id set.
|
||||
try {
|
||||
jobRepository.save(stepExecution);
|
||||
jobRepository.add(stepExecution);
|
||||
fail();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -107,13 +107,13 @@ public class AbstractStepTests extends TestCase {
|
||||
|
||||
static long counter = 0;
|
||||
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
Assert.state(stepExecution.getId() != null, "StepExecution must already be saved");
|
||||
saved = stepExecution.getExecutionContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(StepExecution stepExecution) {
|
||||
public void add(StepExecution stepExecution) {
|
||||
if (stepExecution.getId() == null) {
|
||||
stepExecution.setId(counter);
|
||||
counter++;
|
||||
@@ -237,7 +237,7 @@ public class AbstractStepTests extends TestCase {
|
||||
}
|
||||
};
|
||||
repository = new JobRepositoryStub() {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
throw new RuntimeException("Bad context!");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,13 +64,13 @@ public class JobRepositorySupport implements JobRepository {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save(StepExecution stepExecution) {
|
||||
public void add(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public void update(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
final JobExecution jobExecution = new JobExecution(jobInstance);
|
||||
final StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
|
||||
itemOrientedStep.setJobRepository(new JobRepositorySupport() {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
list.add(stepExecution);
|
||||
}
|
||||
});
|
||||
@@ -285,7 +285,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
private int counter = 0;
|
||||
|
||||
// initial save before item processing succeeds, later calls fail
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
if (counter > 0)
|
||||
throw new RuntimeException("foo");
|
||||
counter++;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TaskletStepTests extends TestCase {
|
||||
|
||||
public void testSuccessfulExecutionWithExecutionContext() throws Exception {
|
||||
TaskletStep step = new TaskletStep(new StubTasklet(false, false), new JobRepositorySupport() {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
list.add(stepExecution);
|
||||
}
|
||||
});
|
||||
@@ -82,7 +82,7 @@ public class TaskletStepTests extends TestCase {
|
||||
|
||||
public void testSuccessfulExecutionWithFailureOnSaveOfExecutionContext() throws Exception {
|
||||
TaskletStep step = new TaskletStep(new StubTasklet(false, false, true), new JobRepositorySupport() {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
throw new RuntimeException("foo");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user