From d235c267908f94a3c6ea091f9b667d2de22f3062 Mon Sep 17 00:00:00 2001 From: emeroad Date: Thu, 26 Dec 2024 12:21:46 +0900 Subject: [PATCH] [#noissue] Fix JDBC test failures --- .../pinpoint/it/plugin/jdbc/jtds/JtdsConnectionIT.java | 10 +++++----- .../it/plugin/jdbc/mysql/MySqlConnection_5_X_IT.java | 7 ++++--- .../it/plugin/jdbc/mysql/MySqlConnection_6_X_IT.java | 8 ++++---- .../it/plugin/jdbc/mysql/MySqlLoadBalance_5_X_IT.java | 8 ++++---- .../it/plugin/jdbc/mysql/MySqlLoadBalance_6_X_IT.java | 7 ++++--- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/agent-module/plugins-it/jtds-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/jtds/JtdsConnectionIT.java b/agent-module/plugins-it/jtds-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/jtds/JtdsConnectionIT.java index c41591c28a79..249f87b8fe90 100644 --- a/agent-module/plugins-it/jtds-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/jtds/JtdsConnectionIT.java +++ b/agent-module/plugins-it/jtds-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/jtds/JtdsConnectionIT.java @@ -121,8 +121,8 @@ private Connection connectDB() throws SQLException { public void testModify() throws Exception { logger.debug("testModify"); - try (Connection connection = connectDB() ) { - + final Connection con = connectDB(); + try (Connection connection = con) { logger.debug("Connection class name:{}", connection.getClass().getName()); logger.debug("Connection class cl:{}", connection.getClass().getClassLoader()); @@ -152,11 +152,11 @@ public void testModify() throws Exception { preparedStatement7(connection); preparedStatement8(connection); - - DatabaseInfo clearUrl = ((DatabaseInfoAccessor) connection)._$PINPOINT$_getDatabaseInfo(); - Assertions.assertNull(clearUrl); } + DatabaseInfo clearUrl = ((DatabaseInfoAccessor) con)._$PINPOINT$_getDatabaseInfo(); + Assertions.assertNull(clearUrl); + } diff --git a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_5_X_IT.java b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_5_X_IT.java index 1be5c967d4c2..cd5656488d3a 100644 --- a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_5_X_IT.java +++ b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_5_X_IT.java @@ -65,7 +65,8 @@ protected JDBCDriverClass getJDBCDriverClass() { public void testModify() throws Exception { DriverProperties driverProperties = getDriverProperties(); - try (Connection connection = getConnection(driverProperties)) { + final Connection con = getConnection(driverProperties); + try (Connection connection = con) { logger.info("Connection class name:{}", connection.getClass().getName()); logger.info("Connection class cl:{}", connection.getClass().getClassLoader()); @@ -81,10 +82,10 @@ public void testModify() throws Exception { preparedStatement3(connection); - DatabaseInfo clearUrl = ((DatabaseInfoAccessor) connection)._$PINPOINT$_getDatabaseInfo(); - Assertions.assertNull(clearUrl); } + DatabaseInfo clearUrl = ((DatabaseInfoAccessor) con)._$PINPOINT$_getDatabaseInfo(); + Assertions.assertNull(clearUrl); } private void statement(Connection connection) throws SQLException { diff --git a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_6_X_IT.java b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_6_X_IT.java index 4e5cfd324a87..21b31785a844 100644 --- a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_6_X_IT.java +++ b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlConnection_6_X_IT.java @@ -64,7 +64,8 @@ protected JDBCDriverClass getJDBCDriverClass() { public void testModify() throws Exception { DriverProperties driverProperties = getDriverProperties(); - try (Connection connection = getConnection(driverProperties)) { + final Connection con = getConnection(driverProperties); + try (Connection connection = con) { logger.info("Connection class name:{}", connection.getClass().getName()); logger.info("Connection class cl:{}", connection.getClass().getClassLoader()); @@ -79,11 +80,10 @@ public void testModify() throws Exception { preparedStatement2(connection); preparedStatement3(connection); - - DatabaseInfo clearUrl = ((DatabaseInfoAccessor) connection)._$PINPOINT$_getDatabaseInfo(); - Assertions.assertNull(clearUrl); } + DatabaseInfo clearUrl = ((DatabaseInfoAccessor) con)._$PINPOINT$_getDatabaseInfo(); + Assertions.assertNull(clearUrl); } private void statement(Connection connection) throws SQLException { diff --git a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_5_X_IT.java b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_5_X_IT.java index 72176bcc09f5..f986b20fdcdf 100644 --- a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_5_X_IT.java +++ b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_5_X_IT.java @@ -71,7 +71,8 @@ public static DriverProperties getDriverProperties() { @Test public void loadBalancedUrlModify() throws Exception { // random fail - try (Connection connection = getConnection(getDriverProperties())) { + final Connection con = getConnection(getDriverProperties()); + try (Connection connection = con) { logger.info("Connection class name:{}", connection.getClass().getName()); logger.info("Connection class cl:{}", connection.getClass().getClassLoader()); @@ -114,11 +115,10 @@ public void loadBalancedUrlModify() throws Exception { preparedStatement7(connection); preparedStatement8(connection); - - DatabaseInfo clearUrl = ((DatabaseInfoAccessor) internalConnection)._$PINPOINT$_getDatabaseInfo(); - Assertions.assertNull(clearUrl); } + DatabaseInfo clearUrl = ((DatabaseInfoAccessor) con)._$PINPOINT$_getDatabaseInfo(); + Assertions.assertNull(clearUrl); } private void statement(Connection connection) throws SQLException { diff --git a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_6_X_IT.java b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_6_X_IT.java index 90cc9e998d77..d6fe204f2505 100644 --- a/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_6_X_IT.java +++ b/agent-module/plugins-it/mysql-jdbc-driver-plugin-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/mysql/MySqlLoadBalance_6_X_IT.java @@ -71,7 +71,8 @@ public static DriverProperties getDriverProperties() { @Test public void loadBalancedUrlModify() throws Exception { // random fail - try (Connection connection = getConnection(getDriverProperties())) { + final Connection con = getConnection(getDriverProperties()); + try (Connection connection = con) { logger.info("Connection class name:{}", connection.getClass().getName()); logger.info("Connection class cl:{}", connection.getClass().getClassLoader()); @@ -115,10 +116,10 @@ public void loadBalancedUrlModify() throws Exception { preparedStatement8(connection); - DatabaseInfo clearUrl = ((DatabaseInfoAccessor) internalConnection)._$PINPOINT$_getDatabaseInfo(); - Assertions.assertNull(clearUrl); } + DatabaseInfo clearUrl = ((DatabaseInfoAccessor) con)._$PINPOINT$_getDatabaseInfo(); + Assertions.assertNull(clearUrl); } private void statement(Connection connection) throws SQLException {