RESOLVED - issue BATCH-745: strong typing in AggregateItemReader

Added AggregateItem<T>
This commit is contained in:
dsyer
2008-07-28 15:42:35 +00:00
parent 04c9e16b1b
commit 4b6f350a47
12 changed files with 385 additions and 75 deletions

View File

@@ -52,7 +52,6 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
/*
* (non-Javadoc)
* @see org.springframework.test.AbstractSingleSpringContextTests#onTearDown()
@@ -76,7 +75,7 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests {
int before = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM TRADE");
try {
runJob();
runJobForRestartTest();
fail("First run of the job is expected to fail.");
}
catch (UnexpectedJobExecutionException expected) {
@@ -89,7 +88,7 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests {
// assert based on commit interval = 2
assertEquals(before + 2, medium);
runJob();
runJobForRestartTest();
int after = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM TRADE");
@@ -97,9 +96,11 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests {
}
// load the application context and launch the job
private void runJob() throws Exception {
private void runJobForRestartTest() throws Exception {
// The second time we run the job it needs to be a new instance so we
// need to make the parameters unique...
launcher.run(getJob(), new DefaultJobParametersConverter().getJobParameters(PropertiesConverter
.stringToProperties("restart=true")));
.stringToProperties("force.new.job.parameters=true")));
}
}

View File

@@ -1,16 +1,11 @@
package org.springframework.batch.sample.domain.trade.internal;
import static org.junit.Assert.assertEquals;
import java.math.BigDecimal;
import org.junit.Test;
import org.springframework.batch.item.file.mapping.DefaultFieldSet;
import org.springframework.batch.item.file.mapping.FieldSet;
import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.support.AggregateItemReader;
import org.springframework.batch.sample.domain.trade.Trade;
import org.springframework.batch.sample.domain.trade.internal.TradeFieldSetMapper;
import org.springframework.batch.sample.support.AbstractFieldSetMapperTests;
public class TradeFieldSetMapperTests extends AbstractFieldSetMapperTests {
@@ -48,16 +43,4 @@ public class TradeFieldSetMapperTests extends AbstractFieldSetMapperTests {
return mapper;
}
@Test
public void testBeginRecord() throws Exception {
assertEquals(AggregateItemReader.BEGIN_RECORD, fieldSetMapper().mapLine(
new DefaultFieldSet(new String[] { "BEGIN" }), -1));
}
@Test
public void testEndRecord() throws Exception {
assertEquals(AggregateItemReader.END_RECORD, fieldSetMapper().mapLine(
new DefaultFieldSet(new String[] { "END" }), -1));
}
}