java.lang.Object | ||||
↳ | junit.framework.Assert | |||
↳ | junit.framework.TestCase | |||
↳ | org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests | |||
↳ | org.springframework.test.context.junit38.AbstractTransactionalJUnit38SpringContextTests |
Abstract transactional
extension of
AbstractJUnit38SpringContextTests
which adds convenience
functionality for JDBC access. Expects a DataSource
bean
and a PlatformTransactionManager
bean to be defined in the Spring
application context
.
This class exposes a SimpleJdbcTemplate
and provides an easy way to
count the number of rows in a table
,
delete from the database
, and
execute SQL scripts
within a
transaction.
Concrete subclasses must fulfill the same requirements outlined in
AbstractJUnit38SpringContextTests
.
AbstractJUnit38SpringContextTests
ContextConfiguration
TestExecutionListeners
TransactionalTestExecutionListener
TransactionConfiguration
Transactional
NotTransactional
Rollback
BeforeTransaction
AfterTransaction
SimpleJdbcTestUtils
AbstractTransactionalJUnit4SpringContextTests
AbstractTransactionalTestNGSpringContextTests
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
simpleJdbcTemplate | The SimpleJdbcTemplate that this base class manages, available to subclasses. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new AbstractTransactionalJUnit38SpringContextTests instance.
| |||||||||||
Constructs a new AbstractTransactionalJUnit38SpringContextTests instance
with the supplied
name . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Set the DataSource, typically provided via Dependency Injection.
| |||||||||||
Specify the encoding for SQL scripts, if different from the platform encoding.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Count the rows in the given table.
| |||||||||||
Convenience method for deleting all rows from the specified tables.
| |||||||||||
Execute the given SQL script.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests
| |||||||||||
From class
junit.framework.TestCase
| |||||||||||
From class
junit.framework.Assert
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
junit.framework.Test
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
|
The SimpleJdbcTemplate that this base class manages, available to subclasses.
Constructs a new AbstractTransactionalJUnit38SpringContextTests instance.
Constructs a new AbstractTransactionalJUnit38SpringContextTests instance
with the supplied name
.
name | the name of the current test to execute |
---|
Set the DataSource, typically provided via Dependency Injection.
dataSource | The DataSource to inject |
---|
Specify the encoding for SQL scripts, if different from the platform encoding.
Count the rows in the given table.
tableName | table name to count rows in |
---|
Convenience method for deleting all rows from the specified tables. Use with caution outside of a transaction!
names | the names of the tables from which to delete |
---|
Execute the given SQL script. Use with caution outside of a transaction!
The script will normally be loaded by classpath. There should be one statement per line. Any semicolons will be removed. Do not use this method to execute DDL if you expect rollback.
sqlResourcePath | the Spring resource path for the SQL script |
---|---|
continueOnError | whether or not to continue without throwing an exception in the event of an error |
DataAccessException | if there is an error executing a statement
and continueOnError was false
|
---|