org.springframework.test
Class AbstractTransactionalDataSourceSpringContextTests
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.test.AbstractSpringContextTests
org.springframework.test.AbstractDependencyInjectionSpringContextTests
org.springframework.test.AbstractTransactionalSpringContextTests
org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
- All Implemented Interfaces:
- Test
public abstract class AbstractTransactionalDataSourceSpringContextTests
- extends AbstractTransactionalSpringContextTests
Subclass of AbstractTransactionalSpringContextTests that adds some convenience
functionality. Expects a DataSource 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.
- Since:
- 1.1.1
- Author:
- Rod Johnson
Method Summary |
protected void |
deleteFromTables(String[] names)
Convenient method to delete all rows from these tables. |
protected void |
setComplete()
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)
Setter: DataSource is provided by Dependency Injection. |
Methods inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests |
contextKey, getAutowireMode, getConfigLocations, getLoadCount, initManagedVariableNames, isDependencyCheck, isPopulateProtectedVariables, loadContextLocations, populateProtectedVariables, setAutowireMode, setDependencyCheck, setDirty, setPopulateProtectedVariables, setUp, tearDown |
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 |
jdbcTemplate
protected JdbcTemplate jdbcTemplate
AbstractTransactionalDataSourceSpringContextTests
public AbstractTransactionalDataSourceSpringContextTests()
- Default constructor for AbstractTransactionalDataSourceSpringContextTests.
AbstractTransactionalDataSourceSpringContextTests
public AbstractTransactionalDataSourceSpringContextTests(String name)
- Constructor for AbstractTransactionalDataSourceSpringContextTests with a JUnit name.
setDataSource
public void setDataSource(DataSource dataSource)
- Setter: DataSource is provided by Dependency Injection.
- Parameters:
dataSource
-
deleteFromTables
protected void deleteFromTables(String[] names)
- Convenient method to delete all rows from these tables.
Calling this method will make avoidance of rollback by calling
setComplete()
impossible.
- See Also:
setComplete()
setComplete
protected final void setComplete()
- 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.
- Overrides:
setComplete
in class AbstractTransactionalSpringContextTests
- See Also:
AbstractTransactionalSpringContextTests.setComplete()
Copyright (c) 2002-2006 The Spring Framework Project.