This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 c6bfc0f9093 Fix sonar issues (#32623)
c6bfc0f9093 is described below
commit c6bfc0f9093afbfb367275ba05895e23c4d58f4c
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 22 10:49:49 2024 +0800
Fix sonar issues (#32623)
* Fix sonar issue on InventoryDumper
* Fix sonar issue on TransactionTestCaseRegistry
* Fix sonar issue on SQLExecuteType
---
.../transaction/env/enums/TransactionTestCaseRegistry.java | 4 ++--
.../test/e2e/engine/context/E2ETestContext.java | 2 +-
.../shardingsphere/test/e2e/engine/type/DCLE2EIT.java | 4 ++--
.../shardingsphere/test/e2e/engine/type/DDLE2EIT.java | 4 ++--
.../test/e2e/engine/type/dml/AdditionalDMLE2EIT.java | 14 +++++++-------
.../test/e2e/engine/type/dml/GeneralDMLE2EIT.java | 4 ++--
.../test/e2e/engine/type/dql/AdditionalDQLE2EIT.java | 4 ++--
.../test/e2e/engine/type/dql/GeneralDQLE2EIT.java | 4 ++--
.../framework/param/array/E2ETestParameterGenerator.java | 2 +-
.../test/e2e/framework/type/SQLExecuteType.java | 2 +-
10 files changed, 22 insertions(+), 22 deletions(-)
diff --git
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/enums/TransactionTestCaseRegistry.java
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/enums/TransactionTestCaseRegistry.java
index 5305b4ff52a..b0a13d50ffb 100644
---
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/enums/TransactionTestCaseRegistry.java
+++
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/enums/TransactionTestCaseRegistry.java
@@ -33,9 +33,9 @@ import
org.apache.shardingsphere.test.e2e.transaction.engine.database.postgresql
@Getter
public enum TransactionTestCaseRegistry {
- MySQL_JDBC_IT(MySQLJdbcTransactionE2ETT.class,
TransactionTestConstants.MYSQL, AdapterType.JDBC.getValue()),
+ MYSQL_JDBC_IT(MySQLJdbcTransactionE2ETT.class,
TransactionTestConstants.MYSQL, AdapterType.JDBC.getValue()),
- MySQL_PROXY_IT(MySQLProxyTransactionE2EIT.class,
TransactionTestConstants.MYSQL, AdapterType.PROXY.getValue()),
+ MYSQL_PROXY_IT(MySQLProxyTransactionE2EIT.class,
TransactionTestConstants.MYSQL, AdapterType.PROXY.getValue()),
OPENGAUSS_JDBC_IT(OpenGaussJdbcTransactionE2EIT.class,
TransactionTestConstants.OPENGAUSS, AdapterType.JDBC.getValue()),
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/E2ETestContext.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/E2ETestContext.java
index 9baa80bce80..3c59a856cba 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/E2ETestContext.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/E2ETestContext.java
@@ -57,7 +57,7 @@ public class E2ETestContext {
* @return SQL
*/
public String getSQL() {
- return sqlExecuteType == SQLExecuteType.Literal ? getLiteralSQL(sql) :
sql;
+ return sqlExecuteType == SQLExecuteType.LITERAL ? getLiteralSQL(sql) :
sql;
}
private String getLiteralSQL(final String sql) {
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
index 776b6ff3f70..2b1bd8b0766 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DCLE2EIT.java
@@ -68,7 +68,7 @@ class DCLE2EIT implements E2EEnvironmentAware {
private void assertExecuteUpdate(final E2ETestContext context) throws
SQLException {
String sql = context.getSQL();
try (Connection connection =
this.environmentSetupEngine.getTargetDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
try (Statement statement = connection.createStatement()) {
statement.executeUpdate(sql);
}
@@ -99,7 +99,7 @@ class DCLE2EIT implements E2EEnvironmentAware {
private void assertExecute(final E2ETestContext context) throws
SQLException {
String sql = context.getSQL();
try (Connection connection =
environmentSetupEngine.getTargetDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
try (Statement statement = connection.createStatement()) {
statement.execute(sql);
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
index 73fa7225960..4d315e4cd47 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
@@ -77,7 +77,7 @@ class DDLE2EIT implements E2EEnvironmentAware {
E2ETestContext context = new E2ETestContext(testParam);
init(context);
try (Connection connection =
environmentEngine.getTargetDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
executeUpdateForStatement(context, connection);
} else {
executeUpdateForPreparedStatement(context, connection);
@@ -112,7 +112,7 @@ class DDLE2EIT implements E2EEnvironmentAware {
E2ETestContext context = new E2ETestContext(testParam);
init(context);
try (Connection connection =
environmentEngine.getTargetDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
executeForStatement(context, connection);
} else {
executeForPreparedStatement(context, connection);
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
index f9719bd2ed7..ffa68d7efdd 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/AdditionalDMLE2EIT.java
@@ -59,7 +59,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
?
executeUpdateForStatementWithAutoGeneratedKeys(testParam, context, connection)
:
executeUpdateForPreparedStatementWithAutoGeneratedKeys(testParam, context,
connection);
}
@@ -109,7 +109,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeUpdateForStatementWithColumnIndexes(context,
connection)
:
executeUpdateForPreparedStatementWithColumnIndexes(context, connection);
}
@@ -144,7 +144,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeUpdateForStatementWithColumnNames(context,
connection)
:
executeUpdateForPreparedStatementWithColumnNames(context, connection);
}
@@ -181,7 +181,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeForStatementWithoutAutoGeneratedKeys(context,
connection)
:
executeForPreparedStatementWithoutAutoGeneratedKeys(context, connection);
}
@@ -220,7 +220,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeForStatementWithAutoGeneratedKeys(testParam,
context, connection)
:
executeForPreparedStatementWithAutoGeneratedKeys(testParam, context,
connection);
}
@@ -261,7 +261,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeForStatementWithColumnIndexes(context, connection)
: executeForPreparedStatementWithColumnIndexes(context,
connection);
}
@@ -298,7 +298,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeForStatementWithColumnNames(context, connection)
: executeForPreparedStatementWithColumnNames(context,
connection);
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
index 46d3012d487..bd7de8646ee 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/GeneralDMLE2EIT.java
@@ -53,7 +53,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeUpdateForStatement(context, connection)
: executeUpdateForPreparedStatement(context, connection);
}
@@ -98,7 +98,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT {
init(testParam);
int actualUpdateCount;
try (Connection connection =
getEnvironmentEngine().getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLExecuteType.Literal ==
context.getSqlExecuteType()
+ actualUpdateCount = SQLExecuteType.LITERAL ==
context.getSqlExecuteType()
? executeForStatement(context, connection)
: executeForPreparedStatement(context, connection);
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
index dd7320ab7f5..70557b332d8 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/AdditionalDQLE2EIT.java
@@ -150,7 +150,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
try (
Connection actualConnection =
getEnvironmentEngine().getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
assertExecuteQueryForStatementWithResultSetTypes(context,
actualConnection, expectedConnection, testParam, resultSetTypes);
} else {
assertExecuteQueryForPreparedStatementWithResultSetTypes(context,
actualConnection, expectedConnection, testParam, resultSetTypes);
@@ -210,7 +210,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT {
try (
Connection actualConnection =
getEnvironmentEngine().getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
assertExecuteForStatementWithResultSetTypes(context,
actualConnection, expectedConnection, testParam, resultSetTypes);
} else {
assertExecuteForPreparedStatementWithResultSetTypes(context,
actualConnection, expectedConnection, testParam, resultSetTypes);
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
index 8b13d45c814..4d5dc311b09 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dql/GeneralDQLE2EIT.java
@@ -81,7 +81,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
try (
Connection actualConnection =
getEnvironmentEngine().getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
assertExecuteQueryForStatement(context, actualConnection,
expectedConnection, testParam);
} else {
assertExecuteQueryForPreparedStatement(context,
actualConnection, expectedConnection, testParam);
@@ -156,7 +156,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT {
try (
Connection actualConnection =
getEnvironmentEngine().getTargetDataSource().getConnection();
Connection expectedConnection =
getExpectedDataSource().getConnection()) {
- if (SQLExecuteType.Literal == context.getSqlExecuteType()) {
+ if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) {
assertExecuteForStatement(context, actualConnection,
expectedConnection, testParam);
} else {
assertExecuteForPreparedStatement(context, actualConnection,
expectedConnection, testParam);
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
index 0b4b91115c2..a2b3b92ec4c 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
@@ -90,7 +90,7 @@ public final class E2ETestParameterGenerator {
final
DatabaseType databaseType, final SQLCommandType sqlCommandType) {
Collection<AssertionTestParameter> result = new LinkedList<>();
for (SQLExecuteType each : SQLExecuteType.values()) {
- if (!sqlCommandType.isLiteralOnly() || SQLExecuteType.Literal ==
each) {
+ if (!sqlCommandType.isLiteralOnly() || SQLExecuteType.LITERAL ==
each) {
result.addAll(getAssertionTestParameter(testCaseContext,
databaseType, each, sqlCommandType));
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/type/SQLExecuteType.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/type/SQLExecuteType.java
index 8e60ff4e924..b8ab28f32f7 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/type/SQLExecuteType.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/type/SQLExecuteType.java
@@ -22,5 +22,5 @@ package org.apache.shardingsphere.test.e2e.framework.type;
*/
public enum SQLExecuteType {
- Literal, Placeholder
+ LITERAL, PLACEHOLDER
}