AbstractJUnit38SpringContextTests
)@Deprecated public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactionalTests
Exposes an EntityManagerFactory and a shared EntityManager. Requires an EntityManagerFactory to be injected, plus the DataSource and JpaTransactionManager through the superclass.
When using Xerces, make sure a post 2.0.2 version is available on the classpath to avoid a critical bug that leads to StackOverflow. Maven users are likely to encounter this problem since 2.0.2 is used by default.
A workaround is to explicitly specify the Xerces version inside the Maven POM:
<dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.8.1</version> </dependency>
Modifier and Type | Field and Description |
---|---|
protected EntityManagerFactory |
entityManagerFactory
Deprecated.
|
protected EntityManager |
sharedEntityManager
Deprecated.
Subclasses can use this in test cases.
|
profileValueSource, simpleJdbcTemplate
jdbcTemplate
transactionDefinition, transactionManager, transactionStatus
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
applicationContext
logger
Constructor and Description |
---|
AbstractJpaTests()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected String |
cacheKeys()
Deprecated.
|
protected EntityManager |
createContainerManagedEntityManager()
Deprecated.
Create an EntityManager that will always automatically enlist itself in current
transactions, in contrast to an EntityManager returned by
EntityManagerFactory.createEntityManager()
(which requires an explicit joinTransaction() call). |
protected ClassLoader |
createShadowingClassLoader(ClassLoader classLoader)
Deprecated.
NB: This method must not have a return type of ShadowingClassLoader as that would cause that
class to be loaded eagerly when this test case loads, creating verify errors at runtime.
|
protected void |
customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader)
Deprecated.
Customize the shadowing class loader.
|
protected String |
getActualOrmXmlLocation()
Deprecated.
Subclasses can override this to return the real location path for
orm.xml or null if they do not wish to find any orm.xml
|
void |
runBare()
Deprecated.
Overridden to populate transaction definition from annotations.
|
void |
setDirty()
Deprecated.
Called to say that the "applicationContext" instance variable is dirty
and should be reloaded.
|
void |
setEntityManagerFactory(EntityManagerFactory entityManagerFactory)
Deprecated.
|
protected boolean |
shouldUseShadowLoader()
Deprecated.
Subclasses should override this method if they wish to disable shadow class loading.
|
findUniqueProfileValueSourceFromContext, getTestMethod, isDisabledInThisEnvironment, isRollback, setDataSource
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, setUp, tearDown
addContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, setDirty
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled
countTestCases, createResult, getName, run, run, runTest, setName, toString
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
protected EntityManagerFactory entityManagerFactory
protected EntityManager sharedEntityManager
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory)
protected EntityManager createContainerManagedEntityManager()
EntityManagerFactory.createEntityManager()
(which requires an explicit joinTransaction()
call).protected boolean shouldUseShadowLoader()
The default implementation deactivates shadow class loading if Spring's InstrumentationSavingAgent has been configured on VM startup.
public void setDirty()
AbstractSingleSpringContextTests
setDirty
in class AbstractSingleSpringContextTests
public void runBare() throws Throwable
AbstractAnnotationAwareTransactionalTests
runBare
in class AbstractAnnotationAwareTransactionalTests
Throwable
protected String cacheKeys()
protected ClassLoader createShadowingClassLoader(ClassLoader classLoader)
protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader)
shadowingClassLoader
- this parameter is actually of type
ResourceOverridingShadowingClassLoader, and can safely to be cast to
that type. However, the signature must not be of that type as that
would cause the present class loader to load that type.protected String getActualOrmXmlLocation()