AbstractTransactionalJUnit4SpringContextTests
)@Deprecated public abstract class AbstractTransactionalDataSourceSpringContextTests extends AbstractTransactionalSpringContextTests
DataSource
bean
to be defined in the Spring application context.
This class exposes a JdbcTemplate
and provides an easy way to delete from the database in a new transaction.
setDataSource(javax.sql.DataSource)
,
getJdbcTemplate()
Modifier and Type | Field and Description |
---|---|
protected JdbcTemplate |
jdbcTemplate
Deprecated.
|
transactionDefinition, transactionManager, transactionStatus
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
applicationContext
logger
Constructor and Description |
---|
AbstractTransactionalDataSourceSpringContextTests()
Deprecated.
Default constructor for AbstractTransactionalDataSourceSpringContextTests.
|
AbstractTransactionalDataSourceSpringContextTests(String name)
Deprecated.
Constructor for AbstractTransactionalDataSourceSpringContextTests with a JUnit name.
|
Modifier and Type | Method and Description |
---|---|
protected int |
countRowsInTable(String tableName)
Deprecated.
Count the rows in the given table
|
protected void |
deleteFromTables(String[] names)
Deprecated.
Convenient method to delete all rows from these tables.
|
protected void |
executeSqlScript(String sqlResourcePath,
boolean continueOnError)
Deprecated.
Execute the given SQL script.
|
JdbcTemplate |
getJdbcTemplate()
Deprecated.
Return the JdbcTemplate that this base class manages.
|
protected void |
setComplete()
Deprecated.
Overridden to prevent the transaction committing if a number of tables have been
cleared, as a defensive measure against accidental permanent wiping of a database.
|
void |
setDataSource(DataSource dataSource)
Deprecated.
Setter: DataSource is provided by Dependency Injection.
|
void |
setSqlScriptEncoding(String sqlScriptEncoding)
Deprecated.
Specify the encoding for SQL scripts, if different from the platform encoding.
|
endTransaction, isDefaultRollback, isRollback, onSetUp, onSetUpBeforeTransaction, onSetUpInTransaction, onTearDown, onTearDownAfterTransaction, onTearDownInTransaction, preventTransaction, setDefaultRollback, setTransactionDefinition, setTransactionManager, startNewTransaction
getAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariables
contextKey, createApplicationContext, createBeanDefinitionReader, customizeBeanFactory, getApplicationContext, getConfigLocations, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, prepareApplicationContext, setDirty, setUp, tearDown
addContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, setDirty
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled, runBare
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
protected JdbcTemplate jdbcTemplate
public AbstractTransactionalDataSourceSpringContextTests()
public AbstractTransactionalDataSourceSpringContextTests(String name)
public void setDataSource(DataSource dataSource)
public final JdbcTemplate getJdbcTemplate()
public void setSqlScriptEncoding(String sqlScriptEncoding)
protected void deleteFromTables(String[] names)
setComplete()
impossible.setComplete()
protected final void setComplete()
setComplete
in class AbstractTransactionalSpringContextTests
AbstractTransactionalSpringContextTests.setComplete()
protected int countRowsInTable(String tableName)
tableName
- table name to count rows inprotected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException
sqlResourcePath
- Spring resource path for the SQL script.
Should normally be loaded by classpath.
Statements should be delimited with a semicolon. If statements are not delimited with a semicolon then there should be one statement per line. Statements are allowed to span lines only if they are delimited with a semicolon.
Do not use this method to execute DDL if you expect rollback.
continueOnError
- whether or not to continue without throwing
an exception in the event of an errorDataAccessException
- if there is an error executing a statement
and continueOnError was false