Remove public setters for queries
This commit is contained in:
@@ -32,7 +32,7 @@ import org.springframework.batch.execution.runtime.DefaultJobIdentifier;
|
||||
import org.springframework.batch.execution.runtime.ScheduledJobIdentifier;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -51,7 +51,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SqlJobDao implements JobDao, InitializingBean {
|
||||
|
||||
|
||||
private static final String CHECK_JOB_EXECUTION_EXISTS = "SELECT COUNT(*) FROM %PREFIX%JOB_EXECUTION WHERE ID=?";
|
||||
|
||||
// Job SQL statements
|
||||
@@ -82,26 +82,14 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
private static final String UPDATE_JOB_EXECUTION = "UPDATE %PREFIX%JOB_EXECUTION set START_TIME = ?, END_TIME = ?, "
|
||||
+ " STATUS = ?, CONTINUABLE = ?, EXIT_CODE = ?, EXIT_MESSAGE = ? where ID = ?";
|
||||
|
||||
private String checkJobExecutionExistsQuery;
|
||||
|
||||
private String findJobsQuery;
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private String jobExecutionCountQuery;
|
||||
private JdbcOperations jdbcTemplate;
|
||||
|
||||
private DataFieldMaxValueIncrementer jobExecutionIncrementer;
|
||||
|
||||
private DataFieldMaxValueIncrementer jobIncrementer;
|
||||
|
||||
private String saveJobExecutionQuery;
|
||||
|
||||
private String tablePrefix = DEFAULT_TABLE_PREFIX;
|
||||
|
||||
private String updateJobExecutionQuery;
|
||||
|
||||
private String updateJobQuery;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -183,21 +171,15 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
return jdbcTemplate.query(getFindJobsQuery(), parameters, rowMapper);
|
||||
}
|
||||
|
||||
public String getCheckJobExecutionExistsQuery() {
|
||||
if (checkJobExecutionExistsQuery != null) {
|
||||
return checkJobExecutionExistsQuery;
|
||||
}
|
||||
private String getCheckJobExecutionExistsQuery() {
|
||||
return getQuery(CHECK_JOB_EXECUTION_EXISTS);
|
||||
}
|
||||
|
||||
public String getCreateJobQuery() {
|
||||
private String getCreateJobQuery() {
|
||||
return getQuery(CREATE_JOB);
|
||||
}
|
||||
|
||||
public String getFindJobsQuery() {
|
||||
if (findJobsQuery != null) {
|
||||
return findJobsQuery;
|
||||
}
|
||||
private String getFindJobsQuery() {
|
||||
return getQuery(FIND_JOBS);
|
||||
}
|
||||
|
||||
@@ -216,10 +198,7 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
.queryForInt(getJobExecutionCountQuery(), parameters);
|
||||
}
|
||||
|
||||
public String getJobExecutionCountQuery() {
|
||||
if (jobExecutionCountQuery != null) {
|
||||
return jobExecutionCountQuery;
|
||||
}
|
||||
private String getJobExecutionCountQuery() {
|
||||
return getQuery(GET_JOB_EXECUTION_COUNT);
|
||||
}
|
||||
|
||||
@@ -227,10 +206,7 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
return StringUtils.replace(base, "%PREFIX%", tablePrefix);
|
||||
}
|
||||
|
||||
public String getSaveJobExecutionQuery() {
|
||||
if (saveJobExecutionQuery != null) {
|
||||
return saveJobExecutionQuery;
|
||||
}
|
||||
private String getSaveJobExecutionQuery() {
|
||||
return getQuery(SAVE_JOB_EXECUTION);
|
||||
}
|
||||
|
||||
@@ -254,17 +230,11 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
return new ScheduledJobIdentifier(jobIdentifier.getName());
|
||||
}
|
||||
|
||||
public String getUpdateJobExecutionQuery() {
|
||||
if (updateJobExecutionQuery != null) {
|
||||
return updateJobExecutionQuery;
|
||||
}
|
||||
private String getUpdateJobExecutionQuery() {
|
||||
return getQuery(UPDATE_JOB_EXECUTION);
|
||||
}
|
||||
|
||||
public String getUpdateJobQuery() {
|
||||
if (updateJobQuery != null) {
|
||||
return updateJobQuery;
|
||||
}
|
||||
private String getUpdateJobQuery() {
|
||||
return getQuery(UPDATE_JOB);
|
||||
}
|
||||
|
||||
@@ -295,55 +265,33 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
Types.VARCHAR, Types.CHAR, Types.VARCHAR, Types.VARCHAR });
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the checkJobExecutionExistsQuery property.
|
||||
*
|
||||
* @param checkJobExecutionExistsQuery the checkJobExecutionExistsQuery to set
|
||||
*/
|
||||
public void setCheckJobExecutionExistsQuery(String checkJobExecutionExistsQuery) {
|
||||
this.checkJobExecutionExistsQuery = checkJobExecutionExistsQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the findJobsQuery property.
|
||||
*
|
||||
* @param findJobsQuery the findJobsQuery to set
|
||||
*/
|
||||
public void setFindJobsQuery(String findJobsQuery) {
|
||||
this.findJobsQuery = findJobsQuery;
|
||||
}
|
||||
|
||||
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
|
||||
public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the jobExecutionCountQuery property.
|
||||
*
|
||||
* @param jobExecutionCountQuery the jobExecutionCountQuery to set
|
||||
* Setter for {@link DataFieldMaxValueIncrementer} to be used when
|
||||
* generating primary keys for {@link JobExecution} instances.
|
||||
*
|
||||
* @param jobExecutionIncrementer
|
||||
* the {@link DataFieldMaxValueIncrementer}
|
||||
*/
|
||||
public void setJobExecutionCountQuery(String jobExecutionCountQuery) {
|
||||
this.jobExecutionCountQuery = jobExecutionCountQuery;
|
||||
}
|
||||
|
||||
public void setJobExecutionIncrementer(
|
||||
DataFieldMaxValueIncrementer jobExecutionIncrementer) {
|
||||
this.jobExecutionIncrementer = jobExecutionIncrementer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for {@link DataFieldMaxValueIncrementer} to be used when
|
||||
* generating primary keys for {@link JobInstance} instances.
|
||||
*
|
||||
* @param jobIncrementer
|
||||
* the {@link DataFieldMaxValueIncrementer}
|
||||
*/
|
||||
public void setJobIncrementer(DataFieldMaxValueIncrementer jobIncrementer) {
|
||||
this.jobIncrementer = jobIncrementer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the saveJobExecutionQuery property.
|
||||
*
|
||||
* @param saveJobExecutionQuery the saveJobExecutionQuery to set
|
||||
*/
|
||||
public void setSaveJobExecutionQuery(String saveJobExecutionQuery) {
|
||||
this.saveJobExecutionQuery = saveJobExecutionQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the table prefix property. This will be prefixed to all
|
||||
* the table names before queries are executed. Defaults to
|
||||
@@ -356,24 +304,6 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
this.tablePrefix = tablePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the updateJobExecutionQuery property.
|
||||
*
|
||||
* @param updateJobExecutionQuery the updateJobExecutionQuery to set
|
||||
*/
|
||||
public void setUpdateJobExecutionQuery(String updateJobExecutionQuery) {
|
||||
this.updateJobExecutionQuery = updateJobExecutionQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the updateJobQuery property.
|
||||
*
|
||||
* @param updateJobQuery the updateJobQuery to set
|
||||
*/
|
||||
public void setUpdateJobQuery(String updateJobQuery) {
|
||||
this.updateJobQuery = updateJobQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update given JobExecution using a SQL UPDATE statement. The JobExecution
|
||||
* is first checked to ensure all fields are not null, and that it has an
|
||||
@@ -386,16 +316,19 @@ public class SqlJobDao implements JobDao, InitializingBean {
|
||||
|
||||
validateJobExecution(jobExecution);
|
||||
|
||||
String exitDescription = jobExecution.getExitStatus().getExitDescription();
|
||||
if (exitDescription!=null && exitDescription.length()>EXIT_MESSAGE_LENGTH) {
|
||||
String exitDescription = jobExecution.getExitStatus()
|
||||
.getExitDescription();
|
||||
if (exitDescription != null
|
||||
&& exitDescription.length() > EXIT_MESSAGE_LENGTH) {
|
||||
exitDescription = exitDescription.substring(0, EXIT_MESSAGE_LENGTH);
|
||||
logger.debug("Truncating long message before update of JobExecution: "+jobExecution);
|
||||
logger
|
||||
.debug("Truncating long message before update of JobExecution: "
|
||||
+ jobExecution);
|
||||
}
|
||||
Object[] parameters = new Object[] { jobExecution.getStartTime(),
|
||||
jobExecution.getEndTime(), jobExecution.getStatus().toString(),
|
||||
jobExecution.getExitStatus().isContinuable() ? "Y" : "N",
|
||||
jobExecution.getExitStatus().getExitCode(),
|
||||
exitDescription,
|
||||
jobExecution.getExitStatus().getExitCode(), exitDescription,
|
||||
jobExecution.getId() };
|
||||
|
||||
if (jobExecution.getId() == null) {
|
||||
|
||||
@@ -91,32 +91,16 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
+ "STATUS = ?, COMMIT_COUNT = ?, TASK_COUNT = ?, TASK_STATISTICS = ?, CONTINUABLE = ? , EXIT_CODE = ?, "
|
||||
+ "EXIT_MESSAGE = ? where ID = ?";
|
||||
|
||||
private String createStepQuery;
|
||||
|
||||
private String findStepExecutionsQuery;
|
||||
|
||||
private String findStepQuery;
|
||||
|
||||
private String findStepsQuery;
|
||||
|
||||
private JdbcOperations jdbcTemplate;
|
||||
|
||||
private JobDao jobDao;
|
||||
|
||||
private String saveStepExecutionQuery;
|
||||
|
||||
private String stepExecutionCountQuery;
|
||||
|
||||
private DataFieldMaxValueIncrementer stepExecutionIncrementer;
|
||||
|
||||
private DataFieldMaxValueIncrementer stepIncrementer;
|
||||
|
||||
private String tablePrefix = SqlJobDao.DEFAULT_TABLE_PREFIX;
|
||||
|
||||
private String updateStepExecutionQuery;
|
||||
|
||||
private String updateStepQuery;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "JdbcTemplate cannot be null.");
|
||||
Assert.notNull(stepIncrementer, "StepIncrementer cannot be null.");
|
||||
@@ -281,31 +265,19 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
return jdbcTemplate.query(getFindStepsQuery(), parameters, rowMapper);
|
||||
}
|
||||
|
||||
public String getCreateStepQuery() {
|
||||
if (createStepQuery != null) {
|
||||
return createStepQuery;
|
||||
}
|
||||
private String getCreateStepQuery() {
|
||||
return getQuery(CREATE_STEP);
|
||||
}
|
||||
|
||||
public String getFindStepExecutionsQuery() {
|
||||
if (findStepExecutionsQuery != null) {
|
||||
return findStepExecutionsQuery;
|
||||
}
|
||||
private String getFindStepExecutionsQuery() {
|
||||
return getQuery(FIND_STEP_EXECUTIONS);
|
||||
}
|
||||
|
||||
public String getFindStepQuery() {
|
||||
if (findStepQuery != null) {
|
||||
return findStepQuery;
|
||||
}
|
||||
private String getFindStepQuery() {
|
||||
return getQuery(FIND_STEP);
|
||||
}
|
||||
|
||||
public String getFindStepsQuery() {
|
||||
if (findStepsQuery != null) {
|
||||
return findStepsQuery;
|
||||
}
|
||||
private String getFindStepsQuery() {
|
||||
return getQuery(FIND_STEPS);
|
||||
}
|
||||
|
||||
@@ -313,10 +285,7 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
return StringUtils.replace(base, "%PREFIX%", tablePrefix);
|
||||
}
|
||||
|
||||
public String getSaveStepExecutionQuery() {
|
||||
if (saveStepExecutionQuery != null) {
|
||||
return saveStepExecutionQuery;
|
||||
}
|
||||
private String getSaveStepExecutionQuery() {
|
||||
return getQuery(SAVE_STEP_EXECUTION);
|
||||
}
|
||||
|
||||
@@ -328,24 +297,15 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
parameters);
|
||||
}
|
||||
|
||||
public String getStepExecutionCountQuery() {
|
||||
if (stepExecutionCountQuery != null) {
|
||||
return stepExecutionCountQuery;
|
||||
}
|
||||
private String getStepExecutionCountQuery() {
|
||||
return getQuery(GET_STEP_EXECUTION_COUNT);
|
||||
}
|
||||
|
||||
public String getUpdateStepExecutionQuery() {
|
||||
if (updateStepExecutionQuery != null) {
|
||||
return updateStepExecutionQuery;
|
||||
}
|
||||
private String getUpdateStepExecutionQuery() {
|
||||
return getQuery(UPDATE_STEP_EXECUTION);
|
||||
}
|
||||
|
||||
public String getUpdateStepQuery() {
|
||||
if (updateStepQuery != null) {
|
||||
return updateStepQuery;
|
||||
}
|
||||
private String getUpdateStepQuery() {
|
||||
return getQuery(UPDATE_STEP);
|
||||
}
|
||||
|
||||
@@ -386,46 +346,6 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the createStepQuery property.
|
||||
*
|
||||
* @param createStepQuery
|
||||
* the createStepQuery to set
|
||||
*/
|
||||
public void setCreateStepQuery(String createStepQuery) {
|
||||
this.createStepQuery = createStepQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the findStepExecutionsQuery property.
|
||||
*
|
||||
* @param findStepExecutionsQuery
|
||||
* the findStepExecutionsQuery to set
|
||||
*/
|
||||
public void setFindStepExecutionsQuery(String findStepExecutionsQuery) {
|
||||
this.findStepExecutionsQuery = findStepExecutionsQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the findStepQuery property.
|
||||
*
|
||||
* @param findStepQuery
|
||||
* the findStepQuery to set
|
||||
*/
|
||||
public void setFindStepQuery(String findStepQuery) {
|
||||
this.findStepQuery = findStepQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the findStepQuery property.
|
||||
*
|
||||
* @param findStepsQuery
|
||||
* the findStepsQuery to set
|
||||
*/
|
||||
public void setFindStepsQuery(String findStepsQuery) {
|
||||
this.findStepsQuery = findStepsQuery;
|
||||
}
|
||||
|
||||
public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
@@ -441,26 +361,6 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
this.jobDao = jobDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the findStepQuery property.
|
||||
*
|
||||
* @param saveStepExecutionQuery
|
||||
* the saveStepExecutionQuery to set
|
||||
*/
|
||||
public void setSaveStepExecutionQuery(String saveStepExecutionQuery) {
|
||||
this.saveStepExecutionQuery = saveStepExecutionQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the stepExecutionCountQuery property.
|
||||
*
|
||||
* @param stepExecutionCountQuery
|
||||
* the stepExecutionCountQuery to set
|
||||
*/
|
||||
public void setStepExecutionCountQuery(String stepExecutionCountQuery) {
|
||||
this.stepExecutionCountQuery = stepExecutionCountQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link DataFieldMaxValueIncrementer} that will be used to
|
||||
* increment the primary keys used for {@link StepExecution} instances.
|
||||
@@ -495,26 +395,6 @@ public class SqlStepDao implements StepDao, InitializingBean {
|
||||
this.tablePrefix = tablePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the {@link String} property.
|
||||
*
|
||||
* @param updateStepExecutionQuery
|
||||
* the updateStepExecutionQuery to set
|
||||
*/
|
||||
public void setUpdateStepExecutionQuery(String updateStepExecutionQuery) {
|
||||
this.updateStepExecutionQuery = updateStepExecutionQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the {@link String} property.
|
||||
*
|
||||
* @param updateStepQuery
|
||||
* the updateStepQuery to set
|
||||
*/
|
||||
public void setUpdateStepQuery(String updateStepQuery) {
|
||||
this.updateStepQuery = updateStepQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see StepDao#update(StepExecution)
|
||||
*/
|
||||
|
||||
@@ -15,8 +15,17 @@
|
||||
*/
|
||||
package org.springframework.batch.execution.repository.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -24,52 +33,43 @@ import junit.framework.TestCase;
|
||||
public class SqlJobDaoQueryTests extends TestCase {
|
||||
|
||||
SqlJobDao sqlDao;
|
||||
List list = new ArrayList();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
sqlDao = new SqlJobDao();
|
||||
sqlDao.setJobExecutionIncrementer(new DataFieldMaxValueIncrementer() {
|
||||
|
||||
public int nextIntValue() throws DataAccessException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long nextLongValue() throws DataAccessException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String nextStringValue() throws DataAccessException {
|
||||
return "bar";
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void testTablePrefix() throws Exception {
|
||||
sqlDao.setTablePrefix("FOO_");
|
||||
assertTrue("Query did not contain FOO_:"+sqlDao.getFindJobsQuery(), sqlDao.getFindJobsQuery().indexOf("FOO_")>=0);
|
||||
}
|
||||
|
||||
public void testSetSaveJobExecutionQuery() throws Exception {
|
||||
sqlDao.setSaveJobExecutionQuery("foo");
|
||||
assertEquals("foo", sqlDao.getSaveJobExecutionQuery());
|
||||
}
|
||||
|
||||
public void testSetUpdateJobQuery() throws Exception {
|
||||
sqlDao.setUpdateJobQuery("foo");
|
||||
assertEquals("foo", sqlDao.getUpdateJobQuery());
|
||||
}
|
||||
|
||||
public void testSetFindJobsQuery() throws Exception {
|
||||
sqlDao.setFindJobsQuery("foo");
|
||||
assertEquals("foo", sqlDao.getFindJobsQuery());
|
||||
}
|
||||
|
||||
public void testSetUpdateJobExecutionQuery() throws Exception {
|
||||
sqlDao.setUpdateJobExecutionQuery("foo");
|
||||
assertEquals("foo", sqlDao.getUpdateJobExecutionQuery());
|
||||
}
|
||||
|
||||
public void testSetJobExecutionCountQuery() throws Exception {
|
||||
sqlDao.setJobExecutionCountQuery("foo");
|
||||
assertEquals("foo", sqlDao.getJobExecutionCountQuery());
|
||||
}
|
||||
|
||||
public void testSetCheckJobExecutionExistsQuery() throws Exception {
|
||||
sqlDao.setCheckJobExecutionExistsQuery("foo");
|
||||
assertEquals("foo", sqlDao.getCheckJobExecutionExistsQuery());
|
||||
}
|
||||
|
||||
public void testJobExecutionCountQuery() throws Exception {
|
||||
sqlDao.setJobExecutionCountQuery("foo");
|
||||
assertEquals("foo", sqlDao.getJobExecutionCountQuery());
|
||||
sqlDao.setJdbcTemplate(new JdbcTemplate() {
|
||||
public int update(String sql, Object[] args, int[] argTypes)
|
||||
throws DataAccessException {
|
||||
list.add(sql);
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
sqlDao.save(new JobInstance(new SimpleJobIdentifier("foo"), new Long(11)).createNewJobExecution());
|
||||
assertEquals(1, list.size());
|
||||
String query = (String) list.get(0);
|
||||
assertTrue("Query did not contain FOO_:"+query, query.indexOf("FOO_")>=0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,11 +94,6 @@ public class SqlStepDaoPrefixTests extends TestCase {
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("FOO_STEP") != -1);
|
||||
}
|
||||
|
||||
public void testStepExecutionCountQuery() throws Exception {
|
||||
stepDao.setStepExecutionCountQuery("foo");
|
||||
assertEquals("foo", stepDao.getStepExecutionCountQuery());
|
||||
}
|
||||
|
||||
public void testModifiedFindStep(){
|
||||
stepDao.setTablePrefix("FOO_");
|
||||
try{
|
||||
@@ -125,21 +120,11 @@ public class SqlStepDaoPrefixTests extends TestCase {
|
||||
|
||||
}
|
||||
|
||||
public void testFindStepQuery() throws Exception {
|
||||
stepDao.setFindStepQuery("foo");
|
||||
assertEquals("foo", stepDao.getFindStepQuery());
|
||||
}
|
||||
|
||||
public void testDefaultFindSteps(){
|
||||
stepDao.findSteps(new JobInstance(null, new Long(1)));
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP") != -1);
|
||||
}
|
||||
|
||||
public void testFindStepsQuery() throws Exception {
|
||||
stepDao.setFindStepsQuery("foo");
|
||||
assertEquals("foo", stepDao.getFindStepsQuery());
|
||||
}
|
||||
|
||||
public void testDefaultCreateStep(){
|
||||
stepIncrementer.nextLongValue();
|
||||
stepIncrementerControl.setReturnValue(1);
|
||||
@@ -148,51 +133,27 @@ public class SqlStepDaoPrefixTests extends TestCase {
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP") != -1);
|
||||
}
|
||||
|
||||
public void testCreateStepQuery() throws Exception {
|
||||
stepDao.setCreateStepQuery("foo");
|
||||
assertEquals("foo", stepDao.getCreateStepQuery());
|
||||
}
|
||||
|
||||
public void testDefaultUpdateStep(){
|
||||
stepDao.update(step);
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP") != -1);
|
||||
}
|
||||
|
||||
public void testSetUpdateStepQuery() throws Exception {
|
||||
stepDao.setUpdateStepQuery("foo");
|
||||
assertEquals("foo", stepDao.getUpdateStepQuery());
|
||||
}
|
||||
|
||||
public void testDefaultFindStepExecutions(){
|
||||
stepDao.findStepExecutions(step);
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP_EXECUTION") != -1);
|
||||
}
|
||||
|
||||
public void testSetFindStepExecutionsQuery() throws Exception {
|
||||
stepDao.setFindStepExecutionsQuery("foo");
|
||||
assertEquals("foo", stepDao.getFindStepExecutionsQuery());
|
||||
}
|
||||
|
||||
public void testDefaultSaveStepExecution(){
|
||||
stepExecutionIncrementer.nextLongValue();
|
||||
stepExecutionIncrementerControl.setReturnValue(1);
|
||||
stepExecutionIncrementerControl.replay();
|
||||
stepDao.save(stepExecution);
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP_EXECUTION") != -1);
|
||||
}
|
||||
|
||||
public void testSetSaveStepExecutionQuery() throws Exception {
|
||||
stepDao.setSaveStepExecutionQuery("foo");
|
||||
assertEquals("foo", stepDao.getSaveStepExecutionQuery());
|
||||
}
|
||||
}
|
||||
|
||||
public void testDefaultUpdateStepExecution(){
|
||||
stepDao.update(stepExecution);
|
||||
assertTrue(jdbcTemplate.getSqlStatement().indexOf("BATCH_STEP_EXECUTION") != -1);
|
||||
}
|
||||
|
||||
public void testSetUpdateStepExecutionQuery() throws Exception {
|
||||
stepDao.setUpdateStepExecutionQuery("foo");
|
||||
assertEquals("foo", stepDao.getUpdateStepExecutionQuery());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user