You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/05/18 12:27:15 UTC
[shardingsphere] branch master updated: Fix sonar issue of UnlockClusterUpdater (#25765)
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 69fc96327bf Fix sonar issue of UnlockClusterUpdater (#25765)
69fc96327bf is described below
commit 69fc96327bfd244978bf7c6e77631f0d7e0178d1
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu May 18 20:27:08 2023 +0800
Fix sonar issue of UnlockClusterUpdater (#25765)
* Fix sonar issue of UnlockClusterUpdater
* Fix sonar issue of Swap these 2 arguments so they are in the correct order: expected value, actual value.
* Fix sonar issue of Provide the parametrized type for this generic.
* Fix sonar issue of HBaseHeterogeneousUtils
* Fix sonar issue of AdditionalDMLE2EIT
* Fix sonar issue of ProxyBackendHandlerFactoryTest
---
.../shardingsphere/infra/instance/InstanceContext.java | 2 +-
.../shardingsphere/infra/datanode/DataNodeTest.java | 2 +-
.../infra/datasource/props/DataSourcePropertiesTest.java | 2 +-
...mlInventoryIncrementalJobItemProgressSwapperTest.java | 3 +--
.../sql/common/value/collection/CollectionValue.java | 1 +
.../proxy/backend/session/ConnectionSession.java | 1 +
.../backend/handler/ProxyBackendHandlerFactoryTest.java | 4 ++--
.../backend/hbase/util/HBaseHeterogeneousUtils.java | 2 +-
.../test/e2e/engine/type/dml/AdditionalDMLE2EIT.java | 16 ++++++++--------
.../scenario/migration/api/impl/MigrationJobAPITest.java | 3 +--
10 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
index 53bcd0d5aef..5b3ae26c2e2 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
@@ -51,7 +51,7 @@ public final class InstanceContext {
private final ModeContextManager modeContextManager;
- private final LockContext lockContext;
+ private final LockContext<?> lockContext;
private final EventBusContext eventBusContext;
diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
index 1233832086f..e876e1be61c 100644
--- a/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
+++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeTest.java
@@ -56,7 +56,7 @@ class DataNodeTest {
assertThat(dataNode, is(new DataNode("ds_0.tbl_0")));
assertThat(dataNode, is(dataNode));
assertThat(dataNode, not(new DataNode("ds_0.tbl_1")));
- assertNotEquals(dataNode, null);
+ assertNotEquals(null, dataNode);
}
@Test
diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
index 89a62fac492..dcd4864ec3c 100644
--- a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
+++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
@@ -99,7 +99,7 @@ class DataSourcePropertiesTest {
@Test
void assertNotEqualsWithNullValue() {
- assertNotEquals(new DataSourceProperties(MockedDataSource.class.getName(), new HashMap<>()), null);
+ assertNotEquals(null, new DataSourceProperties(MockedDataSource.class.getName(), new HashMap<>()));
}
@Test
diff --git a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/api/job/progress/yaml/YamlInventoryIncrementalJobItemProgressSwapperTest.java b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/api/job/progress/yaml/YamlInventoryIncrementalJobItemProgressSwapperTest.java
index cbecf664d09..680d15309ae 100644
--- a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/api/job/progress/yaml/YamlInventoryIncrementalJobItemProgressSwapperTest.java
+++ b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/api/job/progress/yaml/YamlInventoryIncrementalJobItemProgressSwapperTest.java
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
class YamlInventoryIncrementalJobItemProgressSwapperTest {
@@ -41,7 +40,7 @@ class YamlInventoryIncrementalJobItemProgressSwapperTest {
assertThat(actual.getSourceDatabaseType(), is("H2"));
assertThat(actual.getDataSourceName(), is("ds_0"));
assertThat(actual.getInventory().getFinished().length, is(2));
- assertArrayEquals(actual.getInventory().getFinished(), new String[]{"ds0.t_2", "ds0.t_1"});
+ assertThat(actual.getInventory().getFinished(), is(new String[]{"ds0.t_2", "ds0.t_1"}));
assertThat(actual.getInventory().getUnfinished().size(), is(2));
assertThat(actual.getInventory().getUnfinished().get("ds1.t_2"), is("i,1,2"));
assertThat(actual.getInventory().getUnfinished().get("ds1.t_1"), is(""));
diff --git a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/value/collection/CollectionValue.java b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/value/collection/CollectionValue.java
index db0704f1ef1..f4aaeeccac4 100644
--- a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/value/collection/CollectionValue.java
+++ b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/value/collection/CollectionValue.java
@@ -28,6 +28,7 @@ import java.util.LinkedList;
*
* @param <T> type of collection value
*/
+@SuppressWarnings("rawtypes")
@Getter
public final class CollectionValue<T> implements ValueASTNode<Collection> {
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
index db0afa949e2..2f20a50adaf 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
@@ -62,6 +62,7 @@ public final class ConnectionSession {
private final ProxyDatabaseConnectionManager databaseConnectionManager;
+ @SuppressWarnings("rawtypes")
private final ExecutorStatementManager statementManager;
private final ServerPreparedStatementRegistry serverPreparedStatementRegistry = new ServerPreparedStatementRegistry();
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
index 1b6a97c5959..4df886a54ee 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
@@ -187,8 +187,8 @@ class ProxyBackendHandlerFactoryTest {
assertThat(actual, instanceOf(UnicastDatabaseBackendHandler.class));
}
- // TODO Fix me
- @Disabled
+ // TODO
+ @Disabled("FIX ME")
@Test
void assertNewInstanceWithQuery() throws SQLException {
String sql = "SELECT * FROM t_order limit 1";
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
index f4926049ecd..f9cceabb69b 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
@@ -65,7 +65,7 @@ public final class HBaseHeterogeneousUtils {
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
found++;
- Preconditions.checkState(found <= replacements.length, String.format("Missing replacement for '%s' at [%s].", target, found));
+ Preconditions.checkState(found <= replacements.length, "Missing replacement for '%s' at [%s].", target, found);
matcher.appendReplacement(sb, Matcher.quoteReplacement(replacements[found - 1].toString()));
}
matcher.appendTail(sb);
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 67f6dd4154d..1f18f58785c 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
@@ -91,8 +91,8 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- // TODO support execute update with column indexes in #23626
- @Disabled
+ // TODO
+ @Disabled("support execute update with column indexes in #23626")
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
@@ -127,8 +127,8 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- // TODO support execute update with column names in #23626
- @Disabled
+ // TODO
+ @Disabled("support execute update with column names in #23626")
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
@@ -248,8 +248,8 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- // TODO support execute with column indexes in #23626
- @Disabled
+ // TODO
+ @Disabled("support execute with column indexes in #23626")
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
@@ -286,8 +286,8 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT {
}
}
- // TODO support execute with column names in #23626
- @Disabled
+ // TODO
+ @Disabled("support execute with column names in #23626")
@ParameterizedTest(name = "{0}")
@EnabledIf("isEnabled")
@ArgumentsSource(E2ETestCaseArgumentsProvider.class)
diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
index 81e37cedc2b..8b1fc05d53d 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
@@ -80,7 +80,6 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -234,7 +233,7 @@ class MigrationJobAPITest {
jobAPI.updateJobItemStatus(jobId.get(), jobItemContext.getShardingItem(), JobStatus.EXECUTE_INVENTORY_TASK);
Map<Integer, InventoryIncrementalJobItemProgress> progress = jobAPI.getJobProgress(jobConfig);
for (Entry<Integer, InventoryIncrementalJobItemProgress> entry : progress.entrySet()) {
- assertSame(entry.getValue().getStatus(), JobStatus.EXECUTE_INVENTORY_TASK);
+ assertThat(entry.getValue().getStatus(), is(JobStatus.EXECUTE_INVENTORY_TASK));
}
}