Created
May 12, 2021 23:03
-
-
Save Tapac/116d42aa3907f9a55ef87c14d2a8ea27 to your computer and use it in GitHub Desktop.
Exposed DB2 tests patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: exposed-tests/src/main/kotlin/org/jetbrains/exposed/sql/tests/DatabaseTestsBase.kt | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/exposed-tests/src/main/kotlin/org/jetbrains/exposed/sql/tests/DatabaseTestsBase.kt b/exposed-tests/src/main/kotlin/org/jetbrains/exposed/sql/tests/DatabaseTestsBase.kt | |
--- a/exposed-tests/src/main/kotlin/org/jetbrains/exposed/sql/tests/DatabaseTestsBase.kt (revision 3ad3164544e9c2b5cf4b6c53bf01c1b5fb005071) | |
+++ b/exposed-tests/src/main/kotlin/org/jetbrains/exposed/sql/tests/DatabaseTestsBase.kt (date 1620859726351) | |
@@ -92,11 +92,36 @@ | |
), | |
DB2( | |
- { | |
- "jdbc:db2:${System.getProperty("exposed.test.db2.host", "192.168.99.100")}" + | |
- ":${System.getProperty("exposed.test.db2.port", "50000")}" | |
+ connection = { | |
+ "jdbc:db2://${System.getProperty("exposed.test.db2.host", "192.168.99.100")}" + | |
+ ":${System.getProperty("exposed.test.db2.port", "50000")}/testdb" | |
}, | |
- "com.ibm.db2.jcc.DB2Driver", "inst", "yourStrong(!)Password" | |
+ driver = "com.ibm.db2.jcc.DB2Driver", | |
+ user = "inst", | |
+ pass = "yourStrong(!)Password", | |
+ beforeConnection = { | |
+ val tmp = Database.connect( | |
+ DB2.connection(), user = TestDB.DB2.user, password = TestDB.DB2.pass, driver = TestDB.DB2.driver | |
+ ) | |
+ var dbInitialized = false | |
+ repeat(10) { | |
+ if (!dbInitialized) { | |
+ transaction(Connection.TRANSACTION_READ_COMMITTED, 1, tmp) { | |
+ try { | |
+ exec("SELECT 1 FROM SYSIBM.SYSDUMMY1;") | |
+ dbInitialized = true | |
+ } catch (e: Exception) { | |
+ if (it < 9) | |
+ exposedLogger.info("Awaiting on DB2 creates database (${it+1}/10)") | |
+ else | |
+ exposedLogger.error("DB2 wasn't initialized in 100 sec", e) | |
+ } | |
+ } | |
+ Thread.sleep(10000) | |
+ } | |
+ } | |
+ require(dbInitialized) { "DB2 wasn't initialized in 100 sec" } | |
+ } | |
),; | |
fun connect() = Database.connect(connection(), user = user, password = pass, driver = driver) | |
Index: exposed-tests/build.gradle.kts | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/exposed-tests/build.gradle.kts b/exposed-tests/build.gradle.kts | |
--- a/exposed-tests/build.gradle.kts (revision 3ad3164544e9c2b5cf4b6c53bf01c1b5fb005071) | |
+++ b/exposed-tests/build.gradle.kts (date 1620855851473) | |
@@ -11,6 +11,7 @@ | |
repositories { | |
mavenCentral() | |
+ maven("https://repository.novatec-gmbh.de/content/repositories/novatec/") | |
} | |
val dialect: String by project | |
Index: exposed-jdbc/src/main/kotlin/org/jetbrains/exposed/sql/statements/jdbc/JdbcDatabaseMetadataImpl.kt | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/exposed-jdbc/src/main/kotlin/org/jetbrains/exposed/sql/statements/jdbc/JdbcDatabaseMetadataImpl.kt b/exposed-jdbc/src/main/kotlin/org/jetbrains/exposed/sql/statements/jdbc/JdbcDatabaseMetadataImpl.kt | |
--- a/exposed-jdbc/src/main/kotlin/org/jetbrains/exposed/sql/statements/jdbc/JdbcDatabaseMetadataImpl.kt (revision 3ad3164544e9c2b5cf4b6c53bf01c1b5fb005071) | |
+++ b/exposed-jdbc/src/main/kotlin/org/jetbrains/exposed/sql/statements/jdbc/JdbcDatabaseMetadataImpl.kt (date 1620856684701) | |
@@ -26,6 +26,7 @@ | |
"PostgreSQL JDBC - NG" -> PostgreSQLNGDialect.dialectName | |
"PostgreSQL JDBC Driver" -> PostgreSQLDialect.dialectName | |
"Oracle JDBC driver" -> OracleDialect.dialectName | |
+ "IBM Data Server Driver for JDBC and SQLJ", | |
"AS/400 Toolbox for Java JDBC Driver" -> DB2Dialect.dialectName | |
else -> { | |
if (driverName.startsWith("Microsoft JDBC Driver ")) | |
Index: buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt b/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt | |
--- a/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt (revision 3ad3164544e9c2b5cf4b6c53bf01c1b5fb005071) | |
+++ b/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/DockerTestContainers.kt (date 1620855562807) | |
@@ -51,7 +51,7 @@ | |
"mysql8" -> testImplementationSetup("mysql", "mysql-connector-java", Versions.mysql80) | |
"oracle" -> testImplementationSetup("com.oracle.database.jdbc", "ojdbc8", Versions.oracle12) | |
"sqlserver" -> testImplementationSetup("com.microsoft.sqlserver", "mssql-jdbc", Versions.sqlserver) | |
- "db2" -> testImplementationSetup("com.ibm.db2.jcc", "db2jcc", Versions.db2) // Test against db2 luw; testing for db2 as400 is hard | |
+ "db2" -> testImplementationSetup("com.ibm.db2.jcc", "db2jcc4", Versions.db2) // Test against db2 luw; testing for db2 as400 is hard | |
else -> { | |
testImplementationSetup("com.h2database", "h2", Versions.h2) | |
testImplementationSetup("mysql", "mysql-connector-java", Versions.mysql51) | |
Index: buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt b/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt | |
--- a/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt (revision 3ad3164544e9c2b5cf4b6c53bf01c1b5fb005071) | |
+++ b/buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt (date 1620855851468) | |
@@ -14,7 +14,7 @@ | |
const val postgreNG = "0.8.6" | |
const val sqlLite3 = "3.32.3.2" | |
const val sqlserver = "8.4.1.jre8" | |
- const val db2 = "db2jcc4" | |
+ const val db2 = "11.1.1.1" | |
/** Spring **/ | |
const val springFramework = "5.3.3" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment