pl.touk.ormtest
Class SpringTxTestRule
java.lang.Object
pl.touk.ormtest.SpringTxTestRule
- All Implemented Interfaces:
- org.junit.rules.TestRule
- Direct Known Subclasses:
- IbatisSpringTxTestRule, JdbcSpringTxTestRule
public abstract class SpringTxTestRule
- extends Object
- implements org.junit.rules.TestRule
Base abstract class for JUnit 4.9+ testing of Jdbc and Ibatis Spring-based DAOs.
- Author:
- Michał Sokołowski
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
txStatuses
protected static final ConcurrentMap<Thread,org.springframework.transaction.TransactionStatus> txStatuses
txManagers
protected static final ConcurrentMap<Thread,org.springframework.jdbc.datasource.DataSourceTransactionManager> txManagers
threadsPerTestClass
protected static final ConcurrentMap<String,Set<Thread>> threadsPerTestClass
SpringTxTestRule
public SpringTxTestRule()
SpringTxTestRule
public SpringTxTestRule(String h2Mode)
findInvokingTestClass
public static Class findInvokingTestClass()
getThreads
protected static Set<Thread> getThreads(Class testClassOrSuiteClass)
dataSource
protected DataSource dataSource()
- Can be overridden in subclasses and should return a data source. The default implementation of this method
returns a data source for in-memory H2 database. This method retuns different data sources if it is invoked
in different threads (database name contains hash code of the current thread).
- Returns:
- data source to be used during tests
ensureTemplateInitialized
protected abstract void ensureTemplateInitialized()
apply
public final org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
- Specified by:
apply
in interface org.junit.rules.TestRule
rollBackTransactionAndBeginNewOne
public void rollBackTransactionAndBeginNewOne()
commitTransactionAndBeginNewOne
public void commitTransactionAndBeginNewOne()
Copyright © 2010–2015 TouK s.k.a.. All rights reserved.