IN PROGRESS - BATCH-712: Upgrade ItemReaders to use Parameterized types

This commit is contained in:
robokaso
2008-07-18 12:56:32 +00:00
parent 77c8f4600e
commit 09a21fb95c
8 changed files with 24 additions and 21 deletions

View File

@@ -15,10 +15,10 @@ import org.springframework.util.Assert;
*/
public class AbstractDelegatorTests extends TestCase {
private static class ConcreteDelegator extends AbstractMethodInvokingDelegator {
private static class ConcreteDelegator extends AbstractMethodInvokingDelegator<Foo> {
}
private AbstractMethodInvokingDelegator delegator = new ConcreteDelegator();
private AbstractMethodInvokingDelegator<Foo> delegator = new ConcreteDelegator();
private Foo foo = new Foo(0, "foo", 1);

View File

@@ -14,7 +14,7 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
*/
public class ItemReaderAdapterTests extends AbstractDependencyInjectionSpringContextTests {
private ItemReaderAdapter provider;
private ItemReaderAdapter<Foo> provider;
private FooService fooService;
@@ -41,7 +41,7 @@ public class ItemReaderAdapterTests extends AbstractDependencyInjectionSpringCon
}
}
public void setProvider(ItemReaderAdapter provider) {
public void setProvider(ItemReaderAdapter<Foo> provider) {
this.provider = provider;
}

View File

@@ -2,12 +2,13 @@ package org.springframework.batch.item.database;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.sample.Foo;
public class JdbcCursorItemReaderCommonTests extends CommonDatabaseItemStreamItemReaderTests {
protected ItemReader getItemReader() throws Exception {
protected ItemReader<Foo> getItemReader() throws Exception {
JdbcCursorItemReader result = new JdbcCursorItemReader();
JdbcCursorItemReader<Foo> result = new JdbcCursorItemReader<Foo>();
result.setDataSource(getDataSource());
result.setSql("select ID, NAME, VALUE from T_FOOS");
result.setIgnoreWarnings(true);
@@ -25,14 +26,14 @@ public class JdbcCursorItemReaderCommonTests extends CommonDatabaseItemStreamIte
public void testRestartWithDriverSupportsAbsolute() throws Exception {
tested = getItemReader();
((JdbcCursorItemReader) tested).setDriverSupportsAbsolute(true);
((JdbcCursorItemReader<Foo>) tested).setDriverSupportsAbsolute(true);
testedAsStream().open(executionContext);
testRestart();
}
protected void pointToEmptyInput(ItemReader tested) throws Exception {
JdbcCursorItemReader reader = (JdbcCursorItemReader) tested;
protected void pointToEmptyInput(ItemReader<Foo> tested) throws Exception {
JdbcCursorItemReader<Foo> reader = (JdbcCursorItemReader<Foo>) tested;
reader.close(new ExecutionContext());
reader.setSql("select ID from T_FOOS where ID < 0");
reader.afterPropertiesSet();

View File

@@ -1,6 +1,7 @@
package org.springframework.batch.item.database;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.sample.Foo;
/**
* Tests for {@link JdbcCursorItemReader}
@@ -9,8 +10,8 @@ import org.springframework.batch.item.ItemReader;
*/
public class JdbcCursorItemReaderIntegrationTests extends AbstractDataSourceItemReaderIntegrationTests {
protected ItemReader createItemReader() throws Exception {
JdbcCursorItemReader result = new JdbcCursorItemReader();
protected ItemReader<Foo> createItemReader() throws Exception {
JdbcCursorItemReader<Foo> result = new JdbcCursorItemReader<Foo>();
result.setDataSource(super.getJdbcTemplate().getDataSource());
result.setSql("select ID, NAME, VALUE from T_FOOS");
result.setIgnoreWarnings(true);