RESOLVED - BATCH-396: jdbc and map daos should share tests

This commit is contained in:
robokaso
2008-04-10 14:07:52 +00:00
parent 3e787fb680
commit c7d2a7e8bf
14 changed files with 472 additions and 494 deletions

View File

@@ -110,8 +110,8 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
executionContext.put(key, rs.getObject("OBJECT_VAL"));
}
else {
throw new UnexpectedJobExecutionException("Invalid type found: [" + typeCd + "] for execution id: ["
+ executionId + "]");
throw new UnexpectedJobExecutionException("Invalid type found: [" + typeCd
+ "] for execution id: [" + executionId + "]");
}
}
};
@@ -172,6 +172,11 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
*/
public void saveStepExecution(StepExecution stepExecution) {
Assert.isNull(stepExecution.getId(),
"to-be-saved (not updated) StepExecution can't already have an id assigned");
Assert.isNull(stepExecution.getVersion(),
"to-be-saved (not updated) StepExecution can't already have a version assigned");
validateStepExecution(stepExecution);
stepExecution.setId(new Long(stepExecutionIncrementer.nextLongValue()));
@@ -324,11 +329,11 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
// Avoid concurrent modifications...
if (count == 0) {
int curentVersion = getJdbcTemplate().queryForInt(
getQuery(CURRENT_VERSION_STEP_EXECUTION),
int curentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VERSION_STEP_EXECUTION),
new Object[] { stepExecution.getId() });
throw new OptimisticLockingFailureException("Attempt to update step execution id="
+ stepExecution.getId() + " with wrong version (" + stepExecution.getVersion() + "), where current version is "+curentVersion);
+ stepExecution.getId() + " with wrong version (" + stepExecution.getVersion()
+ "), where current version is " + curentVersion);
}
stepExecution.incrementVersion();