org.springframework.batch.item.database
Class AbstractDataSourceItemReaderIntegrationTests

java.lang.Object
  extended by AbstractTransactionalDataSourceSpringContextTests
      extended by org.springframework.batch.item.database.AbstractDataSourceItemReaderIntegrationTests
Direct Known Subclasses:
HibernateCursorItemReaderIntegrationTests, IbatisItemReaderIntegrationTests, JdbcCursorItemReaderIntegrationTests

public abstract class AbstractDataSourceItemReaderIntegrationTests
extends AbstractTransactionalDataSourceSpringContextTests

Common scenarios for testing ItemReader implementations which read data from database.

Author:
Lucas Ward, Robert Kasanicky

Field Summary
protected  ExecutionContext executionContext
           
protected  ItemReader reader
           
 
Constructor Summary
AbstractDataSourceItemReaderIntegrationTests()
           
 
Method Summary
protected abstract  ItemReader createItemReader()
           
protected  String[] getConfigLocations()
           
protected  void onSetUpInTransaction()
           
protected  void onTearDownAfterTransaction()
           
 void testInvalidRestore()
          Reading from an input source and then trying to restore causes an error.
 void testMultipleRestarts()
           
 void testNormalProcessing()
          Regular scenario - read all rows and eventually return null.
 void testRestart()
          Restart scenario - read records, save restart data, create new input source and restore from restart data - the new input source should continue where the old one finished.
 void testRestoreFromEmptyData()
          Empty restart data should be handled gracefully.
 void testRollback()
          Rollback scenario - input source rollbacks to last commit point.
 void testRollbackAndRestart()
          Rollback scenario with restart - input source rollbacks to last commit point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected ItemReader reader

executionContext

protected ExecutionContext executionContext
Constructor Detail

AbstractDataSourceItemReaderIntegrationTests

public AbstractDataSourceItemReaderIntegrationTests()
Method Detail

createItemReader

protected abstract ItemReader createItemReader()
                                        throws Exception
Returns:
configured input source ready for use
Throws:
Exception

getConfigLocations

protected String[] getConfigLocations()

onSetUpInTransaction

protected void onSetUpInTransaction()
                             throws Exception
Throws:
Exception

onTearDownAfterTransaction

protected void onTearDownAfterTransaction()
                                   throws Exception
Throws:
Exception

testNormalProcessing

public void testNormalProcessing()
                          throws Exception
Regular scenario - read all rows and eventually return null.

Throws:
Exception

testRestart

public void testRestart()
                 throws Exception
Restart scenario - read records, save restart data, create new input source and restore from restart data - the new input source should continue where the old one finished.

Throws:
Exception

testInvalidRestore

public void testInvalidRestore()
                        throws Exception
Reading from an input source and then trying to restore causes an error.

Throws:
Exception

testRestoreFromEmptyData

public void testRestoreFromEmptyData()
                              throws Exception
Empty restart data should be handled gracefully.

Throws:
Exception

testRollback

public void testRollback()
                  throws Exception
Rollback scenario - input source rollbacks to last commit point.

Throws:
Exception

testRollbackAndRestart

public void testRollbackAndRestart()
                            throws Exception
Rollback scenario with restart - input source rollbacks to last commit point.

Throws:
Exception

testMultipleRestarts

public void testMultipleRestarts()
                          throws Exception
Throws:
Exception


Copyright © 2008 SpringSource. All Rights Reserved.