You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2022/11/12 08:17:57 UTC

[shardingsphere] branch master updated: Rename variable from conn to connection (#22103)

This is an automated email from the ASF dual-hosted git repository.

sunnianjun 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 eb216ec6b05 Rename variable from conn to connection (#22103)
eb216ec6b05 is described below

commit eb216ec6b05786c371491696d877b42c1da02bae
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Nov 12 16:17:50 2022 +0800

    Rename variable from conn to connection (#22103)
---
 .../shardingsphere/driver/jdbc/base/AbstractSQLTest.java       | 10 +++++-----
 .../base/AbstractShardingSphereDataSourceForShardingTest.java  |  6 +++---
 .../jdbc/core/statement/EncryptPreparedStatementTest.java      |  8 ++++----
 .../driver/jdbc/core/statement/EncryptStatementTest.java       |  8 ++++----
 .../MultiOperationsCommitAndRollbackTestCase.java              |  4 ++--
 .../transaction/engine/base/BaseTransactionITCase.java         |  4 ++--
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractSQLTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractSQLTest.java
index 204fa1908bd..56c76215045 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractSQLTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractSQLTest.java
@@ -50,15 +50,15 @@ public abstract class AbstractSQLTest {
     }
     
     private static void initializeSchema(final String dataSourceName) throws SQLException {
-        try (Connection conn = ACTUAL_DATA_SOURCES.get(dataSourceName).getConnection()) {
+        try (Connection connection = ACTUAL_DATA_SOURCES.get(dataSourceName).getConnection()) {
             if ("encrypt".equals(dataSourceName)) {
-                RunScript.execute(conn, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_encrypt_init.sql"))));
+                RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_encrypt_init.sql"))));
             } else if ("shadow_jdbc_0".equals(dataSourceName) || "shadow_jdbc_1".equals(dataSourceName)) {
-                RunScript.execute(conn, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_shadow_init.sql"))));
+                RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_shadow_init.sql"))));
             } else if ("single_jdbc".equals(dataSourceName)) {
-                RunScript.execute(conn, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/single_jdbc_init.sql"))));
+                RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/single_jdbc_init.sql"))));
             } else {
-                RunScript.execute(conn, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_init.sql"))));
+                RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_init.sql"))));
             }
         }
     }
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForShardingTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForShardingTest.java
index 4751216e2a7..b699e32592b 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForShardingTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForShardingTest.java
@@ -64,9 +64,9 @@ public abstract class AbstractShardingSphereDataSourceForShardingTest extends Ab
     @Before
     public void initTable() {
         try {
-            Connection conn = dataSource.getConnection();
-            RunScript.execute(conn, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_data.sql"))));
-            conn.close();
+            Connection connection = dataSource.getConnection();
+            RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/jdbc_data.sql"))));
+            connection.close();
         } catch (final SQLException ex) {
             throw new RuntimeException(ex);
         }
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
index 20f87f5aa09..d2277a4d34a 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptPreparedStatementTest.java
@@ -54,7 +54,7 @@ public final class EncryptPreparedStatementTest extends AbstractShardingSphereDa
     private static final String SELECT_SQL_FOR_CONTAINS_COLUMN = "SELECT * FROM t_encrypt_contains_column WHERE plain_pwd = ?";
     
     @Test
-    public void assertSQLShow() throws SQLException {
+    public void assertSQLShow() {
         assertTrue(getEncryptConnectionWithProps().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW));
     }
     
@@ -182,9 +182,9 @@ public final class EncryptPreparedStatementTest extends AbstractShardingSphereDa
     
     private void assertResultSet(final int resultSetCount, final int id, final Object pwd, final Object assistPwd) throws SQLException {
         try (
-                Connection conn = getActualDataSources().get("encrypt").getConnection();
-                Statement stmt = conn.createStatement()) {
-            ResultSet resultSet = stmt.executeQuery(SELECT_ALL_SQL);
+                Connection connection = getActualDataSources().get("encrypt").getConnection();
+                Statement statement = connection.createStatement()) {
+            ResultSet resultSet = statement.executeQuery(SELECT_ALL_SQL);
             int count = 1;
             while (resultSet.next()) {
                 if (id == count) {
diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
index 2490579ead5..d3cd6ec9f2c 100644
--- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
+++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/EncryptStatementTest.java
@@ -57,7 +57,7 @@ public final class EncryptStatementTest extends AbstractShardingSphereDataSource
     private static final String SHOW_COLUMNS_SQL = "SHOW columns FROM t_encrypt";
     
     @Test
-    public void assertSQLShow() throws SQLException {
+    public void assertSQLShow() {
         assertTrue(getEncryptConnectionWithProps().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW));
     }
     
@@ -168,9 +168,9 @@ public final class EncryptStatementTest extends AbstractShardingSphereDataSource
     
     private void assertResultSet(final int resultSetCount, final int id, final Object pwd, final Object plain) throws SQLException {
         try (
-                Connection conn = getActualDataSources().get("encrypt").getConnection();
-                Statement stmt = conn.createStatement()) {
-            ResultSet resultSet = stmt.executeQuery(SELECT_SQL_TO_ASSERT);
+                Connection connection = getActualDataSources().get("encrypt").getConnection();
+                Statement statement = connection.createStatement()) {
+            ResultSet resultSet = statement.executeQuery(SELECT_SQL_TO_ASSERT);
             int count = 1;
             while (resultSet.next()) {
                 if (id == count) {
diff --git a/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/MultiOperationsCommitAndRollbackTestCase.java b/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/MultiOperationsCommitAndRollbackTestCase.java
index 014d8dd2c26..4498b071adc 100644
--- a/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/MultiOperationsCommitAndRollbackTestCase.java
+++ b/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/MultiOperationsCommitAndRollbackTestCase.java
@@ -74,9 +74,9 @@ public final class MultiOperationsCommitAndRollbackTestCase extends BaseTransact
         assertQueryAccount(connection, 1, 3);
     }
     
-    private void assertQueryAccount(final Connection conn, final int... expectedBalances) throws SQLException {
+    private void assertQueryAccount(final Connection connection, final int... expectedBalances) throws SQLException {
         Preconditions.checkArgument(2 == expectedBalances.length);
-        Statement queryStatement = conn.createStatement();
+        Statement queryStatement = connection.createStatement();
         ResultSet resultSet = queryStatement.executeQuery("select * from account;");
         while (resultSet.next()) {
             int id = resultSet.getInt("id");
diff --git a/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java b/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
index 18bf331ec6b..732d472b356 100644
--- a/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
+++ b/test/integration-test/transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseTransactionITCase.java
@@ -105,8 +105,8 @@ public abstract class BaseTransactionITCase extends BaseITCase {
         return false;
     }
     
-    private Map<String, String> executeShowTransactionRule(final Connection conn) throws SQLException {
-        Statement statement = conn.createStatement();
+    private Map<String, String> executeShowTransactionRule(final Connection connection) throws SQLException {
+        Statement statement = connection.createStatement();
         ResultSet resultSet = statement.executeQuery("SHOW TRANSACTION RULE;");
         Map<String, String> result = new HashMap<>(1, 1);
         while (resultSet.next()) {