Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 157 additions & 19 deletions docker_db.sh

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion hibernate-core/hibernate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ tasks.withType( Test.class ).each { test ->
test.jvmArgs( ['-Dlog4j2.disableJmx=true'] )

// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" ) {
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
|| project.db == "db2_ci" || project.db == "mssql_ci" ) {
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
def threadCount = Runtime.runtime.availableProcessors()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static org.hibernate.testing.jdbc.GradleParallelTestingResolver.resolveUrl;
import static org.hibernate.testing.jdbc.GradleParallelTestingResolver.resolveUsername;

/**
* @author Nathan Xu
*/
Expand Down Expand Up @@ -80,8 +83,8 @@ public static void tearDownDBs() throws SQLException {
}

private static Connection getConnection() throws SQLException {
String url = Environment.getProperties().getProperty( Environment.URL );
String user = Environment.getProperties().getProperty( Environment.USER );
String url = resolveUrl( Environment.getProperties().getProperty( Environment.URL ) );
String user = resolveUsername( Environment.getProperties().getProperty( Environment.USER ) );
String password = Environment.getProperties().getProperty( Environment.PASS );
return DriverManager.getConnection( url, user, password );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hibernate.testing.jdbc.GradleParallelTestingResolver.resolveUsername;

/**
* @author Andrea Boriero
Expand All @@ -52,7 +53,7 @@ public void shouldCreateIndex() {
public void setUp() {
serviceRegistry = ServiceRegistryUtil.serviceRegistryBuilder()
.applySetting( Environment.DEFAULT_SCHEMA, "dbo" )
.applySetting( Environment.DEFAULT_CATALOG, "hibernate_orm_test" )
.applySetting( Environment.DEFAULT_CATALOG, resolveUsername( "hibernate_orm_test_$worker" ) )
.build();
metadata = (MetadataImplementor) new MetadataSources( serviceRegistry )
.addAnnotatedClass( MyEntity.class )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.hibernate.tool.schema.TargetType;
import org.junit.Test;

import static org.hibernate.testing.jdbc.GradleParallelTestingResolver.resolveUsername;

/**
* @author Chris Cranford
*/
Expand All @@ -41,7 +43,7 @@ public class JoinTableWithDefaultSchemaTest extends BaseUnitTestCase {
@RequiresDialect(SQLServerDialect.class)
public void testGetTableDataForJoinTableWithDefaultSchema() {
StandardServiceRegistry ssr = ServiceRegistryUtil.serviceRegistryBuilder()
.applySetting( AvailableSettings.DEFAULT_CATALOG, "hibernate_orm_test" )
.applySetting( AvailableSettings.DEFAULT_CATALOG, resolveUsername( "hibernate_orm_test_$worker" ) )
.build();
try {
final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr )
Expand Down
4 changes: 3 additions & 1 deletion hibernate-envers/hibernate-envers.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ configurations {

tasks.withType( Test.class ).each { test ->
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" ) {
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
|| project.db == "db2_ci" || project.db == "mssql_ci" ) {
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
def threadCount = Runtime.runtime.availableProcessors()
Expand Down
14 changes: 7 additions & 7 deletions local-build-plugins/src/main/groovy/local.databases.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:edb://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
'jdbc.url' : 'jdbc:edb://' + dbHost + '/hibernate_orm_test_$worker?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
'jdbc.datasource' : 'com.edb.Driver',
// 'jdbc.datasource' : 'com.edb.ds.PGSimpleDataSource',
'connection.init_sql' : ''
Expand Down Expand Up @@ -145,7 +145,7 @@ ext {
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test_$worker?allowPublicKeyRetrieval=true',
'jdbc.datasource' : 'com.mysql.jdbc.Driver',
// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource',
'connection.init_sql' : ''
Expand All @@ -165,7 +165,7 @@ ext {
'jdbc.driver': 'org.mariadb.jdbc.Driver',
'jdbc.user' : 'root',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test_$worker',
'jdbc.datasource' : 'org.mariadb.jdbc.Driver',
// 'jdbc.datasource' : 'org.mariadb.jdbc.MariaDbDataSource',
'connection.init_sql' : ''
Expand Down Expand Up @@ -193,7 +193,7 @@ ext {
oracle_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.user' : 'hibernate_orm_test_$worker',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1',
'jdbc.datasource' : 'oracle.jdbc.OracleDriver',
Expand All @@ -203,7 +203,7 @@ ext {
oracle_xe_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.user' : 'hibernate_orm_test_$worker',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1',
'jdbc.datasource' : 'oracle.jdbc.OracleDriver',
Expand Down Expand Up @@ -314,7 +314,7 @@ ext {
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
'jdbc.user' : 'sa',
'jdbc.pass' : 'Hibernate_orm_test',
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test;sendTimeAsDatetime=false;trustServerCertificate=true',
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test_$worker;sendTimeAsDatetime=false;trustServerCertificate=true',
'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
// 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDataSource',
'connection.init_sql' : ''
Expand All @@ -334,7 +334,7 @@ ext {
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
'jdbc.user' : 'orm_test',
'jdbc.pass' : 'orm_test',
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test',
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test:specialRegisters=TENANT=\'ORM_$worker\';',
'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver',
// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource',
'connection.init_sql' : ''
Expand Down
2 changes: 0 additions & 2 deletions local-build-plugins/src/main/groovy/local.java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ processTestResources {
tasks.withType( Test.class ).each { test ->
test.useJUnitPlatform()

test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service )

// Byteman needs this property to be set, https://developer.jboss.org/thread/274997
test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ public void apply(Project project) {
DatabaseService.class,
spec -> spec.getMaxParallelUsages().set( 1 )
);
final String database = (String) project.getProperties().get( "db" );

project.getTasks().withType( Test.class ).forEach(
test -> test.usesService( databaseServiceProvider )
);
// H2 and HSQLDB are in-memory, so there is no sharing that needs to be avoided
if ( database != null && !"h2".equals( database ) && !"hsqldb".equals( database ) ) {
project.getTasks().withType( Test.class ).forEach(
test -> test.usesService( databaseServiceProvider )
);
}
}
}