IN PROGRESS - BATCH-518: clean up the *Or* repository methods
renamed saveOrUpdateExecutionContext to persistExecutionContext (since EC has no identity 'save vs. update' doesn't apply).
This commit is contained in:
@@ -500,7 +500,7 @@ public class SimpleJobTests extends TestCase {
|
||||
stepExecution.getExecutionContext().putString("stepKey", "stepValue");
|
||||
stepExecution.getJobExecution().getExecutionContext().putString("jobKey", "jobValue");
|
||||
jobRepository.save(stepExecution);
|
||||
jobRepository.saveOrUpdateExecutionContext(stepExecution);
|
||||
jobRepository.persistExecutionContext(stepExecution);
|
||||
|
||||
if (exception instanceof RuntimeException) {
|
||||
stepExecution.setExitStatus(ExitStatus.FAILED);
|
||||
|
||||
@@ -102,7 +102,7 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
|
||||
dao.saveJobExecution(exec1);
|
||||
dao.saveJobExecution(exec2);
|
||||
dao.saveOrUpdateExecutionContext(exec2);
|
||||
dao.persistExecutionContext(exec2);
|
||||
|
||||
JobExecution last = dao.getLastJobExecution(jobInstance);
|
||||
assertEquals(exec2, last);
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
}
|
||||
});
|
||||
execution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(execution);
|
||||
dao.persistExecutionContext(execution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(execution);
|
||||
assertEquals(ctx, retrieved);
|
||||
@@ -127,7 +127,7 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
dao.saveJobExecution(execution);
|
||||
ExecutionContext ctx = new ExecutionContext();
|
||||
execution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(execution);
|
||||
dao.persistExecutionContext(execution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(execution);
|
||||
assertEquals(ctx, retrieved);
|
||||
@@ -141,10 +141,10 @@ public abstract class AbstractJobExecutionDaoTests extends AbstractTransactional
|
||||
}
|
||||
});
|
||||
execution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(execution);
|
||||
dao.persistExecutionContext(execution);
|
||||
|
||||
ctx.putLong("longKey", 7);
|
||||
dao.saveOrUpdateExecutionContext(execution);
|
||||
dao.persistExecutionContext(execution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(execution);
|
||||
assertEquals(ctx, retrieved);
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
|
||||
public void testUpdateStepWithExecutionContext() {
|
||||
stepExecution.setExecutionContext(executionContext);
|
||||
stepExecutionDao.saveOrUpdateExecutionContext(stepExecution);
|
||||
stepExecutionDao.persistExecutionContext(stepExecution);
|
||||
ExecutionContext tempAttributes = stepExecutionDao.findExecutionContext(stepExecution);
|
||||
assertEquals(executionContext, tempAttributes);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
execution.setExecutionContext(executionContext);
|
||||
execution.setExitStatus(ExitStatus.FAILED.addExitDescription("java.lang.Exception"));
|
||||
stepExecutionDao.saveStepExecution(execution);
|
||||
stepExecutionDao.saveOrUpdateExecutionContext(execution);
|
||||
stepExecutionDao.persistExecutionContext(execution);
|
||||
StepExecution retrievedExecution = stepExecutionDao.getStepExecution(jobExecution, step2);
|
||||
assertNotNull(retrievedExecution);
|
||||
assertEquals(execution, retrievedExecution);
|
||||
@@ -202,14 +202,14 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
public void testSaveExecutionContext(){
|
||||
|
||||
stepExecution.setExecutionContext(executionContext);
|
||||
stepExecutionDao.saveOrUpdateExecutionContext(stepExecution);
|
||||
stepExecutionDao.persistExecutionContext(stepExecution);
|
||||
ExecutionContext attributes = stepExecutionDao.findExecutionContext(stepExecution);
|
||||
assertEquals(executionContext, attributes);
|
||||
executionContext.putString("newString", "newString");
|
||||
executionContext.putLong("newLong", 1);
|
||||
executionContext.putDouble("newDouble", 2.5);
|
||||
executionContext.put("newSerializable", "serializableValue");
|
||||
stepExecutionDao.saveOrUpdateExecutionContext(stepExecution);
|
||||
stepExecutionDao.persistExecutionContext(stepExecution);
|
||||
attributes = stepExecutionDao.findExecutionContext(stepExecution);
|
||||
assertEquals(executionContext, attributes);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
|
||||
}
|
||||
});
|
||||
stepExecution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(stepExecution);
|
||||
dao.persistExecutionContext(stepExecution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(stepExecution);
|
||||
assertEquals(ctx, retrieved);
|
||||
@@ -166,7 +166,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
|
||||
dao.saveStepExecution(stepExecution);
|
||||
ExecutionContext ctx = new ExecutionContext();
|
||||
stepExecution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(stepExecution);
|
||||
dao.persistExecutionContext(stepExecution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(stepExecution);
|
||||
assertEquals(ctx, retrieved);
|
||||
@@ -180,10 +180,10 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
|
||||
}
|
||||
});
|
||||
stepExecution.setExecutionContext(ctx);
|
||||
dao.saveOrUpdateExecutionContext(stepExecution);
|
||||
dao.persistExecutionContext(stepExecution);
|
||||
|
||||
ctx.putLong("longKey", 7);
|
||||
dao.saveOrUpdateExecutionContext(stepExecution);
|
||||
dao.persistExecutionContext(stepExecution);
|
||||
|
||||
ExecutionContext retrieved = dao.findExecutionContext(stepExecution);
|
||||
assertEquals(ctx, retrieved);
|
||||
@@ -225,7 +225,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
|
||||
ExecutionContext ec = new ExecutionContext();
|
||||
ec.put("intValue", new Integer(343232));
|
||||
stepExecution.setExecutionContext(ec);
|
||||
dao.saveOrUpdateExecutionContext(stepExecution);
|
||||
dao.persistExecutionContext(stepExecution);
|
||||
ExecutionContext restoredEc = dao.findExecutionContext(stepExecution);
|
||||
assertEquals(ec, restoredEc);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MockStepDao implements StepExecutionDao {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public StepExecution getStepExecution(JobExecution jobExecution, Step step) {
|
||||
|
||||
@@ -154,7 +154,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
|
||||
stepExec.setExecutionContext(ctx);
|
||||
|
||||
jobRepository.save(stepExec);
|
||||
jobRepository.saveOrUpdateExecutionContext(stepExec);
|
||||
jobRepository.persistExecutionContext(stepExec);
|
||||
|
||||
StepExecution retrievedStepExec = jobRepository.getLastStepExecution(jobExec.getJobInstance(), step);
|
||||
assertEquals(stepExec, retrievedStepExec);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class AbstractStepTests extends TestCase {
|
||||
|
||||
ExecutionContext saved = new ExecutionContext();
|
||||
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
saved = stepExecution.getExecutionContext();
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class AbstractStepTests extends TestCase {
|
||||
}
|
||||
};
|
||||
repository = new JobRepositoryStub() {
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
throw new RuntimeException("Bad context!");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JobRepositorySupport implements JobRepository {
|
||||
public void update(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -265,7 +265,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 saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
list.add(stepExecution);
|
||||
}
|
||||
});
|
||||
@@ -284,7 +284,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
private int counter = 0;
|
||||
|
||||
// initial save before item processing succeeds, later calls fail
|
||||
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(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 saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(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 saveOrUpdateExecutionContext(StepExecution stepExecution) {
|
||||
public void persistExecutionContext(StepExecution stepExecution) {
|
||||
throw new RuntimeException("foo");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user