This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 8e4afc5db4f Refactor JDBCBackendStatementTest to remove redundant
parameterization (#39614)
8e4afc5db4f is described below
commit 8e4afc5db4fe24ecc8b6f07a3d2bc5a85ed92f07
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 27 14:33:42 2026 +0800
Refactor JDBCBackendStatementTest to remove redundant parameterization
(#39614)
* Add code implementation Skill and non-regression policy gates
* Add code implementation Skill and non-regression policy gates
* Fix CDC selector parsing and job startup validation
* `Refactor JDBCBackendStatementTest to remove redundant parameterization`
---
.../jdbc/statement/JDBCBackendStatementTest.java | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/statement/JDBCBackendStatementTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/statement/JDBCBackendStatementTest.java
index 083d425c612..31f28a2c70d 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/statement/JDBCBackendStatementTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/statement/JDBCBackendStatementTest.java
@@ -32,9 +32,6 @@ import
org.apache.shardingsphere.test.infra.framework.extension.mock.AutoMockExt
import
org.apache.shardingsphere.test.infra.framework.extension.mock.StaticMockSettings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -44,7 +41,6 @@ import java.sql.Types;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -124,22 +120,20 @@ class JDBCBackendStatementTest {
verify(preparedStatement).setObject(1, 2);
}
- @ParameterizedTest(name = "{0}")
- @MethodSource("nonFirebirdDatabaseTypes")
- void
assertCreateStorageResourceWithoutPreparedStatementCacheWithoutActiveKey(final
String scenario, final String databaseTypeName) throws SQLException {
+ @Test
+ void
assertCreateStorageResourceWithoutPreparedStatementCacheWithoutActiveKey()
throws SQLException {
ConnectionSession connectionSession = mock(ConnectionSession.class);
when(connectionSession.getCurrentPreparedStatementCacheKey()).thenReturn(Optional.empty());
JDBCBackendStatement backendStatement = new
JDBCBackendStatement(connectionSession);
Connection connection = mock(Connection.class);
PreparedStatement preparedStatement = mock(PreparedStatement.class);
String sql = "SELECT * FROM foo WHERE id = ?";
- DatabaseType nonFirebirdDatabaseType = mock(DatabaseType.class);
when(connection.prepareStatement(sql)).thenReturn(preparedStatement);
StatementOption statementOption = new StatementOption(false);
backendStatement.createStorageResource(
- new ExecutionUnit("ds", new SQLUnit(sql,
Collections.singletonList(1))), connection, 0,
ConnectionMode.CONNECTION_STRICTLY, statementOption, nonFirebirdDatabaseType);
+ new ExecutionUnit("ds", new SQLUnit(sql,
Collections.singletonList(1))), connection, 0,
ConnectionMode.CONNECTION_STRICTLY, statementOption, databaseType);
backendStatement.createStorageResource(
- new ExecutionUnit("ds", new SQLUnit(sql,
Collections.singletonList(2))), connection, 0,
ConnectionMode.CONNECTION_STRICTLY, statementOption, nonFirebirdDatabaseType);
+ new ExecutionUnit("ds", new SQLUnit(sql,
Collections.singletonList(2))), connection, 0,
ConnectionMode.CONNECTION_STRICTLY, statementOption, databaseType);
verify(connection, times(2)).prepareStatement(sql);
}
@@ -186,10 +180,4 @@ class JDBCBackendStatementTest {
verify(firstPreparedStatement).close();
}
- private static Stream<Arguments> nonFirebirdDatabaseTypes() {
- return Stream.of(
-
Arguments.of("createStorageResource_mysqlDoesNotUsePreparedStatementCache",
"MySQL"),
-
Arguments.of("createStorageResource_postgresqlDoesNotUsePreparedStatementCache",
"PostgreSQL"),
-
Arguments.of("createStorageResource_openGaussDoesNotUsePreparedStatementCache",
"openGauss"));
- }
}