diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java index 2ab2202bd..e320df0dc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/StepExecution.java @@ -42,7 +42,7 @@ public class StepExecution extends Entity { private BatchStatus status = BatchStatus.STARTING; - private int taskCount = 0; + private int itemCount = 0; private int commitCount = 0; @@ -104,7 +104,7 @@ public class StepExecution extends Entity { * Increments the number of tasks in this execution */ public void incrementTaskCount() { - taskCount++; + itemCount++; } /** @@ -166,17 +166,17 @@ public class StepExecution extends Entity { * * @return the current number of tasks for this execution */ - public Integer getTaskCount() { - return new Integer(taskCount); + public Integer getItemCount() { + return new Integer(itemCount); } /** * Sets the current number of tasks for this execution * - * @param taskCount the current number of tasks for this execution + * @param itemCount the current number of tasks for this execution */ - public void setTaskCount(int taskCount) { - this.taskCount = taskCount; + public void setItemCount(int itemCount) { + this.itemCount = itemCount; } /** @@ -283,7 +283,7 @@ public class StepExecution extends Entity { } public String toString() { - return super.toString() + ", name=" + step.getName() + ", taskCount=" + taskCount + ", commitCount=" + return super.toString() + ", name=" + step.getName() + ", itemCount=" + itemCount + ", commitCount=" + commitCount + ", rollbackCount=" + rollbackCount; } @@ -328,7 +328,7 @@ public class StepExecution extends Entity { * @param contribution */ public synchronized void apply(StepContribution contribution) { - taskCount += contribution.getTaskCount(); + itemCount += contribution.getTaskCount(); // TODO: this should not be necessary - the step decides // executionContext = contribution.getExecutionContext(); commitCount += contribution.getCommitCount(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java index b1e7725a9..3bfc4db73 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java @@ -62,18 +62,18 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement + " KEY_NAME, STRING_VAL, DOUBLE_VAL, LONG_VAL, OBJECT_VAL) values(?,?,?,?,?,?,?)"; private static final String SAVE_STEP_EXECUTION = "INSERT into %PREFIX%STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, " - + "END_TIME, STATUS, COMMIT_COUNT, TASK_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE) " + + "END_TIME, STATUS, COMMIT_COUNT, ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE) " + "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; private static final String UPDATE_STEP_EXECUTION_CONTEXT = "UPDATE %PREFIX%STEP_EXECUTION_CONTEXT set " + "TYPE_CD = ?, STRING_VAL = ?, DOUBLE_VAL = ?, LONG_VAL = ?, OBJECT_VAL = ? where STEP_EXECUTION_ID = ? and KEY_NAME = ?"; private static final String UPDATE_STEP_EXECUTION = "UPDATE %PREFIX%STEP_EXECUTION set START_TIME = ?, END_TIME = ?, " - + "STATUS = ?, COMMIT_COUNT = ?, TASK_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, " + + "STATUS = ?, COMMIT_COUNT = ?, ITEM_COUNT = ?, CONTINUABLE = ? , EXIT_CODE = ?, " + "EXIT_MESSAGE = ?, VERSION = ? where STEP_EXECUTION_ID = ? and VERSION = ?"; private static final String GET_STEP_EXECUTION = "SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT," - + " TASK_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%STEP_EXECUTION where STEP_NAME = ? and JOB_EXECUTION_ID = ?"; + + " ITEM_COUNT, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%STEP_EXECUTION where STEP_NAME = ? and JOB_EXECUTION_ID = ?"; private static final String CURRENT_VERSION_STEP_EXECUTION = "SELECT VERSION FROM %PREFIX%STEP_EXECUTION WHERE STEP_EXECUTION_ID=?"; @@ -179,7 +179,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement Object[] parameters = new Object[] { stepExecution.getId(), stepExecution.getVersion(), stepExecution.getStepName(), stepExecution.getJobExecutionId(), stepExecution.getStartTime(), stepExecution.getEndTime(), stepExecution.getStatus().toString(), stepExecution.getCommitCount(), - stepExecution.getTaskCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N", + stepExecution.getItemCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N", stepExecution.getExitStatus().getExitCode(), stepExecution.getExitStatus().getExitDescription() }; getJdbcTemplate().update( getQuery(SAVE_STEP_EXECUTION), @@ -312,7 +312,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement Integer version = new Integer(stepExecution.getVersion().intValue() + 1); Object[] parameters = new Object[] { stepExecution.getStartTime(), stepExecution.getEndTime(), - stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getTaskCount(), + stepExecution.getStatus().toString(), stepExecution.getCommitCount(), stepExecution.getItemCount(), stepExecution.getExitStatus().isContinuable() ? "Y" : "N", stepExecution.getExitStatus().getExitCode(), exitDescription, version, stepExecution.getId(), stepExecution.getVersion() }; @@ -354,7 +354,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement stepExecution.setEndTime(rs.getTimestamp(4)); stepExecution.setStatus(BatchStatus.getStatus(rs.getString(5))); stepExecution.setCommitCount(rs.getInt(6)); - stepExecution.setTaskCount(rs.getInt(7)); + stepExecution.setItemCount(rs.getInt(7)); stepExecution.setExitStatus(new ExitStatus("Y".equals(rs.getString(8)), rs.getString(9), rs.getString(10))); stepExecution.setExecutionContext(findExecutionContext(stepExecution)); return stepExecution; diff --git a/spring-batch-core/src/main/resources/schema-db2.sql b/spring-batch-core/src/main/resources/schema-db2.sql index 410efb4bc..b14042528 100644 --- a/spring-batch-core/src/main/resources/schema-db2.sql +++ b/spring-batch-core/src/main/resources/schema-db2.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,6 +73,6 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_SEQ; +CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_SEQ; diff --git a/spring-batch-core/src/main/resources/schema-derby.sql b/spring-batch-core/src/main/resources/schema-derby.sql index 36791e613..1e4e148ed 100644 --- a/spring-batch-core/src/main/resources/schema-derby.sql +++ b/spring-batch-core/src/main/resources/schema-derby.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,6 +73,6 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); -CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); -CREATE TABLE BATCH_JOB_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); +CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); +CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); +CREATE TABLE BATCH_JOB_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, DUMMY VARCHAR(1)); diff --git a/spring-batch-core/src/main/resources/schema-hsqldb.sql b/spring-batch-core/src/main/resources/schema-hsqldb.sql index a48874e7b..02065ded1 100644 --- a/spring-batch-core/src/main/resources/schema-hsqldb.sql +++ b/spring-batch-core/src/main/resources/schema-hsqldb.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,12 +73,12 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_SEQ ( - ID BIGINT IDENTITY -); +CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( + ID BIGINT IDENTITY +); +CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( + ID BIGINT IDENTITY +); +CREATE TABLE BATCH_JOB_SEQ ( + ID BIGINT IDENTITY +); diff --git a/spring-batch-core/src/main/resources/schema-mysql.sql b/spring-batch-core/src/main/resources/schema-mysql.sql index ffc3b02a7..20b73f58c 100644 --- a/spring-batch-core/src/main/resources/schema-mysql.sql +++ b/spring-batch-core/src/main/resources/schema-mysql.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,9 +73,9 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT NOT NULL) type=MYISAM; -INSERT INTO BATCH_STEP_EXECUTION_SEQ values(0); -CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT NOT NULL) type=MYISAM; -INSERT INTO BATCH_JOB_EXECUTION_SEQ values(0); -CREATE TABLE BATCH_JOB_SEQ (ID BIGINT NOT NULL) type=MYISAM; -INSERT INTO BATCH_JOB_SEQ values(0); +CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT NOT NULL) type=MYISAM; +INSERT INTO BATCH_STEP_EXECUTION_SEQ values(0); +CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT NOT NULL) type=MYISAM; +INSERT INTO BATCH_JOB_EXECUTION_SEQ values(0); +CREATE TABLE BATCH_JOB_SEQ (ID BIGINT NOT NULL) type=MYISAM; +INSERT INTO BATCH_JOB_SEQ values(0); diff --git a/spring-batch-core/src/main/resources/schema-oracle10g.sql b/spring-batch-core/src/main/resources/schema-oracle10g.sql index 9c2d7dc8d..961ed245b 100644 --- a/spring-batch-core/src/main/resources/schema-oracle10g.sql +++ b/spring-batch-core/src/main/resources/schema-oracle10g.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT NUMBER(38) , - TASK_COUNT NUMBER(38) , + ITEM_COUNT NUMBER(38) , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,6 +73,6 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_SEQ; +CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_SEQ; diff --git a/spring-batch-core/src/main/resources/schema-postgresql.sql b/spring-batch-core/src/main/resources/schema-postgresql.sql index a13cc7e6a..cc30c2817 100644 --- a/spring-batch-core/src/main/resources/schema-postgresql.sql +++ b/spring-batch-core/src/main/resources/schema-postgresql.sql @@ -52,7 +52,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), @@ -73,6 +73,6 @@ CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) ); -CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_SEQ; +CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; +CREATE SEQUENCE BATCH_JOB_SEQ; diff --git a/spring-batch-core/src/main/sql/init.sql.vpp b/spring-batch-core/src/main/sql/init.sql.vpp index 37451de1b..42e17ffff 100644 --- a/spring-batch-core/src/main/sql/init.sql.vpp +++ b/spring-batch-core/src/main/sql/init.sql.vpp @@ -41,7 +41,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT ${BIGINT} , - TASK_COUNT ${BIGINT} , + ITEM_COUNT ${BIGINT} , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/StepExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/StepExecutionTests.java index 661cfbf8b..7568b0702 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/StepExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/StepExecutionTests.java @@ -117,9 +117,9 @@ public class StepExecutionTests extends TestCase { * {@link org.springframework.batch.core.StepExecution#incrementTaskCount()}. */ public void testIncrementLuwCount() { - int before = execution.getTaskCount().intValue(); + int before = execution.getItemCount().intValue(); execution.incrementTaskCount(); - int after = execution.getTaskCount().intValue(); + int after = execution.getItemCount().intValue(); assertEquals(before + 1, after); } @@ -145,11 +145,11 @@ public class StepExecutionTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.core.StepExecution#getTaskCount()}. + * {@link org.springframework.batch.core.StepExecution#getItemCount()}. */ public void testGetTaskCount() { - execution.setTaskCount(123); - assertEquals(123, execution.getTaskCount().intValue()); + execution.setItemCount(123); + assertEquals(123, execution.getItemCount().intValue()); } /** @@ -184,8 +184,8 @@ public class StepExecutionTests extends TestCase { } public void testToString() throws Exception { - assertTrue("Should contain task count: " + execution.toString(), - execution.toString().indexOf("task") >= 0); + assertTrue("Should contain item count: " + execution.toString(), + execution.toString().indexOf("item") >= 0); assertTrue("Should contain commit count: " + execution.toString(), execution.toString().indexOf("commit") >= 0); assertTrue("Should contain rollback count: " + execution.toString(), diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java index 41bb56759..9b518504e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java @@ -161,7 +161,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour stepExecution.setStatus(BatchStatus.COMPLETED); stepExecution.setEndTime(new Date(System.currentTimeMillis())); stepExecution.setCommitCount(5); - stepExecution.setTaskCount(5); + stepExecution.setItemCount(5); stepExecution.setExecutionContext(new ExecutionContext()); stepExecution.setExitStatus(new ExitStatus(false, ExitStatusExceptionClassifier.FATAL_EXCEPTION, "java.lang.Exception")); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java index 6595c038c..04abcab7f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java @@ -120,7 +120,7 @@ public class ItemOrientedStepTests extends TestCase { itemOrientedStep.execute(stepExecution); assertEquals(1, processed.size()); - assertEquals(1, stepExecution.getTaskCount().intValue()); + assertEquals(1, stepExecution.getItemCount().intValue()); } public void testChunkExecutor() throws Exception { @@ -137,7 +137,7 @@ public class ItemOrientedStepTests extends TestCase { StepContribution contribution = stepExecution.createStepContribution(); itemOrientedStep.processChunk(contribution); assertEquals(1, processed.size()); - assertEquals(0, stepExecution.getTaskCount().intValue()); + assertEquals(0, stepExecution.getItemCount().intValue()); assertEquals(1, contribution.getTaskCount()); } diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/support/dao/init.sql b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/support/dao/init.sql index ee822b8d7..a05759ae8 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/support/dao/init.sql +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/repository/support/dao/init.sql @@ -41,7 +41,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500), diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql index ee822b8d7..a05759ae8 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql +++ b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql @@ -41,7 +41,7 @@ CREATE TABLE BATCH_STEP_EXECUTION ( END_TIME TIMESTAMP , STATUS VARCHAR(10), COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , + ITEM_COUNT BIGINT , CONTINUABLE CHAR(1), EXIT_CODE VARCHAR(20), EXIT_MESSAGE VARCHAR(2500),