Skip to content

Commit

Permalink
add latest updates from 6.2.22 to hibernate test files
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchung-bitquill committed Feb 14, 2024
1 parent 8d1b11a commit bba12f0
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 117 deletions.
1 change: 1 addition & 0 deletions wrapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins {
id("com.github.vlsi.gradle-extensions")
id("com.github.vlsi.ide")
id("com.kncept.junit.reporter")
id("org.checkerframework") version "0.6.34"
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions wrapper/src/test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent.*

plugins {
java
id("org.checkerframework") version "0.6.34"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class TestEnvironment implements AutoCloseable {
private static final String PROXIED_DOMAIN_NAME_SUFFIX = ".proxied";
protected static final int PROXY_CONTROL_PORT = 8474;
protected static final int PROXY_PORT = 8666;
private static final String HIBERNATE_VERSION = "6.2.0.CR2";
private static final String HIBERNATE_VERSION = "6.2.22";

private static final TestEnvironmentConfiguration config = new TestEnvironmentConfiguration();
private static final boolean USE_OTLP_CONTAINER_FOR_TRACES = true;
Expand Down
81 changes: 72 additions & 9 deletions wrapper/src/test/resources/hibernate_files/databases.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ext {
db = project.hasProperty('db') ? project.getProperty('db') : 'h2'
dbHost = System.getProperty( 'dbHost', 'localhost' )
dbService = System.getProperty( 'dbService', '' )
runID = System.getProperty( 'runID', '' )
dbUser = System.getProperty( 'dbUser', 'hibernate_orm_test' )
dbPass = System.getProperty( 'dbPass', 'hibernate_orm_test' )
dbName = System.getProperty( 'dbName', 'hibernate_orm_test' )
Expand All @@ -37,8 +38,9 @@ ext {
'jdbc.driver': 'org.h2.Driver',
'jdbc.user' : 'sa',
'jdbc.pass' : '',
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000',
'connection.init_sql' : ''
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE',
'connection.init_sql' : '',
'hibernate.dialect.native_param_markers' : 'true'
],
hsqldb : [
'db.dialect' : 'org.hibernate.dialect.HSQLDialect',
Expand All @@ -53,15 +55,15 @@ ext {
'jdbc.driver': 'org.apache.derby.iapi.jdbc.AutoloadedDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:derby:target/tmp/derby/hibernate_orm_test;databaseName=hibernate_orm_test;create=true',
'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true',
'connection.init_sql' : ''
],
derby_old : [
'db.dialect' : 'org.hibernate.dialect.DerbyDialect',
'jdbc.driver': 'org.apache.derby.jdbc.EmbeddedDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:derby:target/tmp/derby/hibernate_orm_test;databaseName=hibernate_orm_test;create=true',
'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true',
'connection.init_sql' : ''
],
pgsql : [
Expand Down Expand Up @@ -97,9 +99,18 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching to avoid issues with changing schemas
'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':5000/hibernate_orm_test;maxStatements=0;cacheMetaData=false',
'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':9000/hibernate_orm_test;maxStatements=0;cacheMetaData=false',
'connection.init_sql' : 'set ansinull on'
],
sybase_jconn_ci : [
'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect',
'jdbc.driver': 'com.sybase.jdbc4.jdbc.SybDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching to avoid issues with changing schemas
'jdbc.url' : 'jdbc:sybase:Tds:' + dbHost + ':9000/hibernate_orm_test',
'connection.init_sql' : 'set ansinull on set quoted_identifier on'
],
mysql : [
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
Expand Down Expand Up @@ -137,7 +148,7 @@ ext {
'jdbc.driver': 'com.mysql.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + ':4000/hibernate_orm_test',
'connection.init_sql' : ''
],
oracle : [
Expand All @@ -149,6 +160,14 @@ ext {
'connection.init_sql' : ''
],
oracle_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1',
'connection.init_sql' : ''
],
oracle_xe_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
Expand All @@ -168,13 +187,49 @@ ext {
oracle_cloud_autonomous_tls : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_19_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))?oracle.jdbc.enableQueryResultCache=false&oracle.jdbc.thinForceDNSLoadBalancing=true&tcp.nodelay=yes',
'connection.init_sql' : ''
],
oracle_cloud_db19c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_19_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_low.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : ''
],
oracle_cloud_db21c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_21_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : ''
],
oracle_cloud_db23c : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test_' + runID,
'jdbc.pass' : 'Oracle_23_Password',
// Requires dbHost (pointing to the right cloud region) AND dbService (unique database name).
//
// To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation:
// https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService,
'connection.init_sql' : ''
],
mssql : [
Expand Down Expand Up @@ -256,6 +311,14 @@ ext {
'jdbc.url' : 'jdbc:firebirdsql://' + dbHost +'/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5',
'connection.init_sql' : ''
],
altibase : [
'db.dialect' : 'org.hibernate.community.dialect.AltibaseDialect',
'jdbc.driver': 'Altibase.jdbc.driver.AltibaseDriver',
'jdbc.user' : 'sys',
'jdbc.pass' : 'manager',
'connection.init_sql' : '',
'jdbc.url' : 'jdbc:Altibase://' + dbHost + ':20300/mydb?force_clob_bind=true'
],
]
}

