org.springframework.batch.item.database
Class AbstractJdbcItemReaderIntegrationTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.test.ConditionalTestCase
              extended by org.springframework.test.AbstractSpringContextTests
                  extended by org.springframework.test.AbstractSingleSpringContextTests
                      extended by org.springframework.test.AbstractDependencyInjectionSpringContextTests
                          extended by org.springframework.test.AbstractTransactionalSpringContextTests
                              extended by org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
                                  extended by org.springframework.batch.item.database.AbstractJdbcItemReaderIntegrationTests
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
MultipleColumnJdbcDrivingQueryItemReaderIntegrationTests, SingleColumnJdbcDrivingQueryItemReaderIntegrationTests

public abstract class AbstractJdbcItemReaderIntegrationTests
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 itemReader
           
 
Fields inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
jdbcTemplate
 
Fields inherited from class org.springframework.test.AbstractTransactionalSpringContextTests
transactionDefinition, transactionManager, transactionStatus
 
Fields inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
 
Fields inherited from class org.springframework.test.AbstractSingleSpringContextTests
applicationContext
 
Fields inherited from class org.springframework.test.ConditionalTestCase
logger
 
Constructor Summary
AbstractJdbcItemReaderIntegrationTests()
           
 
Method Summary
protected abstract  ItemReader createItemReader()
           
protected  String[] getConfigLocations()
           
protected  void onSetUp()
           
protected  void onTearDown()
           
 void testInvalidRestore()
          Reading from an input source and then trying to restore causes an error.
 void testNormalProcessing()
          Regular scenario - read all rows and eventually return null.
 void testRestart()
          Restart scenario.
 void testRestoreFromEmptyData()
          Empty restart data should be handled gracefully.
 void testRollback()
          Rollback scenario.
 
Methods inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
countRowsInTable, deleteFromTables, executeSqlScript, getJdbcTemplate, setComplete, setDataSource, setSqlScriptEncoding
 
Methods inherited from class org.springframework.test.AbstractTransactionalSpringContextTests
endTransaction, isDefaultRollback, isRollback, onSetUpBeforeTransaction, onSetUpInTransaction, onTearDownAfterTransaction, onTearDownInTransaction, preventTransaction, setDefaultRollback, setTransactionDefinition, setTransactionManager, startNewTransaction
 
Methods inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
getAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariables
 
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests
contextKey, createApplicationContext, createBeanDefinitionReader, customizeBeanFactory, getApplicationContext, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, prepareApplicationContext, setDirty, setUp, tearDown
 
Methods inherited from class org.springframework.test.AbstractSpringContextTests
addContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, setDirty
 
Methods inherited from class org.springframework.test.ConditionalTestCase
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled, runBare
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

itemReader

protected ItemReader itemReader

executionContext

protected ExecutionContext executionContext
Constructor Detail

AbstractJdbcItemReaderIntegrationTests

public AbstractJdbcItemReaderIntegrationTests()
Method Detail

createItemReader

protected abstract ItemReader createItemReader()
                                        throws Exception
Returns:
input source with all necessary dependencies set
Throws:
Exception

getConfigLocations

protected String[] getConfigLocations()
Overrides:
getConfigLocations in class AbstractSingleSpringContextTests

onSetUp

protected void onSetUp()
                throws Exception
Overrides:
onSetUp in class AbstractTransactionalSpringContextTests
Throws:
Exception

onTearDown

protected void onTearDown()
                   throws Exception
Overrides:
onTearDown in class AbstractTransactionalSpringContextTests
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.

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.

Throws:
Exception


Copyright © 2008 SpringSource. All Rights Reserved.