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 static class
BaseNonConfigCoreFunctionalTestCase.RollbackWork
-
Field Summary
Fields Modifier and Type Field Description protected static Class[]
NO_CLASSES
protected static String[]
NO_MAPPINGS
static 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(Map settings)
protected void
afterBootstrapServiceRegistryBuilt(org.hibernate.boot.registry.BootstrapServiceRegistry bsr)
Hook to allow tests to use the BootstrapServiceRegistry if they wishprotected void
afterMetadataBuilt(org.hibernate.boot.Metadata metadata)
protected void
afterMetadataSourcesApplied(org.hibernate.boot.MetadataSources metadataSources)
protected void
afterSessionFactoryBuilt(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
protected void
afterStandardServiceRegistryBuilt(org.hibernate.boot.registry.StandardServiceRegistry ssr)
Hook to allow tests to use the StandardServiceRegistry if they wishvoid
afterTest()
protected void
applyCacheSettings(org.hibernate.boot.Metadata metadata)
protected void
applyMetadataSources(org.hibernate.boot.MetadataSources sources)
protected void
assertAllDataRemoved()
void
beforeTest()
protected void
buildResources()
protected void
cleanupCache()
protected void
cleanupTest()
protected void
cleanupTestData()
protected void
configureBootstrapServiceRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb)
Apply any desired config to the BootstrapServiceRegistryBuilder to be incorporated into the built BootstrapServiceRegistryprotected void
configureMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder)
protected void
configureSessionFactoryBuilder(org.hibernate.boot.SessionFactoryBuilder sfb)
protected void
configureStandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrb)
Apply any desired config to the StandardServiceRegistryBuilder to be incorporated into the built StandardServiceRegistryprotected org.hibernate.boot.registry.StandardServiceRegistryBuilder
constructStandardServiceRegistryBuilder()
protected boolean
createSchema()
protected String
createSecondSchema()
<R> R
fromSession(Function<org.hibernate.engine.spi.SessionImplementor,R> action)
<R> R
fromTransaction(Function<org.hibernate.engine.spi.SessionImplementor,R> action)
protected Class[]
getAnnotatedClasses()
protected String[]
getAnnotatedPackages()
protected String
getBaseForMappings()
protected String
getCacheConcurrencyStrategy()
protected org.hibernate.dialect.Dialect
getDialect()
protected String[]
getMappings()
protected org.hibernate.Session
getSession()
protected String[]
getXmlFiles()
protected void
initialize(org.hibernate.boot.MetadataBuilder metadataBuilder)
void
inSession(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
void
inStatelessSession(Consumer<org.hibernate.StatelessSession> action)
void
inStatelessTransaction(Consumer<org.hibernate.StatelessSession> action)
void
inTransaction(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
protected boolean
isCleanupTestDataRequired()
protected org.hibernate.boot.spi.MetadataImplementor
metadata()
void
onFailure()
protected org.hibernate.Session
openSession()
protected org.hibernate.Session
openSession(org.hibernate.Interceptor interceptor)
protected boolean
overrideCacheStrategy()
protected void
prepareTest()
protected void
rebuildSessionFactory()
protected boolean
rebuildSessionFactoryOnError()
protected void
releaseResources()
protected org.hibernate.boot.registry.StandardServiceRegistry
serviceRegistry()
protected org.hibernate.engine.spi.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 String VALIDATE_DATA_CLEANUP
- See Also:
- Constant Field Values
-
NO_MAPPINGS
protected static final String[] NO_MAPPINGS
-
NO_CLASSES
protected static final Class[] NO_CLASSES
-
-
Method Detail
-
getDialect
protected org.hibernate.dialect.Dialect getDialect()
-
serviceRegistry
protected org.hibernate.boot.registry.StandardServiceRegistry serviceRegistry()
-
metadata
protected org.hibernate.boot.spi.MetadataImplementor metadata()
-
sessionFactory
protected org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory()
-
openSession
protected org.hibernate.Session openSession() throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
-
openSession
protected org.hibernate.Session openSession(org.hibernate.Interceptor interceptor) throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
-
getSession
protected org.hibernate.Session getSession()
-
rebuildSessionFactory
protected void rebuildSessionFactory()
-
cleanupCache
protected void cleanupCache()
-
startUp
protected void startUp()
-
buildResources
protected void buildResources()
-
constructStandardServiceRegistryBuilder
protected final org.hibernate.boot.registry.StandardServiceRegistryBuilder constructStandardServiceRegistryBuilder()
-
addSettings
protected void addSettings(Map settings)
-
configureBootstrapServiceRegistryBuilder
protected void configureBootstrapServiceRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb)
Apply any desired config to the BootstrapServiceRegistryBuilder to be incorporated into the built BootstrapServiceRegistry- Parameters:
bsrb
- The BootstrapServiceRegistryBuilder
-
afterBootstrapServiceRegistryBuilt
protected void afterBootstrapServiceRegistryBuilt(org.hibernate.boot.registry.BootstrapServiceRegistry bsr)
Hook to allow tests to use the BootstrapServiceRegistry if they wish- Parameters:
bsr
- The BootstrapServiceRegistry
-
createSchema
protected boolean createSchema()
-
createSecondSchema
protected String createSecondSchema()
-
configureStandardServiceRegistryBuilder
protected void configureStandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrb)
Apply any desired config to the StandardServiceRegistryBuilder to be incorporated into the built StandardServiceRegistry- Parameters:
ssrb
- The StandardServiceRegistryBuilder
-
afterStandardServiceRegistryBuilt
protected void afterStandardServiceRegistryBuilt(org.hibernate.boot.registry.StandardServiceRegistry ssr)
Hook to allow tests to use the StandardServiceRegistry if they wish- Parameters:
ssr
- The StandardServiceRegistry
-
applyMetadataSources
protected void applyMetadataSources(org.hibernate.boot.MetadataSources sources)
-
getMappings
protected String[] getMappings()
-
getBaseForMappings
protected String getBaseForMappings()
-
getAnnotatedClasses
protected Class[] getAnnotatedClasses()
-
getAnnotatedPackages
protected String[] getAnnotatedPackages()
-
getXmlFiles
protected String[] getXmlFiles()
-
afterMetadataSourcesApplied
protected void afterMetadataSourcesApplied(org.hibernate.boot.MetadataSources metadataSources)
-
initialize
protected void initialize(org.hibernate.boot.MetadataBuilder metadataBuilder)
-
configureMetadataBuilder
protected void configureMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder)
-
overrideCacheStrategy
protected boolean overrideCacheStrategy()
-
getCacheConcurrencyStrategy
protected String getCacheConcurrencyStrategy()
-
applyCacheSettings
protected final void applyCacheSettings(org.hibernate.boot.Metadata metadata)
-
afterMetadataBuilt
protected void afterMetadataBuilt(org.hibernate.boot.Metadata metadata)
-
configureSessionFactoryBuilder
protected void configureSessionFactoryBuilder(org.hibernate.boot.SessionFactoryBuilder sfb)
-
afterSessionFactoryBuilt
protected void afterSessionFactoryBuilt(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
-
shutDown
protected void shutDown()
-
releaseResources
protected void releaseResources()
-
onFailure
public void onFailure()
-
rebuildSessionFactoryOnError
protected boolean rebuildSessionFactoryOnError()
-
isCleanupTestDataRequired
protected boolean isCleanupTestDataRequired()
-
assertAllDataRemoved
protected void assertAllDataRemoved()
-
inSession
public void inSession(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
-
inStatelessSession
public void inStatelessSession(Consumer<org.hibernate.StatelessSession> action)
-
fromSession
public <R> R fromSession(Function<org.hibernate.engine.spi.SessionImplementor,R> action)
-
inTransaction
public void inTransaction(Consumer<org.hibernate.engine.spi.SessionImplementor> action)
-
inStatelessTransaction
public void inStatelessTransaction(Consumer<org.hibernate.StatelessSession> action)
-
fromTransaction
public <R> R fromTransaction(Function<org.hibernate.engine.spi.SessionImplementor,R> action)
-
-