246 lines
15 KiB
Groovy
246 lines
15 KiB
Groovy
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
/*
|
|
* 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 {
|
|
db = project.hasProperty('db') ? project.getProperty('db') : 'h2'
|
|
def dbHost = System.getProperty( 'dbHost', 'localhost' )
|
|
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'
|
|
],
|
|
derby : [
|
|
'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'
|
|
],
|
|
pgsql : [
|
|
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
|
|
'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'
|
|
],
|
|
pgsql_docker : [
|
|
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
|
|
'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://127.0.0.1/hibernate_orm_test?preparedStatementCacheQueries=0'
|
|
],
|
|
pgsql_ci : [
|
|
'db.dialect' : 'org.hibernate.dialect.PostgreSQL95Dialect',
|
|
'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'
|
|
],
|
|
pgsql_ci : [
|
|
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
|
|
'jdbc.driver': 'org.postgresql.Driver',
|
|
'jdbc.user' : 'hibernate_orm_test',
|
|
'jdbc.pass' : 'hibernate_orm_test',
|
|
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test'
|
|
],
|
|
mysql : [
|
|
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
|
|
'jdbc.driver': 'com.mysql.jdbc.Driver',
|
|
'jdbc.user' : 'hibernateormtest',
|
|
'jdbc.pass' : 'hibernateormtest',
|
|
'jdbc.url' : 'jdbc:mysql://localhost/hibernate_orm_test'
|
|
],
|
|
mysql_docker : [
|
|
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
|
|
'jdbc.driver': 'com.mysql.jdbc.Driver',
|
|
'jdbc.user' : 'hibernate_orm_test',
|
|
'jdbc.pass' : 'hibernate_orm_test',
|
|
'jdbc.url' : 'jdbc:mysql://127.0.0.1/hibernate_orm_test?useSSL=false'
|
|
],
|
|
// 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'
|
|
],
|
|
mariadb : [
|
|
'db.dialect' : 'org.hibernate.dialect.MariaDBDialect',
|
|
'jdbc.driver': 'org.mariadb.jdbc.Driver',
|
|
'jdbc.user' : 'hibernate_orm_test',
|
|
'jdbc.pass' : 'hibernate_orm_test',
|
|
'jdbc.url' : 'jdbc:mariadb://127.0.0.1/hibernate_orm_test'
|
|
],
|
|
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'
|
|
],
|
|
postgis : [
|
|
'db.dialect' : 'org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect',
|
|
'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'
|
|
],
|
|
oracle : [
|
|
'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:@localhost:1521/xe'
|
|
],
|
|
// Use ./docker_db.sh oracle_ee to start the database
|
|
oracle_docker : [
|
|
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
|
|
'jdbc.driver': 'oracle.jdbc.OracleDriver',
|
|
'jdbc.user' : 'c##hibernate_orm_test',
|
|
'jdbc.pass' : 'hibernate_orm_test',
|
|
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/ORCLPDB1.localdomain'
|
|
],
|
|
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'
|
|
],
|
|
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'
|
|
],
|
|
mssql : [
|
|
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect',
|
|
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
|
|
'jdbc.user' : 'hibernate_orm_test',
|
|
'jdbc.pass' : 'hibernate_orm_test',
|
|
'jdbc.url' : 'jdbc:sqlserver://localhost;instance=SQLEXPRESS;databaseName=hibernate_orm_test'
|
|
],
|
|
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'
|
|
],
|
|
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'
|
|
],
|
|
informix : [
|
|
'db.dialect' : 'org.hibernate.dialect.InformixDialect',
|
|
'jdbc.driver': 'com.informix.jdbc.IfxDriver',
|
|
'jdbc.user' : 'informix',
|
|
'jdbc.pass' : 'in4mix',
|
|
'jdbc.url' : 'jdbc:informix-sqli://127.0.0.1:9088/sysuser:INFORMIXSERVER=dev;user=informix;password=in4mix'
|
|
],
|
|
db2 : [
|
|
'db.dialect' : 'org.hibernate.dialect.DB2Dialect',
|
|
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
|
|
'jdbc.user' : 'db2inst1',
|
|
'jdbc.pass' : 'db2inst1-pwd',
|
|
'jdbc.url' : 'jdbc:db2://127.0.0.1:50000/hibern8'
|
|
],
|
|
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'
|
|
],
|
|
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'
|
|
],
|
|
hana : [
|
|
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
|
|
'jdbc.driver': 'com.sap.db.jdbc.Driver',
|
|
'jdbc.user' : 'HIBERNATE_TEST',
|
|
'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://localhost:30015/?statementCacheSize=0'
|
|
],
|
|
hana_cloud : [
|
|
'db.dialect' : 'org.hibernate.dialect.HANACloudColumnStoreDialect',
|
|
'jdbc.driver': 'com.sap.db.jdbc.Driver',
|
|
'jdbc.user' : 'HIBERNATE_TEST',
|
|
'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://localhost:443/?encrypt=true&validateCertificate=false&statementCacheSize=0'
|
|
],
|
|
hana_vlad : [
|
|
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
|
|
'jdbc.driver': 'com.sap.db.jdbc.Driver',
|
|
'jdbc.user' : 'VLAD',
|
|
'jdbc.pass' : 'V1ad_test',
|
|
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
|
|
'jdbc.url' : 'jdbc:sap://localhost:39015/?statementCacheSize=0'
|
|
],
|
|
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'
|
|
],
|
|
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',
|
|
// 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'
|
|
],
|
|
cockroachdb : [
|
|
'db.dialect' : 'org.hibernate.dialect.CockroachDialect',
|
|
// 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
|
|
'jdbc.url' : 'jdbc:postgresql://localhost:26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0'
|
|
],
|
|
]
|
|
}
|
|
|
|
|
|
def processTestResourcesTask = project.tasks.findByName( 'processTestResources' )
|
|
if ( processTestResourcesTask != null ) {
|
|
processTestResourcesTask.inputs.property( 'db', db )
|
|
processTestResourcesTask.filter( ReplaceTokens, tokens: dbBundle[db] )
|
|
} |