You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by hu...@apache.org on 2026/08/11 11:34:46 UTC
(shardingsphere) branch master updated: Fix multiple JDBC connections transaction E2E assertion (#39410)
This is an automated email from the ASF dual-hosted git repository.
iamhucong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 00d4915db6f Fix multiple JDBC connections transaction E2E assertion (#39410)
00d4915db6f is described below
commit 00d4915db6f2bba01c18dfd34fa6cafe0f31ede3
Author: ZhangCheng <ch...@apache.org>
AuthorDate: Tue Aug 11 19:34:39 2026 +0800
Fix multiple JDBC connections transaction E2E assertion (#39410)
---
.../commitrollback/MultiJDBCConnectionsTestCase.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
index d807c484522..30324af562a 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
@@ -25,7 +25,11 @@ import org.apache.shardingsphere.transaction.api.TransactionType;
import java.sql.Connection;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Statement;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Multiple jdbc connections in one thread test case.
@@ -39,15 +43,19 @@ public final class MultiJDBCConnectionsTestCase extends BaseTransactionTestCase
@Override
public void executeTest(final TransactionContainerComposer containerComposer) throws SQLException {
- try (Connection connection = getDataSource().getConnection()) {
- PreparedStatement statement = connection.prepareStatement("INSERT INTO account(id, balance, transaction_id) VALUES(?, ?, ?)");
+ try (
+ Connection connection = getDataSource().getConnection();
+ PreparedStatement statement = connection.prepareStatement("INSERT INTO account(id, balance, transaction_id) VALUES(?, ?, ?)")) {
connection.setAutoCommit(false);
statement.setLong(1, 1L);
statement.setFloat(2, 1F);
statement.setInt(3, 1);
statement.execute();
- try (Connection connection2 = getDataSource().getConnection()) {
- connection2.createStatement().executeQuery("SELECT * FROM account");
+ try (
+ Connection connection2 = getDataSource().getConnection();
+ Statement queryStatement = connection2.createStatement();
+ ResultSet resultSet = queryStatement.executeQuery("SELECT * FROM account")) {
+ assertFalse(resultSet.next());
}
connection.commit();
assertAccountRowCount(connection, 1);