IN PROGRESS - issue BATCH-422: Provide ability to specify exception types as well as skip limit in DefaultStepFactoryBean

http://jira.springframework.org/browse/BATCH-422

ItemSkipPolicyItemHandler now always rethrows exception - fixed rollbackJob that wasn't really skipping the error item although it was configured to do so.
This commit is contained in:
robokaso
2008-03-12 12:36:39 +00:00
parent 12b238d350
commit 637f2a61f6
3 changed files with 10 additions and 12 deletions

View File

@@ -9,13 +9,12 @@
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<import resource="tradeJobIo.xml" />
<!--import resource="tradeJobAop.xml" /-->
<bean id="tradeJob" parent="simpleJob">
<property name="steps">
<list>
<bean id="step1" parent="skipLimitStep">
<property name="skipLimit" value="5" />
<property name="skipLimit" value="1" />
<property name="streams" ref="fileInputTemplate" />
<property name="itemReader">
<bean

View File

@@ -5,16 +5,17 @@ import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Test for job that rolls back a trade that is processed.
* Error is encountered during writing - transaction is rolled back and the
* error item is skipped on second attempt to process the chunk.
*
* @author Robert Kasanicky
*/
public class RollbackJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
int before = -1;
JdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
}
@@ -25,8 +26,8 @@ public class RollbackJobFunctionalTests extends AbstractValidatingBatchLauncherT
protected void validatePostConditions() throws Exception {
int after = jdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
assertEquals(before+5, after);
// 5 input records, 1 skipped => 4 written to output
assertEquals(before + 4, after);
}
}