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.
|
private java.lang.String |
sqlScriptEncoding
Deprecated.
|
private boolean |
zappedTables
Deprecated.
Did this test delete any tables? If so, we forbid transaction completion,
and only allow rollback.
|
transactionDefinition, transactionManager, transactionStatusAUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NOapplicationContextlogger| Constructor and Description |
|---|
AbstractTransactionalDataSourceSpringContextTests()
Deprecated.
Default constructor for AbstractTransactionalDataSourceSpringContextTests.
|
AbstractTransactionalDataSourceSpringContextTests(java.lang.String name)
Deprecated.
Constructor for AbstractTransactionalDataSourceSpringContextTests with a JUnit name.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
countRowsInTable(java.lang.String tableName)
Deprecated.
Count the rows in the given table
|
protected void |
deleteFromTables(java.lang.String[] names)
Deprecated.
Convenient method to delete all rows from these tables.
|
protected void |
executeSqlScript(java.lang.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(javax.sql.DataSource dataSource)
Deprecated.
Setter: DataSource is provided by Dependency Injection.
|
void |
setSqlScriptEncoding(java.lang.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, startNewTransactiongetAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariablescontextKey, createApplicationContext, createBeanDefinitionReader, customizeBeanFactory, getApplicationContext, getConfigLocations, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, prepareApplicationContext, setDirty, setUp, tearDownaddContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, setDirtygetDisabledTestCount, isDisabledInThisEnvironment, recordDisabled, runBareprotected JdbcTemplate jdbcTemplate
private java.lang.String sqlScriptEncoding
private boolean zappedTables
public AbstractTransactionalDataSourceSpringContextTests()
public AbstractTransactionalDataSourceSpringContextTests(java.lang.String name)
public void setDataSource(javax.sql.DataSource dataSource)
public final JdbcTemplate getJdbcTemplate()
public void setSqlScriptEncoding(java.lang.String sqlScriptEncoding)
protected void deleteFromTables(java.lang.String[] names)
setComplete() impossible.setComplete()protected final void setComplete()
setComplete in class AbstractTransactionalSpringContextTestsAbstractTransactionalSpringContextTests.setComplete()protected int countRowsInTable(java.lang.String tableName)
tableName - table name to count rows inprotected void executeSqlScript(java.lang.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