IN PROGRESS - BATCH-518: clean up the *Or* repository methods
saveOrUpdate(StepExecution) split to save and update
This commit is contained in:
@@ -499,7 +499,7 @@ public class SimpleJobTests extends TestCase {
|
||||
passedInStepContext = new ExecutionContext(stepExecution.getExecutionContext());
|
||||
stepExecution.getExecutionContext().putString("stepKey", "stepValue");
|
||||
stepExecution.getJobExecution().getExecutionContext().putString("jobKey", "jobValue");
|
||||
jobRepository.saveOrUpdate(stepExecution);
|
||||
jobRepository.save(stepExecution);
|
||||
jobRepository.saveOrUpdateExecutionContext(stepExecution);
|
||||
|
||||
if (exception instanceof RuntimeException) {
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
|
||||
JobExecution firstJobExec = jobRepository.createJobExecution(job, jobParameters);
|
||||
StepExecution firstStepExec = new StepExecution(step.getName(), firstJobExec);
|
||||
jobRepository.updateJobExecution(firstJobExec);
|
||||
jobRepository.saveOrUpdate(firstStepExec);
|
||||
jobRepository.save(firstStepExec);
|
||||
|
||||
assertEquals(1, jobRepository.getStepExecutionCount(firstJobExec.getJobInstance(), step));
|
||||
assertEquals(firstStepExec, jobRepository.getLastStepExecution(firstJobExec.getJobInstance(), step));
|
||||
@@ -122,7 +122,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
|
||||
firstStepExec.setStartTime(new Date(5));
|
||||
firstStepExec.setStatus(BatchStatus.FAILED);
|
||||
firstStepExec.setEndTime(new Date(6));
|
||||
jobRepository.saveOrUpdate(firstStepExec);
|
||||
jobRepository.update(firstStepExec);
|
||||
firstJobExec.setStatus(BatchStatus.FAILED);
|
||||
firstJobExec.setEndTime(new Date(7));
|
||||
jobRepository.updateJobExecution(firstJobExec);
|
||||
@@ -131,7 +131,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
|
||||
JobExecution secondJobExec = jobRepository.createJobExecution(job, jobParameters);
|
||||
StepExecution secondStepExec = new StepExecution(step.getName(), secondJobExec);
|
||||
jobRepository.updateJobExecution(secondJobExec);
|
||||
jobRepository.saveOrUpdate(secondStepExec);
|
||||
jobRepository.save(secondStepExec);
|
||||
|
||||
assertEquals(2, jobRepository.getStepExecutionCount(secondJobExec.getJobInstance(), step));
|
||||
assertEquals(secondStepExec, jobRepository.getLastStepExecution(secondJobExec.getJobInstance(), step));
|
||||
@@ -153,7 +153,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
|
||||
StepExecution stepExec = new StepExecution(step.getName(), jobExec);
|
||||
stepExec.setExecutionContext(ctx);
|
||||
|
||||
jobRepository.saveOrUpdate(stepExec);
|
||||
jobRepository.save(stepExec);
|
||||
jobRepository.saveOrUpdateExecutionContext(stepExec);
|
||||
|
||||
StepExecution retrievedStepExec = jobRepository.getLastStepExecution(jobExec.getJobInstance(), step);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class SimpleJobRepositoryTests extends TestCase {
|
||||
|
||||
// failure scenario -- no step id set.
|
||||
try {
|
||||
jobRepository.saveOrUpdate(stepExecution);
|
||||
jobRepository.save(stepExecution);
|
||||
fail();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -47,12 +47,6 @@ public class JobRepositorySupport implements JobRepository {
|
||||
*/
|
||||
public void saveOrUpdate(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.repository.JobRepository#saveOrUpdateExecutionContext(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.container.common.repository.JobRepository#update(org.springframework.batch.container.common.domain.Job)
|
||||
@@ -76,4 +70,13 @@ public class JobRepositorySupport implements JobRepository {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public void update(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user