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 c9bb9aca28e Fix sonar issues (#35295)
c9bb9aca28e is described below

commit c9bb9aca28e6e8d172d6393e221690d194e12c90
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Wed Apr 30 12:15:53 2025 +0800

    Fix sonar issues (#35295)
---
 .../database/option/OpenGaussSystemTableOptionTest.java    |  2 +-
 .../e2e/data/pipeline/cases/PipelineContainerComposer.java | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/infra/database/type/opengauss/src/test/java/org/apache/shardingsphere/infra/database/opengauss/metadata/database/option/OpenGaussSystemTableOptionTest.java
 
b/infra/database/type/opengauss/src/test/java/org/apache/shardingsphere/infra/database/opengauss/metadata/database/option/OpenGaussSystemTableOptionTest.java
index 32da68400a4..85268ce3c6b 100644
--- 
a/infra/database/type/opengauss/src/test/java/org/apache/shardingsphere/infra/database/opengauss/metadata/database/option/OpenGaussSystemTableOptionTest.java
+++ 
b/infra/database/type/opengauss/src/test/java/org/apache/shardingsphere/infra/database/opengauss/metadata/database/option/OpenGaussSystemTableOptionTest.java
@@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 class OpenGaussSystemTableOptionTest {
     
     @Test
-    public void assertIsSystemCatalogQueryExpressions() {
+    void assertIsSystemCatalogQueryExpressions() {
         assertTrue(new 
OpenGaussDriverQuerySystemCatalogOption().isSystemCatalogQueryExpressions("version()"));
         assertTrue(new 
OpenGaussDriverQuerySystemCatalogOption().isSystemCatalogQueryExpressions("intervaltonum(gs_password_deadline())"));
         assertTrue(new 
OpenGaussDriverQuerySystemCatalogOption().isSystemCatalogQueryExpressions("gs_password_notifytime()"));
diff --git 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
index ff9ccfe00b2..4d74c017f75 100644
--- 
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
+++ 
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
@@ -162,18 +162,20 @@ public final class PipelineContainerComposer implements 
AutoCloseable {
             String jobId = each.get("id").toString();
             Map<String, Object> jobInfo = 
queryForListWithLog(String.format("SHOW %s STATUS '%s'", jobTypeName, 
jobId)).get(0);
             String status = jobInfo.get("status").toString();
-            String sql;
-            if (JobStatus.FINISHED.name().equals(status)) {
-                sql = String.format((isSupportCommit(jobType) ? "COMMIT" : 
"DROP") + " %s '%s'", jobTypeName, jobId);
-            } else {
-                sql = String.format((isSupportRollback(jobType) ? "ROLLBACK" : 
"DROP") + " %s '%s'", jobTypeName, jobId);
-            }
+            String sql = String.format("%s %s '%s'", getOperationType(jobType, 
status), jobTypeName, jobId);
             try (Statement statement = connection.createStatement()) {
                 statement.execute(sql);
             }
         }
     }
     
+    private String getOperationType(final PipelineJobType jobType, final 
String status) {
+        if (JobStatus.FINISHED.name().equals(status)) {
+            return isSupportCommit(jobType) ? "COMMIT" : "DROP";
+        }
+        return isSupportRollback(jobType) ? "ROLLBACK" : "DROP";
+    }
+    
     private boolean isSupportCommit(final PipelineJobType jobType) {
         return !(jobType instanceof CDCJobType);
     }

Reply via email to