Package org.hibernate.testing.junit4
Class BaseNonConfigCoreFunctionalTestCase
- java.lang.Object
-
- org.hibernate.testing.junit4.BaseUnitTestCase
-
- org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase
-
public class BaseNonConfigCoreFunctionalTestCase extends BaseUnitTestCase
Applies functional testing logic for core Hibernate testing on top ofBaseUnitTestCase
. Much likeBaseCoreFunctionalTestCase
, except that this form uses the new bootstrapping APIs while BaseCoreFunctionalTestCase continues to use (the neutered form of) Configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BaseNonConfigCoreFunctionalTestCase.RollbackWork
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.Class[]
NO_CLASSES
protected static java.lang.String[]
NO_MAPPINGS
static java.lang.String
VALIDATE_DATA_CLEANUP
-
Fields inherited from class org.hibernate.testing.junit4.BaseUnitTestCase
executorService, globalTimeout, log
-
-
Constructor Summary
Constructors Constructor Description BaseNonConfigCoreFunctionalTestCase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSettings(java.util.Map settings)
protected void
afterBootstrapServiceRegistryBuilt(BootstrapServiceRegistry bsr)
Hook to allow tests to use the BootstrapServiceRegistry if they wishprotected void
afterMetadataBuilt(Metadata metadata)
protected void
afterMetadataSourcesApplied(MetadataSources metadataSources)
protected void
afterSessionFactoryBuilt(SessionFactoryImplementor sessionFactory)
protected void
afterStandardServiceRegistryBuilt(StandardServiceRegistry ssr)
Hook to allow tests to use the StandardServiceRegistry if they wishvoid
afterTest()
protected void
applyCacheSettings(Metadata metadata)
protected void
applyMetadataSources(MetadataSources sources)
protected void
assertAllDataRemoved()
void
beforeTest()
protected void
buildResources()
protected void
cleanupCache()
protected void
cleanupTest()
protected void
cleanupTestData()
protected void
configureBootstrapServiceRegistryBuilder(BootstrapServiceRegistryBuilder bsrb)
Apply any desired config to the BootstrapServiceRegistryBuilder to be incorporated into the built BootstrapServiceRegistryprotected void
configureMetadataBuilder(MetadataBuilder metadataBuilder)
protected void
configureSessionFactoryBuilder(SessionFactoryBuilder sfb)
protected void
configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb)
Apply any desired config to the StandardServiceRegistryBuilder to be incorporated into the built StandardServiceRegistryprotected StandardServiceRegistryBuilder
constructStandardServiceRegistryBuilder()
protected boolean
createSchema()
protected java.lang.String
createSecondSchema()
<R> R
fromSession(java.util.function.Function<SessionImplementor,R> action)
<R> R
fromTransaction(java.util.function.Function<SessionImplementor,R> action)
protected java.lang.Class[]
getAnnotatedClasses()
protected java.lang.String[]
getAnnotatedPackages()
protected java.lang.String
getBaseForMappings()
protected java.lang.String
getCacheConcurrencyStrategy()
protected Dialect
getDialect()
protected java.lang.String[]
getMappings()
protected Session
getSession()
protected java.lang.String[]
getXmlFiles()
protected void
initialize(MetadataBuilder metadataBuilder)
void
inSession(java.util.function.Consumer<SessionImplementor> action)
void
inStatelessSession(java.util.function.Consumer<StatelessSession> action)
void
inStatelessTransaction(java.util.function.Consumer<StatelessSession> action)
void
inTransaction(java.util.function.Consumer<SessionImplementor> action)
protected boolean
isCleanupTestDataRequired()
protected MetadataImplementor
metadata()
void
onFailure()
protected Session
openSession()
protected Session
openSession(Interceptor interceptor)
protected boolean
overrideCacheStrategy()
protected void
prepareTest()
protected void
rebuildSessionFactory()
protected boolean
rebuildSessionFactoryOnError()
protected void
releaseResources()
protected StandardServiceRegistry
serviceRegistry()
protected SessionFactoryImplementor
sessionFactory()
protected void
shutDown()
protected void
startUp()
-
Methods inherited from class org.hibernate.testing.junit4.BaseUnitTestCase
assertNoLeaks, executeAsync, executeSync, releaseTransactions, sleep
-
-
-
-
Field Detail
-
VALIDATE_DATA_CLEANUP
public static final java.lang.String VALIDATE_DATA_CLEANUP
- See Also:
- Constant Field Values
-
NO_MAPPINGS
protected static final java.lang.String[] NO_MAPPINGS
-
NO_CLASSES
protected static final java.lang.Class[] NO_CLASSES
-
-
Method Detail
-
getDialect
protected Dialect getDialect()
-
serviceRegistry
protected StandardServiceRegistry serviceRegistry()
-
metadata
protected MetadataImplementor metadata()
-
sessionFactory
protected SessionFactoryImplementor sessionFactory()
-
openSession
protected Session openSession() throws HibernateException
- Throws:
HibernateException
-
openSession
protected Session openSession(Interceptor interceptor) throws HibernateException
- Throws:
HibernateException
-
getSession
protected Session getSession()
-
rebuildSessionFactory
protected void rebuildSessionFactory()
-
cleanupCache
protected void cleanupCache()
-
startUp
protected void startUp()
-
buildResources
protected void buildResources()
-
constructStandardServiceRegistryBuilder
protected final StandardServiceRegistryBuilder constructStandardServiceRegistryBuilder()
-
addSettings
protected void addSettings(java.util.Map settings)
-
configureBootstrapServiceRegistryBuilder
protected void configureBootstrapServiceRegistryBuilder(BootstrapServiceRegistryBuilder bsrb)
Apply any desired config to the BootstrapServiceRegistryBuilder to be incorporated into the built BootstrapServiceRegistry- Parameters:
bsrb
- The BootstrapServiceRegistryBuilder
-
afterBootstrapServiceRegistryBuilt
protected void afterBootstrapServiceRegistryBuilt(BootstrapServiceRegistry bsr)
Hook to allow tests to use the BootstrapServiceRegistry if they wish- Parameters:
bsr
- The BootstrapServiceRegistry
-
createSchema
protected boolean createSchema()
-
createSecondSchema
protected java.lang.String createSecondSchema()
-
configureStandardServiceRegistryBuilder
protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb)
Apply any desired config to the StandardServiceRegistryBuilder to be incorporated into the built StandardServiceRegistry- Parameters:
ssrb
- The StandardServiceRegistryBuilder
-
afterStandardServiceRegistryBuilt
protected void afterStandardServiceRegistryBuilt(StandardServiceRegistry ssr)
Hook to allow tests to use the StandardServiceRegistry if they wish- Parameters:
ssr
- The StandardServiceRegistry
-
applyMetadataSources
protected void applyMetadataSources(MetadataSources sources)
-
getMappings
protected java.lang.String[] getMappings()
-
getBaseForMappings
protected java.lang.String getBaseForMappings()
-
getAnnotatedClasses
protected java.lang.Class[] getAnnotatedClasses()
-
getAnnotatedPackages
protected java.lang.String[] getAnnotatedPackages()
-
getXmlFiles
protected java.lang.String[] getXmlFiles()
-
afterMetadataSourcesApplied
protected void afterMetadataSourcesApplied(MetadataSources metadataSources)
-
initialize
protected void initialize(MetadataBuilder metadataBuilder)
-
configureMetadataBuilder
protected void configureMetadataBuilder(MetadataBuilder metadataBuilder)
-
overrideCacheStrategy
protected boolean overrideCacheStrategy()
-
getCacheConcurrencyStrategy
protected java.lang.String getCacheConcurrencyStrategy()
-
applyCacheSettings
protected final void applyCacheSettings(Metadata metadata)
-
afterMetadataBuilt
protected void afterMetadataBuilt(Metadata metadata)
-
configureSessionFactoryBuilder
protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb)
-
afterSessionFactoryBuilt
protected void afterSessionFactoryBuilt(SessionFactoryImplementor sessionFactory)
-
shutDown
protected void shutDown()
-
releaseResources
protected void releaseResources()
-
onFailure
public void onFailure()
-
rebuildSessionFactoryOnError
protected boolean rebuildSessionFactoryOnError()
-
beforeTest
public final void beforeTest() throws java.lang.Exception
- Throws:
java.lang.Exception
-
prepareTest
protected void prepareTest() throws java.lang.Exception
- Throws:
java.lang.Exception
-
afterTest
public final void afterTest() throws java.lang.Exception
- Throws:
java.lang.Exception
-
isCleanupTestDataRequired
protected boolean isCleanupTestDataRequired()
-
cleanupTestData
protected void cleanupTestData() throws java.lang.Exception
- Throws:
java.lang.Exception
-
cleanupTest
protected void cleanupTest() throws java.lang.Exception
- Throws:
java.lang.Exception
-
assertAllDataRemoved
protected void assertAllDataRemoved()
-
inSession
public void inSession(java.util.function.Consumer<SessionImplementor> action)
-
inStatelessSession
public void inStatelessSession(java.util.function.Consumer<StatelessSession> action)
-
fromSession
public <R> R fromSession(java.util.function.Function<SessionImplementor,R> action)
-
inTransaction
public void inTransaction(java.util.function.Consumer<SessionImplementor> action)
-
inStatelessTransaction
public void inStatelessTransaction(java.util.function.Consumer<StatelessSession> action)
-
fromTransaction
public <R> R fromTransaction(java.util.function.Function<SessionImplementor,R> action)
-
-