Expand All @@ -266,7 +329,7 @@ if ( processTestResourcesTask != null ) {
processTestResourcesTask.inputs.property( 'dbHost', dbHost )
// processTestResourcesTask.inputs.property( "gradle.libs.versions.h2", project.getProperty( "gradle.libs.versions.h2", "2.1.214" ) )
// processTestResourcesTask.inputs.property( "gradle.libs.versions.h2gis", project.getProperty( "gradle.libs.versions.h2gis", "2.1.0" ) )
// processTestResourcesTask.inputs.property( "gradle.libs.versions.hsqldb", project.getProperty( "gradle.libs.versions.hsqldb", "2.7.1" ) )
// processTestResourcesTask.inputs.property( "gradle.libs.versions.hsqldb", project.getProperty( "gradle.libs.versions.hsqldb", "2.7.2" ) )
// processTestResourcesTask.inputs.property( "gradle.libs.versions.derby", project.getProperty( "gradle.libs.versions.derby", "10.15.2.0" ) )
processTestResourcesTask.filter( ReplaceTokens, tokens: dbBundle[db] )
}
39 changes: 25 additions & 14 deletions wrapper/src/test/resources/hibernate_files/hibernate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ plugins {
id 'org.hibernate.build.xjc-jakarta'
}

repositories {
gradlePluginPortal()
}

description = 'Hibernate\'s core ORM functionality'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply plugin: 'org.hibernate.orm.antlr'
apply plugin: 'org.hibernate.matrix-test'


configurations {
tests {
description = 'Configuration for the produced test jar'
Expand Down Expand Up @@ -45,6 +48,7 @@ dependencies {
compileOnly jakartaLibs.jsonbApi
compileOnly libs.jackson
compileOnly libs.jacksonXml
compileOnly dbLibs.postgresql

testImplementation project(':hibernate-testing')
testImplementation project(':hibernate-ant')
Expand All @@ -62,14 +66,15 @@ dependencies {
}
testImplementation "joda-time:joda-time:2.3"
testImplementation files('/app/libs/aws-advanced-jdbc-wrapper-2.3.3.jar')
testImplementation dbLibs.postgresql
testImplementation dbLibs.mysql
testImplementation dbLibs.h2

testRuntimeOnly libs.byteBuddy
testRuntimeOnly testLibs.weld
testRuntimeOnly testLibs.wildFlyTxnClient
testRuntimeOnly jakartaLibs.jsonb
testRuntimeOnly libs.jackson
testRuntimeOnly libs.jacksonXml
testRuntimeOnly libs.jacksonJsr310

testAnnotationProcessor project( ':hibernate-jpamodelgen' )

Expand Down Expand Up @@ -105,10 +110,8 @@ sourceSets {
}
}

// resources inherently exclude sources
test {
resources {
srcDir 'src/test/java'
srcDir 'src/test/resources'
srcDir 'src/test/bundles'
}
Expand Down Expand Up @@ -240,13 +243,16 @@ tasks.withType( Test.class ).each { test ->
test.jvmArgs( ['--add-opens', 'java.base/java.security=ALL-UNNAMED'] )
test.jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )

//Avoid Log4J2 classloader leaks:
test.jvmArgs( ['-Dlog4j2.disableJmx=true'] )

test.beforeTest { descriptor ->
//println "Starting test: " + descriptor
}
}

// Tests with records
if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolchainEnabled ) {
if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {

// Add a new source set, which contains tests that can run on JDK17+
sourceSets {
Expand All @@ -256,15 +262,15 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
}
// Refer to the main test resources to avoid processing variables twice
resources {
srcDir 'target/resources/test'
srcDirs tasks.processTestResources
}
}
}

// For the new source set, we need to configure the source and target version to 17
compileTestJava17Java {
javaCompiler = javaToolchains.compilerFor {
languageVersion = gradle.ext.javaVersions.test.compiler
languageVersion = jdkVersions.test.compiler
}
sourceCompatibility = 17
targetCompatibility = 17
Expand All @@ -275,6 +281,7 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
// The source set gets a custom configuration which extends the normal test implementation config
configurations {
testJava17Implementation.extendsFrom(testImplementation, testRuntimeOnly)
testJava17CompileOnly.extendsFrom(testCompileOnly)
}

// Add the output from src/main/java as dependency
Expand All @@ -287,14 +294,14 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
// We execute the Java 17 tests in a custom test task
task testJava17(type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = gradle.ext.javaVersions.test.launcher
languageVersion = jdkVersions.test.launcher
}
useJUnitPlatform()
testClassesDirs = sourceSets.testJava17.output.classesDirs
classpath = sourceSets.testJava17.runtimeClasspath

if ( gradle.ext.javaVersions.test.launcher.asInt() >= 19 ) {
logger.warn( "The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
if ( jdkVersions.test.launcher.asInt() >= 19 ) {
logger.warn( "The version of Java bytecode that will be tested is not supported by Byte Buddy by default. " +
" Setting 'net.bytebuddy.experimental=true'." )
systemProperty 'net.bytebuddy.experimental', true
}
Expand All @@ -305,9 +312,13 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 && gradle.ext.javaToolch
check.dependsOn testJava17
}

javadoc {
tasks.named( "javadoc", Javadoc ) {
configure(options) {
overview = 'src/main/javadoc/overview.html'
stylesheetFile = new File(projectDir, 'src/main/javadoc/stylesheet.css')
overview = rootProject.file( "shared/javadoc/overview.html" )
}
}

tasks.sourcesJar.dependsOn ':hibernate-core:generateGraphParser'
tasks.sourcesJar.dependsOn ':hibernate-core:generateHqlParser'
tasks.sourcesJar.dependsOn ':hibernate-core:generateSqlScriptParser'
tasks.sourcesJar.dependsOn ':hibernate-core:generateOrderingParser'
Loading

0 comments on commit bba12f0

Please sign in to comment.