Package org.hibernate.testing.orm.junit
Class BaseSessionFactoryFunctionalTest
java.lang.Object
org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest
- All Implemented Interfaces:
DomainModelProducer,DomainModelScopeAware,ServiceRegistryProducer,ServiceRegistryScopeAware,SessionFactoryProducer,SessionFactoryScopeAware
public abstract class BaseSessionFactoryFunctionalTest
extends Object
implements ServiceRegistryProducer, ServiceRegistryScopeAware, DomainModelProducer, DomainModelScopeAware, SessionFactoryProducer, SessionFactoryScopeAware
Template (GoF pattern) based abstract class for tests bridging the legacy
approach of SessionFactory building as a test fixture
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidprotected final voidapplyCacheSettings(org.hibernate.boot.Metadata metadata) protected voidapplyMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder) protected voidapplyMetadataSources(org.hibernate.boot.MetadataSources metadataSources) protected voidapplySettings(org.hibernate.boot.registry.StandardServiceRegistryBuilder builder) protected voidprotected voidconfigure(org.hibernate.boot.SessionFactoryBuilder builder) static voiddoInHibernateSessionBuilder(Supplier<org.hibernate.SessionBuilder> sessionBuilderSupplier, TransactionUtil.HibernateTransactionConsumer function) Execute function in a Hibernate transaction without return valueprotected Future<?>executeAsync(Runnable callable) protected voidexecuteSync(Runnable callable) protected booleanprotected <T> TfromSession(Function<org.hibernate.engine.spi.SessionImplementor, T> action) protected <T> TfromTransaction(Function<org.hibernate.engine.spi.SessionImplementor, T> action) protected Class[]protected Stringprotected org.hibernate.dialect.Dialectprotected org.hibernate.boot.spi.MetadataImplementorprotected String[]voidinjectServiceRegistryScope(ServiceRegistryScope registryScope) voidCallback to inject the SessionFactoryScope into the containervoidinjectTestModelScope(DomainModelScope modelScope) protected voidprotected voidinTransaction(Consumer<org.hibernate.engine.spi.SessionImplementor> action) protected booleanprotected booleanvoidprepareBootstrapRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb) org.hibernate.boot.spi.MetadataImplementorproduceModel(org.hibernate.boot.registry.StandardServiceRegistry serviceRegistry) org.hibernate.boot.registry.StandardServiceRegistryproduceServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrBuilder) org.hibernate.engine.spi.SessionFactoryImplementorproduceSessionFactory(org.hibernate.boot.spi.MetadataImplementor model) protected org.hibernate.engine.spi.SessionFactoryImplementorprotected voidsessionFactoryBuilt(org.hibernate.engine.spi.SessionFactoryImplementor factory) protected SessionFactoryScope
-
Field Details
-
DIALECT
protected static final org.hibernate.dialect.Dialect DIALECT -
NO_CLASSES
-
NO_MAPPINGS
-
-
Constructor Details
-
BaseSessionFactoryFunctionalTest
public BaseSessionFactoryFunctionalTest()
-
-
Method Details
-
sessionFactoryScope
-
sessionFactory
protected org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory() -
getMetadata
protected org.hibernate.boot.spi.MetadataImplementor getMetadata() -
produceServiceRegistry
public org.hibernate.boot.registry.StandardServiceRegistry produceServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistryBuilder ssrBuilder) - Specified by:
produceServiceRegistryin interfaceServiceRegistryProducer
-
prepareBootstrapRegistryBuilder
public void prepareBootstrapRegistryBuilder(org.hibernate.boot.registry.BootstrapServiceRegistryBuilder bsrb) - Specified by:
prepareBootstrapRegistryBuilderin interfaceServiceRegistryProducer
-
exportSchema
protected boolean exportSchema() -
applySettings
protected void applySettings(org.hibernate.boot.registry.StandardServiceRegistryBuilder builder) -
injectServiceRegistryScope
- Specified by:
injectServiceRegistryScopein interfaceServiceRegistryScopeAware
-
produceModel
public org.hibernate.boot.spi.MetadataImplementor produceModel(org.hibernate.boot.registry.StandardServiceRegistry serviceRegistry) - Specified by:
produceModelin interfaceDomainModelProducer
-
applyCacheSettings
protected final void applyCacheSettings(org.hibernate.boot.Metadata metadata) -
overrideCacheStrategy
protected boolean overrideCacheStrategy() -
getCacheConcurrencyStrategy
-
applyMetadataBuilder
protected void applyMetadataBuilder(org.hibernate.boot.MetadataBuilder metadataBuilder) -
applyMetadataSources
protected void applyMetadataSources(org.hibernate.boot.MetadataSources metadataSources) -
getAnnotatedClasses
-
getOrmXmlFiles
-
injectTestModelScope
- Specified by:
injectTestModelScopein interfaceDomainModelScopeAware
-
produceSessionFactory
public org.hibernate.engine.spi.SessionFactoryImplementor produceSessionFactory(org.hibernate.boot.spi.MetadataImplementor model) - Specified by:
produceSessionFactoryin interfaceSessionFactoryProducer
-
configure
protected void configure(org.hibernate.boot.SessionFactoryBuilder builder) -
sessionFactoryBuilt
protected void sessionFactoryBuilt(org.hibernate.engine.spi.SessionFactoryImplementor factory) -
injectSessionFactoryScope
Description copied from interface:SessionFactoryScopeAwareCallback to inject the SessionFactoryScope into the container- Specified by:
injectSessionFactoryScopein interfaceSessionFactoryScopeAware
-
afterTest
@AfterEach public final void afterTest() -
isCleanupTestDataRequired
protected boolean isCleanupTestDataRequired() -
cleanupTestData
protected void cleanupTestData() -
inTransaction
-
fromTransaction
-
inSession
-
fromSession
-
getDialect
protected org.hibernate.dialect.Dialect getDialect() -
executeAsync
-
executeSync
-
doInHibernateSessionBuilder
public static void doInHibernateSessionBuilder(Supplier<org.hibernate.SessionBuilder> sessionBuilderSupplier, TransactionUtil.HibernateTransactionConsumer function) Execute function in a Hibernate transaction without return value- Parameters:
sessionBuilderSupplier- SessionFactory supplierfunction- function
-