2019-05-21 17:29:57 -04:00
import org.apache.tools.ant.filters.ReplaceTokens
2016-03-15 12:23:53 -04:00
/ *
* Hibernate , Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License ( LGPL ) , version 2.1 or later .
* See the lgpl . txt file in the root directory or < http: //www.gnu.org/licenses/lgpl-2.1.html>.
* /
// build a map of the database settings to use.
ext {
2018-01-17 04:12:07 -05:00
db = project . hasProperty ( 'db' ) ? project . getProperty ( 'db' ) : 'h2'
2020-12-17 12:16:09 -05:00
def dbHost = System . getProperty ( 'dbHost' , 'localhost' )
2016-03-15 12:23:53 -04:00
dbBundle = [
h2 : [
'db.dialect' : 'org.hibernate.dialect.H2Dialect' ,
'jdbc.driver' : 'org.h2.Driver' ,
'jdbc.user' : 'sa' ,
'jdbc.pass' : '' ,
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000' ,
] ,
hsqldb : [
'db.dialect' : 'org.hibernate.dialect.HSQLDialect' ,
'jdbc.driver' : 'org.hsqldb.jdbc.JDBCDriver' ,
'jdbc.user' : 'sa' ,
'jdbc.pass' : '' ,
'jdbc.url' : 'jdbc:hsqldb:mem:test'
] ,
2016-05-19 01:47:49 -04:00
derby : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.DerbyDialect' ,
2016-05-19 01:47:49 -04:00
'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'
] ,
2016-03-15 12:23:53 -04:00
pgsql : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect' ,
2016-03-15 12:23:53 -04:00
'jdbc.driver' : 'org.postgresql.Driver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
2016-03-16 10:01:11 -04:00
] ,
2017-09-20 12:02:03 -04:00
pgsql_docker : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect' ,
2017-09-20 12:02:03 -04:00
'jdbc.driver' : 'org.postgresql.Driver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-02-03 04:55:07 -05:00
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
2021-02-03 04:55:07 -05:00
] ,
pgsql_ci : [
2021-03-18 06:16:28 -04:00
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect' ,
2021-02-03 04:55:07 -05:00
'jdbc.driver' : 'org.postgresql.Driver' ,
'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:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
2017-09-20 12:02:03 -04:00
] ,
2016-03-16 10:01:11 -04:00
mysql : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.MySQLDialect' ,
2016-03-16 10:01:11 -04:00
'jdbc.driver' : 'com.mysql.jdbc.Driver' ,
2016-04-22 06:38:47 -04:00
'jdbc.user' : 'hibernateormtest' ,
'jdbc.pass' : 'hibernateormtest' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test'
2016-03-29 12:04:48 -04:00
] ,
2017-09-11 02:57:09 -04:00
mysql_docker : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.MySQLDialect' ,
2017-09-11 02:57:09 -04:00
'jdbc.driver' : 'com.mysql.jdbc.Driver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?useSSL=false'
2017-09-11 02:57:09 -04:00
] ,
2021-02-08 17:33:03 -05:00
// uses docker mysql_8_0
mysql8_spatial_ci: [
'db.dialect' : 'org.hibernate.spatial.dialect.mysql.MySQL8SpatialDialect' ,
'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&useSSL=false'
] ,
2016-03-29 12:04:48 -04:00
mariadb : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.MariaDBDialect' ,
2016-03-29 12:04:48 -04:00
'jdbc.driver' : 'org.mariadb.jdbc.Driver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
2016-04-17 09:58:15 -04:00
] ,
2020-12-17 12:16:09 -05:00
mariadb_ci : [
'db.dialect' : 'org.hibernate.dialect.MariaDBDialect' ,
'jdbc.driver' : 'org.mariadb.jdbc.Driver' ,
'jdbc.user' : 'root' ,
'jdbc.pass' : 'hibernate_orm_test' ,
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
] ,
2021-03-17 16:53:53 -04:00
mariadb_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.mariadb.MariaDB103SpatialDialect' ,
'jdbc.driver' : 'org.mariadb.jdbc.Driver' ,
'jdbc.user' : 'root' ,
'jdbc.pass' : 'hibernate_orm_test' ,
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
] ,
2016-04-17 09:58:15 -04:00
postgis : [
2017-05-23 09:10:00 -04:00
'db.dialect' : 'org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect' ,
2016-04-17 09:58:15 -04:00
'jdbc.driver' : 'org.postgresql.Driver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
2016-04-17 09:58:15 -04:00
] ,
2016-04-24 23:44:04 -04:00
oracle : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.OracleDialect' ,
2020-10-26 07:54:07 -04:00
'jdbc.driver' : 'oracle.jdbc.OracleDriver' ,
2016-04-24 23:44:04 -04:00
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xe'
2016-04-24 23:44:04 -04:00
] ,
2021-02-09 07:03:18 -05:00
// Use ./docker_db.sh oracle_ee to start the database
2020-10-26 13:12:35 -04:00
oracle_docker : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.OracleDialect' ,
2020-10-26 13:12:35 -04:00
'jdbc.driver' : 'oracle.jdbc.OracleDriver' ,
2021-02-09 07:03:18 -05:00
'jdbc.user' : 'c##hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/ORCLPDB1.localdomain'
2020-10-26 13:12:35 -04:00
] ,
2020-12-17 12:16:09 -05:00
oracle_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect' ,
'jdbc.driver' : 'oracle.jdbc.OracleDriver' ,
'jdbc.user' : 'SYSTEM' ,
'jdbc.pass' : 'Oracle18' ,
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE'
] ,
2021-02-11 11:49:28 -05:00
oracle_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect' ,
'jdbc.driver' : 'oracle.jdbc.OracleDriver' ,
'jdbc.user' : 'SYSTEM' ,
'jdbc.pass' : 'Oracle18' ,
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE'
] ,
2016-04-24 23:44:04 -04:00
mssql : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect' ,
2016-04-24 23:44:04 -04:00
'jdbc.driver' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver' ,
'jdbc.user' : 'hibernate_orm_test' ,
'jdbc.pass' : 'hibernate_orm_test' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';instance=SQLEXPRESS;databaseName=hibernate_orm_test'
2016-06-14 03:29:27 -04:00
] ,
2020-12-17 12:16:09 -05:00
mssql_ci : [
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect' ,
'jdbc.driver' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver' ,
'jdbc.user' : 'sa' ,
'jdbc.pass' : 'Hibernate_orm_test' ,
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test'
] ,
2021-02-11 11:49:28 -05:00
mssql_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.sqlserver.SqlServer2012SpatialDialect' ,
'jdbc.driver' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver' ,
'jdbc.user' : 'sa' ,
'jdbc.pass' : 'Hibernate_orm_test' ,
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test'
] ,
2016-06-14 03:29:27 -04:00
informix : [
'db.dialect' : 'org.hibernate.dialect.InformixDialect' ,
'jdbc.driver' : 'com.informix.jdbc.IfxDriver' ,
'jdbc.user' : 'informix' ,
'jdbc.pass' : 'in4mix' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/sysuser:INFORMIXSERVER=dev;user=informix;password=in4mix'
2017-05-08 04:56:35 -04:00
] ,
db2 : [
'db.dialect' : 'org.hibernate.dialect.DB2Dialect' ,
'jdbc.driver' : 'com.ibm.db2.jcc.DB2Driver' ,
'jdbc.user' : 'db2inst1' ,
'jdbc.pass' : 'db2inst1-pwd' ,
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/hibern8'
2017-09-14 06:03:41 -04:00
] ,
2020-12-17 12:16:09 -05:00
db2_ci : [
'db.dialect' : 'org.hibernate.dialect.DB2Dialect' ,
'jdbc.driver' : 'com.ibm.db2.jcc.DB2Driver' ,
'jdbc.user' : 'orm_test' ,
'jdbc.pass' : 'orm_test' ,
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test'
] ,
2021-02-11 14:13:09 -05:00
db2_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.db2.DB2SpatialDialect' ,
'jdbc.driver' : 'com.ibm.db2.jcc.DB2Driver' ,
'jdbc.user' : 'orm_test' ,
'jdbc.pass' : 'orm_test' ,
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test'
] ,
2017-09-14 06:03:41 -04:00
hana : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'HIBERNATE_TEST' ,
'jdbc.pass' : 'H1bernate_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:sap://' + dbHost + ':30015/?statementCacheSize=0'
2018-01-22 08:32:48 -05:00
] ,
2020-03-27 12:08:28 -04:00
hana_cloud : [
'db.dialect' : 'org.hibernate.dialect.HANACloudColumnStoreDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'HIBERNATE_TEST' ,
'jdbc.pass' : 'H1bernate_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:sap://' + dbHost + ':443/?encrypt=true&validateCertificate=false&statementCacheSize=0'
2020-03-27 12:08:28 -04:00
] ,
2018-01-22 08:32:48 -05:00
hana_vlad : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'VLAD' ,
'jdbc.pass' : 'V1ad_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39015/?statementCacheSize=0'
2021-02-09 07:03:18 -05:00
] ,
hana_docker : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'SYSTEM' ,
'jdbc.pass' : 'H1bernate_test' ,
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
2021-02-11 14:13:09 -05:00
] ,
2021-04-06 08:24:13 -04:00
hana_ci : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'SYSTEM' ,
'jdbc.pass' : 'H1bernate_test' ,
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
] ,
2021-02-11 14:13:09 -05:00
hana_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.hana.HANASpatialDialect' ,
'jdbc.driver' : 'com.sap.db.jdbc.Driver' ,
'jdbc.user' : 'SYSTEM' ,
'jdbc.pass' : 'H1bernate_test' ,
2021-02-09 07:03:18 -05:00
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
2019-11-11 14:29:30 -05:00
] ,
cockroachdb : [
2020-12-17 12:16:09 -05:00
'db.dialect' : 'org.hibernate.dialect.CockroachDialect' ,
2019-11-11 14:29:30 -05:00
// CockroachDB uses the same pgwire protocol as PostgreSQL, so the driver is the same.
'jdbc.driver' : 'org.postgresql.Driver' ,
'jdbc.user' : 'root' ,
'jdbc.pass' : '' ,
2021-02-03 04:55:07 -05:00
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
2021-04-06 08:24:13 -04:00
'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0'
2019-11-11 14:29:30 -05:00
] ,
2021-03-16 18:18:08 -04:00
cockroachdb_spatial : [
'db.dialect' : 'org.hibernate.spatial.dialect.cockroachdb.CockroachDB202SpatialDialect' ,
// CockroachDB uses the same pgwire protocol as PostgreSQL, so the driver is the same.
'jdbc.driver' : 'org.postgresql.Driver' ,
'jdbc.user' : 'root' ,
'jdbc.pass' : '' ,
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
2021-04-07 03:19:21 -04:00
'jdbc.url' : 'jdbc:postgresql://' + dbHost + 'localhost:26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0'
2021-03-08 08:27:11 -05:00
] ,
firebird : [
'db.dialect' : 'org.hibernate.dialect.FirebirdDialect' ,
'jdbc.driver' : 'org.firebirdsql.jdbc.FBDriver' ,
'jdbc.user' : 'sysdba' ,
'jdbc.pass' : 'masterkey' ,
// Overriding default transaction definition (5 seconds instead of infinite wait) to prevent problems in test cleanup
// Expects alias 'hibernate_orm_test' in aliases.conf (FB2.5 and earlier) or databases.conf (FB3.0 and later)
// Created database must either use default character set NONE, or UTF8 with page size 16384 or higher (to prevent issues with indexes due to keysize)
2021-04-07 03:19:21 -04:00
'jdbc.url' : 'jdbc:firebirdsql://' + dbHost + 'localhost/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5'
2021-03-08 08:27:11 -05:00
] ,
2016-03-15 12:23:53 -04:00
]
}
2019-05-21 17:29:57 -04:00
def processTestResourcesTask = project . tasks . findByName ( 'processTestResources' )
if ( processTestResourcesTask ! = null ) {
processTestResourcesTask . inputs . property ( 'db' , db )
processTestResourcesTask . filter ( ReplaceTokens , tokens: dbBundle [ db ] )
}