RESOLVED - issue BATCH-446: taskCount in StepExecution should be itemCount

http://jira.springframework.org/browse/BATCH-446
This commit is contained in:
robokaso
2008-03-12 09:27:55 +00:00
parent 0e5f7f11c3
commit bde4cea8a7
14 changed files with 61 additions and 61 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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));

View File

@@ -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
);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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),

View File

@@ -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(),

View File

@@ -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"));

View File

@@ -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());
}

View File

@@ -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),

View File

@@ -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),