OPEN - issue BATCH-364: StepScope responsibilities can be assumed by Step (not ApplicationContext)
http://jira.springframework.org/browse/BATCH-364 Instead of lazy open, throw exception is stream is used before open().
This commit is contained in:
@@ -14,6 +14,7 @@ import org.springframework.batch.execution.scope.StepContextAware;
|
||||
import org.springframework.batch.item.ExecutionAttributes;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.item.KeyedItemReader;
|
||||
import org.springframework.batch.item.exception.StreamException;
|
||||
import org.springframework.batch.sample.item.writer.StagingItemWriter;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -127,7 +128,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
|
||||
|
||||
private Long doRead() {
|
||||
if (!initialized) {
|
||||
open();
|
||||
throw new StreamException("ItemStream must be open before it can be read.");
|
||||
}
|
||||
|
||||
Long key = getBuffer().next();
|
||||
|
||||
@@ -29,9 +29,7 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
* Abstract unit test for running functional tests by getting context locations
|
||||
* for both the container and configuration separately and having them auto
|
||||
* wired in by type. This allows the two to be completely separated, and remove
|
||||
* any 'configuration coupling' between the two. However, it is still purely
|
||||
* theoretical until a decision is made as to how job configuration and
|
||||
* container configuration files are pulled together.
|
||||
* any 'configuration coupling' between the two.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
|
||||
@@ -60,6 +60,8 @@ public class FixedLengthImportJobFunctionalTests extends AbstractValidatingBatch
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void validatePostConditions() throws Exception {
|
||||
|
||||
inputSource.open();
|
||||
|
||||
jdbcTemplate.query("SELECT ID, ISIN, QUANTITY, PRICE, CUSTOMER FROM trade ORDER BY id", new RowCallbackHandler() {
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class StagingItemReaderTests extends AbstractTransactionalDataSourceSprin
|
||||
writer.write("BAR");
|
||||
writer.write("SPAM");
|
||||
writer.write("BUCKET");
|
||||
provider.open();
|
||||
}
|
||||
|
||||
protected void onTearDownAfterTransaction() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user