* renamed PIECE_COUNT to READ_COUNT in AbstractBufferedItemReaderItemStream

* taskletJob now uses "java -version" as platform neutral successful command
This commit is contained in:
robokaso
2008-07-01 08:16:45 +00:00
parent e72825d761
commit cf37f2e31f
4 changed files with 9 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ import org.springframework.util.Assert;
*/
public abstract class AbstractBufferedItemReaderItemStream implements ItemReader, ItemStream {
private static final String PIECE_COUNT = "piece.count";
private static final String READ_COUNT = "read.count";
private int currentItemCount = 0;
@@ -145,8 +145,8 @@ public abstract class AbstractBufferedItemReaderItemStream implements ItemReader
throw new ItemStreamException("Failed to initialize the reader", e);
}
if (executionContext.containsKey(ecSupport.getKey(PIECE_COUNT))) {
int itemCount = new Long(executionContext.getLong(ecSupport.getKey(PIECE_COUNT))).intValue();
if (executionContext.containsKey(ecSupport.getKey(READ_COUNT))) {
int itemCount = new Long(executionContext.getLong(ecSupport.getKey(READ_COUNT))).intValue();
try {
jumpToItem(itemCount);
@@ -163,7 +163,7 @@ public abstract class AbstractBufferedItemReaderItemStream implements ItemReader
public void update(ExecutionContext executionContext) throws ItemStreamException {
if (saveState) {
Assert.notNull(executionContext, "ExecutionContext must not be null");
executionContext.putLong(ecSupport.getKey(PIECE_COUNT), currentItemCount);
executionContext.putLong(ecSupport.getKey(READ_COUNT), currentItemCount);
}
}

View File

@@ -152,7 +152,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
// get restart data
reader.update(executionContext);
assertEquals(4, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
+ ".piece.count"));
+ ".read.count"));
// close input
reader.close(executionContext);
@@ -167,7 +167,7 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
reader.update(executionContext);
assertEquals(6, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
+ ".piece.count"));
+ ".read.count"));
}
}

View File

@@ -116,7 +116,7 @@ public class StaxEventItemReaderTests extends TestCase {
source.read();
source.update(executionContext);
System.out.println(executionContext);
assertEquals(1, executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + ".piece.count"));
assertEquals(1, executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + ".read.count"));
List expectedAfterRestart = (List) source.read();
source = createNewInputSouce();
@@ -183,7 +183,7 @@ public class StaxEventItemReaderTests extends TestCase {
}
private long extractRecordCount() {
return executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + ".piece.count");
return executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + ".read.count");
}
public void testCloseWithoutOpen() throws Exception {

View File

@@ -34,7 +34,7 @@
<property name="tasklet">
<bean
class="org.springframework.batch.sample.tasklet.SystemCommandTasklet">
<property name="command" value="echo hello" />
<property name="command" value="java -version" />
<!-- 5 second timeout for the command to complete -->
<property name="timeout" value="5000" />
</bean>