AbstractTransactionalJUnit4SpringContextTests
)@Deprecated public abstract class AbstractAnnotationAwareTransactionalTests extends AbstractTransactionalDataSourceSpringContextTests
Java 5 specific subclass of
AbstractTransactionalDataSourceSpringContextTests
, exposing a
SimpleJdbcTemplate
and obeying annotations for transaction control.
For example, test methods can be annotated with the regular Spring
@Transactional
annotation (e.g., to force execution in a read-only transaction) or with the
@NotTransactional
annotation to prevent any
transaction being created at all. In addition, individual test methods can be
annotated with @Rollback
to override the
default rollback
settings.
The following list constitutes all annotations currently supported by AbstractAnnotationAwareTransactionalTests:
Modifier and Type | Field and Description |
---|---|
protected ProfileValueSource |
profileValueSource
Deprecated.
ProfileValueSource available to subclasses but primarily intended
for use in isDisabledInThisEnvironment(Method) . |
protected SimpleJdbcTemplate |
simpleJdbcTemplate
Deprecated.
|
jdbcTemplate
transactionDefinition, transactionManager, transactionStatus
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
applicationContext
logger
Constructor and Description |
---|
AbstractAnnotationAwareTransactionalTests()
Deprecated.
Default constructor for AbstractAnnotationAwareTransactionalTests, which
delegates to
AbstractAnnotationAwareTransactionalTests(String) . |
AbstractAnnotationAwareTransactionalTests(String name)
Deprecated.
Constructs a new AbstractAnnotationAwareTransactionalTests instance with
the specified JUnit
name and retrieves the configured (or
default) ProfileValueSource . |
Modifier and Type | Method and Description |
---|---|
protected void |
findUniqueProfileValueSourceFromContext(ApplicationContext applicationContext)
Deprecated.
Use
@ProfileValueSourceConfiguration instead. |
protected Method |
getTestMethod()
Deprecated.
Get the current test method.
|
protected boolean |
isDisabledInThisEnvironment(Method testMethod)
Deprecated.
Determine if the test for the supplied
testMethod should
run in the current environment. |
protected boolean |
isRollback()
Deprecated.
Determine whether or not to rollback transactions for the current test
by taking into consideration the
default rollback flag and a possible
method-level override via the @Rollback annotation. |
void |
runBare()
Deprecated.
Overridden to populate transaction definition from annotations.
|
void |
setDataSource(DataSource dataSource)
Deprecated.
Setter: DataSource is provided by Dependency Injection.
|
countRowsInTable, deleteFromTables, executeSqlScript, getJdbcTemplate, setComplete, setSqlScriptEncoding
endTransaction, isDefaultRollback, 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
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 SimpleJdbcTemplate simpleJdbcTemplate
protected ProfileValueSource profileValueSource
ProfileValueSource
available to subclasses but primarily intended
for use in isDisabledInThisEnvironment(Method)
.
Set to SystemProfileValueSource
by default for backwards
compatibility; however, the value may be changed in the
AbstractAnnotationAwareTransactionalTests(String)
constructor.
public AbstractAnnotationAwareTransactionalTests()
AbstractAnnotationAwareTransactionalTests(String)
.public AbstractAnnotationAwareTransactionalTests(String name)
name
and retrieves the configured (or
default) ProfileValueSource
.name
- the name of the current testProfileValueUtils.retrieveProfileValueSource(Class)
public void setDataSource(DataSource dataSource)
AbstractTransactionalDataSourceSpringContextTests
setDataSource
in class AbstractTransactionalDataSourceSpringContextTests
@Deprecated protected void findUniqueProfileValueSourceFromContext(ApplicationContext applicationContext)
@ProfileValueSourceConfiguration
instead.ProfileValueSource
in the supplied
ApplicationContext
. If found, the
profileValueSource
for this test will be set to the unique
ProfileValueSource
.applicationContext
- the ApplicationContext in which to search for
the ProfileValueSource; may not be null
public void runBare() throws Throwable
runBare
in class ConditionalTestCase
Throwable
protected boolean isDisabledInThisEnvironment(Method testMethod)
testMethod
should
run in the current environment.
The default implementation is based on
@IfProfileValue
semantics.
testMethod
- the test methodtrue
if the test is disabled in the current environmentProfileValueUtils.isTestEnabledInThisEnvironment(java.lang.Class<?>)
protected Method getTestMethod()
protected boolean isRollback()
default rollback
flag and a possible
method-level override via the @Rollback
annotation.isRollback
in class AbstractTransactionalSpringContextTests