BATCH-1346: added test and extra Javadocs to clarify

This commit is contained in:
dsyer
2009-07-28 17:21:03 +00:00
parent 64f9472ad0
commit 3429e41faf
3 changed files with 43 additions and 18 deletions

View File

@@ -5,7 +5,9 @@ import static org.junit.Assert.assertEquals;
import javax.sql.DataSource;
import org.springframework.batch.item.AbstractItemStreamItemReaderTests;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.sample.Foo;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Before;
@@ -31,13 +33,14 @@ public abstract class AbstractDatabaseItemStreamItemReaderTests extends Abstract
@Test
public void testReadToExhaustion() throws Exception {
ItemReader<Foo> reader = getItemReader();
pointToEmptyInput(reader);
((ItemStream) reader).open(new ExecutionContext());
// pointToEmptyInput(reader);
int count = 0;
Foo item = new Foo();
while (count++<100 && item!=null) {
item = reader.read();
}
assertEquals(2, count);
assertEquals(7, count);
}
protected DataSource getDataSource() {

View File

@@ -23,6 +23,7 @@ public class IbatisPagingItemReaderCommonTests extends AbstractDatabaseItemStrea
IbatisPagingItemReader reader = new IbatisPagingItemReader();
reader.setQueryId("getPagedFoos");
reader.setPageSize(2);
reader.setSqlMapClient(sqlMapClient);
reader.setSaveState(true);