HHH-7185 - run envers tests on db matrix
This commit is contained in:
parent
ecd8ad5446
commit
5822404c6d
|
@ -83,18 +83,13 @@ public abstract class AbstractEntityTest extends AbstractEnversTest {
|
|||
this.audited = audited;
|
||||
|
||||
Properties configurationProperties = new Properties();
|
||||
configurationProperties.putAll( Environment.getProperties() );
|
||||
if (!audited) {
|
||||
configurationProperties.setProperty(EnversIntegrator.AUTO_REGISTER, "false");
|
||||
}
|
||||
|
||||
configurationProperties.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
|
||||
configurationProperties.setProperty(Environment.DIALECT, "org.hibernate.dialect.H2Dialect");
|
||||
configurationProperties.setProperty(Environment.DRIVER, "org.h2.Driver");
|
||||
configurationProperties.setProperty(Environment.USER, "sa");
|
||||
|
||||
// Separate database for each test class
|
||||
configurationProperties.setProperty(Environment.URL, "jdbc:h2:mem:" + this.getClass().getName() + ";DB_CLOSE_DELAY=-1");
|
||||
|
||||
if ( createSchema() ) {
|
||||
configurationProperties.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
|
||||
}
|
||||
if (auditStrategy != null && !"".equals(auditStrategy)) {
|
||||
configurationProperties.setProperty("org.hibernate.envers.audit_strategy", auditStrategy);
|
||||
}
|
||||
|
@ -111,6 +106,9 @@ public abstract class AbstractEntityTest extends AbstractEnversTest {
|
|||
|
||||
newEntityManager();
|
||||
}
|
||||
protected boolean createSchema() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BootstrapServiceRegistryBuilder createBootstrapRegistryBuilder() {
|
||||
return new BootstrapServiceRegistryBuilder();
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.envers.AuditReader;
|
||||
import org.hibernate.envers.AuditReaderFactory;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
@ -35,9 +36,9 @@ public abstract class AbstractSessionTest extends AbstractEnversTest {
|
|||
@BeforeClassOnce
|
||||
public void init() throws URISyntaxException {
|
||||
config = new Configuration();
|
||||
URL url = Thread.currentThread().getContextClassLoader().getResource(getHibernateConfigurationFileName());
|
||||
config.configure(new File(url.toURI()));
|
||||
|
||||
if ( createSchema() ) {
|
||||
config.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
|
||||
}
|
||||
String auditStrategy = getAuditStrategy();
|
||||
if (auditStrategy != null && !"".equals(auditStrategy)) {
|
||||
config.setProperty("org.hibernate.envers.audit_strategy", auditStrategy);
|
||||
|
@ -48,19 +49,15 @@ public abstract class AbstractSessionTest extends AbstractEnversTest {
|
|||
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( config.getProperties() );
|
||||
sessionFactory = config.buildSessionFactory( serviceRegistry );
|
||||
}
|
||||
|
||||
protected abstract void initMappings() throws MappingException, URISyntaxException ;
|
||||
|
||||
protected String getHibernateConfigurationFileName(){
|
||||
return "hibernate.test.session-cfg.xml";
|
||||
protected boolean createSchema() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void initMappings() throws MappingException, URISyntaxException ;
|
||||
|
||||
private SessionFactory getSessionFactory(){
|
||||
return sessionFactory;
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void newSessionFactory() {
|
||||
session = getSessionFactory().openSession();
|
||||
|
|
|
@ -84,9 +84,6 @@ public class EnversRunner extends Suite {
|
|||
return getPriority(fm2) - getPriority(fm1);
|
||||
}
|
||||
});
|
||||
for(FrameworkMethod method: computedTestMethods){
|
||||
System.out.println(method.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,19 @@
|
|||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301 USA
|
||||
#
|
||||
hibernate.dialect org.hibernate.dialect.H2Dialect
|
||||
hibernate.connection.driver_class org.h2.Driver
|
||||
hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
|
||||
hibernate.connection.username sa
|
||||
|
||||
# The CustomTestRunner needs this to instantiate a dialect
|
||||
hibernate.connection.pool_size 5
|
||||
|
||||
hibernate.dialect org.hibernate.dialect.H2Dialect
|
||||
hibernate.show_sql false
|
||||
|
||||
hibernate.max_fetch_depth 5
|
||||
|
||||
hibernate.cache.region_prefix hibernate.test
|
||||
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
||||
|
||||
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
|
||||
hibernate.jdbc.batch_versioned_data true
|
||||
|
|
Loading…
Reference in New Issue