RESOLVED - BATCH-578: remove self-initialization from ItemReader#read() implementations
This commit is contained in:
@@ -54,7 +54,8 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
*/
|
||||
public void testNormalProcessing() throws Exception {
|
||||
getAsInitializingBean(reader).afterPropertiesSet();
|
||||
|
||||
getAsItemStream(reader).open(executionContext);
|
||||
|
||||
Foo foo1 = (Foo) reader.read();
|
||||
assertEquals(1, foo1.getValue());
|
||||
|
||||
@@ -116,6 +117,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
|
||||
// create new input source
|
||||
reader = createItemReader();
|
||||
getAsItemStream(reader).open(new ExecutionContext());
|
||||
|
||||
Foo foo = (Foo) reader.read();
|
||||
assertEquals(1, foo.getValue());
|
||||
@@ -134,7 +136,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testRestoreFromEmptyData() throws Exception {
|
||||
getAsItemStream(reader).update(executionContext);
|
||||
getAsItemStream(reader).open(executionContext);
|
||||
|
||||
Foo foo = (Foo) reader.read();
|
||||
assertEquals(1, foo.getValue());
|
||||
@@ -145,6 +147,8 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testRollback() throws Exception {
|
||||
getAsItemStream(reader).open(executionContext);
|
||||
|
||||
Foo foo1 = (Foo) reader.read();
|
||||
|
||||
commit();
|
||||
|
||||
@@ -105,6 +105,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
getAsItemStream(itemReader).open(new ExecutionContext());
|
||||
|
||||
Foo foo = (Foo) itemReader.read();
|
||||
assertEquals(1, foo.getValue());
|
||||
@@ -134,6 +135,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testRollback() throws Exception {
|
||||
getAsItemStream(itemReader).open(executionContext);
|
||||
Foo foo1 = (Foo) itemReader.read();
|
||||
|
||||
commit();
|
||||
|
||||
@@ -44,6 +44,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
*/
|
||||
public void testNormalProcessing() throws Exception {
|
||||
getAsInitializingBean(itemReader).afterPropertiesSet();
|
||||
getAsItemStream(itemReader).open(new ExecutionContext());
|
||||
|
||||
Foo foo1 = (Foo) itemReader.read();
|
||||
assertEquals(1, foo1.getValue());
|
||||
@@ -109,6 +110,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
|
||||
// create new input source
|
||||
itemReader = createItemReader();
|
||||
getAsItemStream(itemReader).open(new ExecutionContext());
|
||||
|
||||
Foo foo = (Foo) itemReader.read();
|
||||
assertEquals(1, foo.getValue());
|
||||
@@ -140,6 +142,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testRollback() throws Exception {
|
||||
getAsItemStream(itemReader).open(new ExecutionContext());
|
||||
Foo foo1 = (Foo) itemReader.read();
|
||||
|
||||
commit();
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.hibernate.SessionFactory;
|
||||
import org.hibernate.StatelessSession;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -56,6 +57,7 @@ public class HibernateCursorProjectionItemReaderIntegrationTests extends Abstrac
|
||||
|
||||
public void testNormalProcessing() throws Exception {
|
||||
((InitializingBean) reader).afterPropertiesSet();
|
||||
((ItemStream) reader).open(new ExecutionContext());
|
||||
Object[] foo1 = (Object[]) reader.read();
|
||||
assertEquals(new Integer(1), foo1[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user