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 classBaseNonConfigCoreFunctionalTestCase.RollbackWork
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.Class[]NO_CLASSESprotected static java.lang.String[]NO_MAPPINGSstatic java.lang.StringVALIDATE_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 voidaddSettings(java.util.Map settings)protected voidafterBootstrapServiceRegistryBuilt(org.hibernate.boot.registry.BootstrapServiceRegistry bsr)Hook to allow tests to use the BootstrapServiceRegistry if they wishprotected voidafterMetadataBuilt(org.hibernate.boot.Metadata metadata)protected voidafterMetadataSourcesApplied(org.hibernate.boot.MetadataSources metadataSources)protected voidafterSessionFactoryBuilt(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)protected voidafterStandardServiceRegistryBuilt(org.hibernate.boot.registry.StandardServiceRegistry ssr)Hook to allow tests to use the StandardServiceRegistry if they wishvoidafterTest()protected voidapplyCacheSettings(org.hibernate.boot.Metadata metadata)protected voidapplyMetadataSources(org.hibernate.boot.MetadataSources sources)protected voidassertAllDataRemoved()voidbeforeTest()protected voidbuildResources()protected voidcleanupCache()protected voidcleanupTest()protected voidcleanupTestData()protected voidconfigureBootstrapServiceRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb)Apply any desired config to the BootstrapServiceRegistryBuilder to be incorporated into the built BootstrapServiceRegistryprotected voidconfigureMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder)protected voidconfigureSessionFactoryBuilder(org.hibernate.boot.SessionFactoryBuilder sfb)protected voidconfigureStandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrb)Apply any desired config to the StandardServiceRegistryBuilder to be incorporated into the built StandardServiceRegistryprotected org.hibernate.boot.registry.StandardServiceRegistryBuilderconstructStandardServiceRegistryBuilder()protected booleancreateSchema()protected java.lang.StringcreateSecondSchema()<R> RfromSession(java.util.function.Function<org.hibernate.engine.spi.SessionImplementor,R> action)<R> RfromTransaction(java.util.function.Function<org.hibernate.engine.spi.SessionImplementor,R> action)protected java.lang.Class[]getAnnotatedClasses()protected java.lang.String[]getAnnotatedPackages()protected java.lang.StringgetBaseForMappings()protected java.lang.StringgetCacheConcurrencyStrategy()protected org.hibernate.dialect.DialectgetDialect()protected java.lang.String[]getMappings()protected org.hibernate.SessiongetSession()protected java.lang.String[]getXmlFiles()protected voidinitialize(org.hibernate.boot.MetadataBuilder metadataBuilder)voidinSession(java.util.function.Consumer<org.hibernate.engine.spi.SessionImplementor> action)voidinStatelessSession(java.util.function.Consumer<org.hibernate.StatelessSession> action)voidinStatelessTransaction(java.util.function.Consumer<org.hibernate.StatelessSession> action)voidinTransaction(java.util.function.Consumer<org.hibernate.engine.spi.SessionImplementor> action)protected booleanisCleanupTestDataRequired()protected org.hibernate.boot.spi.MetadataImplementormetadata()voidonFailure()protected org.hibernate.SessionopenSession()protected org.hibernate.SessionopenSession(org.hibernate.Interceptor interceptor)protected booleanoverrideCacheStrategy()protected voidprepareTest()protected voidrebuildSessionFactory()protected booleanrebuildSessionFactoryOnError()protected voidreleaseResources()protected org.hibernate.boot.registry.StandardServiceRegistryserviceRegistry()protected org.hibernate.engine.spi.SessionFactoryImplementorsessionFactory()protected voidshutDown()protected voidstartUp()-
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 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(java.util.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 java.lang.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 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(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 java.lang.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()
-
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<org.hibernate.engine.spi.SessionImplementor> action)
-
inStatelessSession
public void inStatelessSession(java.util.function.Consumer<org.hibernate.StatelessSession> action)
-
fromSession
public <R> R fromSession(java.util.function.Function<org.hibernate.engine.spi.SessionImplementor,R> action)
-
inTransaction
public void inTransaction(java.util.function.Consumer<org.hibernate.engine.spi.SessionImplementor> action)
-
inStatelessTransaction
public void inStatelessTransaction(java.util.function.Consumer<org.hibernate.StatelessSession> action)
-
fromTransaction
public <R> R fromTransaction(java.util.function.Function<org.hibernate.engine.spi.SessionImplementor,R> action)
-
-