From 49db88bd98016aad10eccad4db6df5a07635ff67 Mon Sep 17 00:00:00 2001 From: Sanket Sahu Date: Mon, 23 Nov 2026 12:22:30 +0000 Subject: [PATCH 1/3] Fix failed-connection tests on JDK 11 and set up JDK 11 in CI On JDK 11, MysqlFailedConnectionTest and OracleFailedConnectionTest fail because DBSpecificFailedConnectionTest compares raw validation error strings containing Properties.toString(). Java 9+ changed Properties to store entries in an internal ConcurrentHashMap rather than Hashtable, which changes map iteration order when multiple connection properties are present. The GitHub Actions unit test workflow also runs without configuring JDK 11. Normalize the key=value entries inside the connection arguments block in DBSpecificFailedConnectionTest before comparing messages. That keeps assertions strict on the JDBC URL, properties, and error text across JDK 8 and JDK 11. Configure Temurin 11 in the unit test workflow for branches other than release/1.11. Verified mvn clean test -B across all 20 modules on JDK 11 passes RAT, Checkstyle, and all 207 unit tests (186 executed, 21 live-DB suites skipped). (cherry picked from commit 8b79784ab4e52447d27ec18c6ec5b77dfe7942d4) --- .github/workflows/build.yml | 8 +++ ...DBSpecificFailedConnectionMessageTest.java | 60 +++++++++++++++++++ .../DBSpecificFailedConnectionTest.java | 30 +++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionMessageTest.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55cd4617e..9372219a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,14 @@ jobs: restore-keys: | ${{ runner.os }}-maven-${{ github.workflow }} + - name: Set up JDK 11 + if: ${{ github.base_ref != 'release/1.11' && github.ref_name != 'release/1.11' }} + uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1 + with: + distribution: 'temurin' + java-version: '11' + overwrite-settings: false + - name: Build with Maven run: mvn clean test -fae -T 2 -B -V -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 diff --git a/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionMessageTest.java b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionMessageTest.java new file mode 100644 index 000000000..f5a2e69b2 --- /dev/null +++ b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionMessageTest.java @@ -0,0 +1,60 @@ +/* + * Copyright © 2026 Cask Data, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package io.cdap.plugin.db.connector; + +import org.junit.Assert; +import org.junit.Test; + +public class DBSpecificFailedConnectionMessageTest { + + @Test + public void testNormalizeConnectionArgumentsReordersProperties() { + String jdk8Order = "Failed to create connection to database via connection string: " + + "jdbc:mysql://localhost:3306 and arguments: {user=username, rewriteBatchedStatements=true, " + + "connectTimeout=20000, tinyInt1isBit=false, socketTimeout=20000}. Error: " + + "ConnectException: Connection refused (Connection refused)."; + String jdk11Order = "Failed to create connection to database via connection string: " + + "jdbc:mysql://localhost:3306 and arguments: {rewriteBatchedStatements=true, tinyInt1isBit=false, " + + "connectTimeout=20000, socketTimeout=20000, user=username}. Error: " + + "ConnectException: Connection refused (Connection refused)."; + + Assert.assertEquals(DBSpecificFailedConnectionTest.normalizeConnectionArguments(jdk8Order), + DBSpecificFailedConnectionTest.normalizeConnectionArguments(jdk11Order)); + } + + @Test + public void testNormalizeConnectionArgumentsDetectsMismatchedValues() { + String expected = "Failed to create connection to database via connection string: " + + "jdbc:mysql://localhost:3306 and arguments: {user=username, connectTimeout=20000}. Error: " + + "ConnectException: Connection refused."; + String mismatchedValue = "Failed to create connection to database via connection string: " + + "jdbc:mysql://localhost:3306 and arguments: {connectTimeout=30000, user=username}. Error: " + + "ConnectException: Connection refused."; + + Assert.assertNotEquals(DBSpecificFailedConnectionTest.normalizeConnectionArguments(expected), + DBSpecificFailedConnectionTest.normalizeConnectionArguments(mismatchedValue)); + } + + @Test + public void testNormalizeConnectionArgumentsHandlesEmptyAndUnformattedMessages() { + String emptyArgs = "Failed to create connection to database via connection string: " + + "jdbc:h2:mem:test and arguments: {}. Error: SQLException."; + Assert.assertEquals(emptyArgs, DBSpecificFailedConnectionTest.normalizeConnectionArguments(emptyArgs)); + Assert.assertEquals("Plain error", DBSpecificFailedConnectionTest.normalizeConnectionArguments("Plain error")); + Assert.assertNull(DBSpecificFailedConnectionTest.normalizeConnectionArguments(null)); + } +} diff --git a/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java index b18b395ff..8d155d58f 100644 --- a/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java +++ b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java @@ -26,10 +26,13 @@ import org.mockito.Mockito; import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; import java.util.List; public class DBSpecificFailedConnectionTest { - private static final String JDBC_DRIVER_CLASS_NAME = "oracle.jdbc.OracleDriver"; + private static final String ARGS_PREFIX = " and arguments: {"; + private static final String ARGS_SUFFIX = "}. Error: "; protected void test(String jdbcClassName, AbstractDBSpecificConnector connector, String expectedErrorMsg) throws ClassNotFoundException, IOException { @@ -45,6 +48,29 @@ protected void test(String jdbcClassName, AbstractDBSpecificConnector connector, connector.test(context); List validationFailures = context.getFailureCollector().getValidationFailures(); Assert.assertEquals(1, validationFailures.size()); - Assert.assertEquals(expectedErrorMsg, validationFailures.get(0).getMessage()); + Assert.assertEquals(normalizeConnectionArguments(expectedErrorMsg), + normalizeConnectionArguments(validationFailures.get(0).getMessage())); + } + + static String normalizeConnectionArguments(String errorMsg) { + if (errorMsg == null) { + return null; + } + int argsStart = errorMsg.indexOf(ARGS_PREFIX); + if (argsStart < 0) { + return errorMsg; + } + int contentStart = argsStart + ARGS_PREFIX.length(); + int argsEnd = errorMsg.indexOf(ARGS_SUFFIX, contentStart); + if (argsEnd < 0) { + return errorMsg; + } + String argsContent = errorMsg.substring(contentStart, argsEnd); + if (argsContent.isEmpty()) { + return errorMsg; + } + List entries = Arrays.asList(argsContent.split(", ", -1)); + Collections.sort(entries); + return errorMsg.substring(0, contentStart) + String.join(", ", entries) + errorMsg.substring(argsEnd); } } From aee2cd39a83c27e072f98b0200dccc5e7cd30437 Mon Sep 17 00:00:00 2001 From: Sanket Sahu Date: Mon, 23 Nov 2026 13:27:07 +0000 Subject: [PATCH 2/3] Simplify normalizeConnectionArguments per review feedback (cherry picked from commit 63aad2c556af4d0efa4c53b14de624df20853430) --- .../connector/DBSpecificFailedConnectionTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java index 8d155d58f..4d0d04a7d 100644 --- a/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java +++ b/database-commons/src/test/java/io/cdap/plugin/db/connector/DBSpecificFailedConnectionTest.java @@ -27,8 +27,8 @@ import java.io.IOException; import java.util.Arrays; -import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; public class DBSpecificFailedConnectionTest { private static final String ARGS_PREFIX = " and arguments: {"; @@ -62,15 +62,12 @@ static String normalizeConnectionArguments(String errorMsg) { } int contentStart = argsStart + ARGS_PREFIX.length(); int argsEnd = errorMsg.indexOf(ARGS_SUFFIX, contentStart); - if (argsEnd < 0) { + if (argsEnd <= contentStart) { return errorMsg; } - String argsContent = errorMsg.substring(contentStart, argsEnd); - if (argsContent.isEmpty()) { - return errorMsg; - } - List entries = Arrays.asList(argsContent.split(", ", -1)); - Collections.sort(entries); - return errorMsg.substring(0, contentStart) + String.join(", ", entries) + errorMsg.substring(argsEnd); + String sortedArgs = Arrays.stream(errorMsg.substring(contentStart, argsEnd).split(", ", -1)) + .sorted() + .collect(Collectors.joining(", ")); + return errorMsg.substring(0, contentStart) + sortedArgs + errorMsg.substring(argsEnd); } } From 3f575f55daa5aa696c173d997f67817d2760a581 Mon Sep 17 00:00:00 2001 From: Sanket Sahu Date: Tue, 24 Nov 2026 19:43:29 +0000 Subject: [PATCH 3/3] Bump version to 1.12.7-SNAPSHOT --- amazon-redshift-plugin/pom.xml | 2 +- aurora-mysql-plugin/pom.xml | 2 +- aurora-postgresql-plugin/pom.xml | 2 +- cloudsql-mysql-plugin/pom.xml | 2 +- cloudsql-postgresql-plugin/pom.xml | 2 +- database-commons/pom.xml | 2 +- databricks-plugin/pom.xml | 2 +- db2-plugin/pom.xml | 2 +- generic-database-plugin/pom.xml | 2 +- generic-db-argument-setter/pom.xml | 2 +- mariadb-plugin/pom.xml | 2 +- memsql-plugin/pom.xml | 2 +- mssql-plugin/pom.xml | 2 +- mysql-plugin/pom.xml | 2 +- netezza-plugin/pom.xml | 2 +- oracle-plugin/pom.xml | 2 +- pom.xml | 2 +- postgresql-plugin/pom.xml | 2 +- saphana-plugin/pom.xml | 2 +- teradata-plugin/pom.xml | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/amazon-redshift-plugin/pom.xml b/amazon-redshift-plugin/pom.xml index ad3d34e68..7de5c79dd 100644 --- a/amazon-redshift-plugin/pom.xml +++ b/amazon-redshift-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Amazon Redshift plugin diff --git a/aurora-mysql-plugin/pom.xml b/aurora-mysql-plugin/pom.xml index a8eaca6ab..62de92d3f 100644 --- a/aurora-mysql-plugin/pom.xml +++ b/aurora-mysql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Aurora DB MySQL plugin diff --git a/aurora-postgresql-plugin/pom.xml b/aurora-postgresql-plugin/pom.xml index b22c2725a..b78d8724e 100644 --- a/aurora-postgresql-plugin/pom.xml +++ b/aurora-postgresql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Aurora DB PostgreSQL plugin diff --git a/cloudsql-mysql-plugin/pom.xml b/cloudsql-mysql-plugin/pom.xml index 358730e2f..136353319 100644 --- a/cloudsql-mysql-plugin/pom.xml +++ b/cloudsql-mysql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT CloudSQL MySQL plugin diff --git a/cloudsql-postgresql-plugin/pom.xml b/cloudsql-postgresql-plugin/pom.xml index cb77d6968..056d7f52d 100644 --- a/cloudsql-postgresql-plugin/pom.xml +++ b/cloudsql-postgresql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT CloudSQL PostgreSQL plugin diff --git a/database-commons/pom.xml b/database-commons/pom.xml index 713e076fe..c62b2686a 100644 --- a/database-commons/pom.xml +++ b/database-commons/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Database Commons diff --git a/databricks-plugin/pom.xml b/databricks-plugin/pom.xml index c023f96d0..14d840420 100644 --- a/databricks-plugin/pom.xml +++ b/databricks-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Databricks plugin diff --git a/db2-plugin/pom.xml b/db2-plugin/pom.xml index 9faba7400..fc03e0436 100644 --- a/db2-plugin/pom.xml +++ b/db2-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT IBM DB2 plugin diff --git a/generic-database-plugin/pom.xml b/generic-database-plugin/pom.xml index 90923d24f..265785f6e 100644 --- a/generic-database-plugin/pom.xml +++ b/generic-database-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Generic database plugin diff --git a/generic-db-argument-setter/pom.xml b/generic-db-argument-setter/pom.xml index 67790100c..71186fb84 100644 --- a/generic-db-argument-setter/pom.xml +++ b/generic-db-argument-setter/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Generic database argument setter plugin diff --git a/mariadb-plugin/pom.xml b/mariadb-plugin/pom.xml index 253b4fa00..01d31352e 100644 --- a/mariadb-plugin/pom.xml +++ b/mariadb-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Maria DB plugin diff --git a/memsql-plugin/pom.xml b/memsql-plugin/pom.xml index 14687b3b4..03d21a553 100644 --- a/memsql-plugin/pom.xml +++ b/memsql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Memsql plugin diff --git a/mssql-plugin/pom.xml b/mssql-plugin/pom.xml index 79813938c..c68abc3c8 100644 --- a/mssql-plugin/pom.xml +++ b/mssql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Microsoft SQL Server plugin diff --git a/mysql-plugin/pom.xml b/mysql-plugin/pom.xml index 02abb60bc..b3cba310b 100644 --- a/mysql-plugin/pom.xml +++ b/mysql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Mysql plugin diff --git a/netezza-plugin/pom.xml b/netezza-plugin/pom.xml index 3c167e046..a5c0d894d 100644 --- a/netezza-plugin/pom.xml +++ b/netezza-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Netezza plugin diff --git a/oracle-plugin/pom.xml b/oracle-plugin/pom.xml index d5a95804e..772e09916 100644 --- a/oracle-plugin/pom.xml +++ b/oracle-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT Oracle plugin diff --git a/pom.xml b/pom.xml index c371231f4..4a18b88b5 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ io.cdap.plugin database-plugins-parent - 1.12.6 + 1.12.7-SNAPSHOT pom Database Plugins Collection of database plugins diff --git a/postgresql-plugin/pom.xml b/postgresql-plugin/pom.xml index b6cf42513..285f46ac5 100644 --- a/postgresql-plugin/pom.xml +++ b/postgresql-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT PostgreSQL plugin diff --git a/saphana-plugin/pom.xml b/saphana-plugin/pom.xml index cd2bb73f3..25b048da9 100644 --- a/saphana-plugin/pom.xml +++ b/saphana-plugin/pom.xml @@ -20,7 +20,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT SAP HANA plugin diff --git a/teradata-plugin/pom.xml b/teradata-plugin/pom.xml index def18b908..279c58656 100644 --- a/teradata-plugin/pom.xml +++ b/teradata-plugin/pom.xml @@ -21,7 +21,7 @@ database-plugins-parent io.cdap.plugin - 1.12.6 + 1.12.7-SNAPSHOT teradata-plugin