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

zhonghongsheng 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 e0115dcd625 Revise migration job info at pipeline (#20521)
e0115dcd625 is described below

commit e0115dcd625287ab2548dda481ab88e885f31bfd
Author: Xinze Guo <[email protected]>
AuthorDate: Fri Aug 26 09:11:27 2022 +0800

    Revise migration job info at pipeline (#20521)
    
    * Revise migration job info
    
    * Fix codestyle
---
 .../query/ShowMigrationListQueryResultSet.java     |  2 +-
 .../data/pipeline/api/MigrationJobPublicAPI.java   |  5 ++-
 .../data/pipeline/api/PipelineJobPublicAPI.java    |  2 +-
 .../data/pipeline/api/pojo/JobInfo.java            | 45 ----------------------
 .../data/pipeline/api/pojo/MigrationJobInfo.java   | 12 +++++-
 .../data/pipeline/api/pojo/PipelineJobInfo.java    |  4 --
 .../core/api/impl/AbstractPipelineJobAPIImpl.java  |  2 +-
 .../scenario/migration/MigrationJobAPIImpl.java    | 13 +++++--
 .../core/fixture/MigrationJobAPIFixture.java       |  4 +-
 .../core/api/impl/MigrationJobAPIImplTest.java     | 12 +++---
 10 files changed, 34 insertions(+), 67 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationListQueryResultSet.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationListQueryResultSet.java
index fdca0dc082b..a489a736b46 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationListQueryResultSet.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationListQueryResultSet.java
@@ -45,7 +45,7 @@ public final class ShowMigrationListQueryResultSet implements 
DatabaseDistSQLRes
                 .map(each -> {
                     Collection<Object> result = new LinkedList<>();
                     result.add(each.getJobId());
-                    result.add(each.getTables());
+                    result.add(each.getTable());
                     result.add(each.getShardingTotalCount());
                     result.add(each.isActive() ? Boolean.TRUE.toString() : 
Boolean.FALSE.toString());
                     result.add(each.getCreateTime());
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
index e89d7643dd7..c77ea3e77ef 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
@@ -21,7 +21,7 @@ import 
org.apache.shardingsphere.data.pipeline.api.check.consistency.DataConsist
 import 
org.apache.shardingsphere.data.pipeline.api.job.progress.InventoryIncrementalJobItemProgress;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.CreateMigrationJobParameter;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.DataConsistencyCheckAlgorithmInfo;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
+import org.apache.shardingsphere.data.pipeline.api.pojo.MigrationJobInfo;
 import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
 import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
 import org.apache.shardingsphere.infra.util.spi.type.required.RequiredSPI;
@@ -42,7 +42,8 @@ public interface MigrationJobPublicAPI extends 
PipelineJobPublicAPI, RequiredSPI
      *
      * @return job infos
      */
-    List<PipelineJobInfo> list();
+    @Override
+    List<MigrationJobInfo> list();
     
     /**
      * Get job progress.
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/PipelineJobPublicAPI.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/PipelineJobPublicAPI.java
index e3ec709d603..90c471692e7 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/PipelineJobPublicAPI.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/PipelineJobPublicAPI.java
@@ -82,5 +82,5 @@ public interface PipelineJobPublicAPI extends TypedSPI {
      *
      * @return jobInfos
      */
-    List<PipelineJobInfo> list();
+    List<? extends PipelineJobInfo> list();
 }
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/JobInfo.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/JobInfo.java
deleted file mode 100644
index de6f6e7f221..00000000000
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/JobInfo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.api.pojo;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import lombok.Setter;
-
-/**
- * Job info.
- */
-@RequiredArgsConstructor
-@Getter
-@Setter
-public final class JobInfo {
-    
-    private final String jobId;
-    
-    private boolean active;
-    
-    private String tables;
-    
-    private int shardingTotalCount;
-    
-    private String createTime;
-    
-    private String stopTime;
-    
-    private transient String jobParameter;
-}
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/MigrationJobInfo.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/MigrationJobInfo.java
index a781f28be1d..e7568e1b61e 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/MigrationJobInfo.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/MigrationJobInfo.java
@@ -17,10 +17,20 @@
 
 package org.apache.shardingsphere.data.pipeline.api.pojo;
 
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
 /**
  * Migration job info.
  */
-public class MigrationJobInfo extends PipelineJobInfo {
+
+@Setter
+@Getter
+@ToString(callSuper = true)
+public final class MigrationJobInfo extends PipelineJobInfo {
+    
+    private String table;
     
     public MigrationJobInfo(final String jobId) {
         super(jobId);
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/PipelineJobInfo.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/PipelineJobInfo.java
index ea939cd08d4..0af0a6260ee 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/PipelineJobInfo.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/pojo/PipelineJobInfo.java
@@ -33,13 +33,9 @@ public abstract class PipelineJobInfo {
     
     private boolean active;
     
-    private String tables;
-    
     private int shardingTotalCount;
     
     private String createTime;
     
     private String stopTime;
-    
-    private transient String jobParameter;
 }
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java
index bc713522c34..72d8d84ef97 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java
@@ -118,7 +118,7 @@ public abstract class AbstractPipelineJobAPIImpl implements 
PipelineJobAPI {
     protected abstract String marshalJobIdLeftPart(PipelineJobId 
pipelineJobId);
     
     @Override
-    public List<PipelineJobInfo> list() {
+    public List<? extends PipelineJobInfo> list() {
         checkModeConfig();
         return getJobBriefInfos().map(each -> 
getJobInfo(each.getJobName())).collect(Collectors.toList());
     }
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
index e2ad42ba6b3..ff38a56e71a 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
@@ -48,7 +48,6 @@ import 
org.apache.shardingsphere.data.pipeline.api.metadata.LogicTableName;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.CreateMigrationJobParameter;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.DataConsistencyCheckAlgorithmInfo;
 import org.apache.shardingsphere.data.pipeline.api.pojo.MigrationJobInfo;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
 import org.apache.shardingsphere.data.pipeline.core.api.PipelineAPIFactory;
 import org.apache.shardingsphere.data.pipeline.core.api.PipelineJobItemAPI;
 import 
org.apache.shardingsphere.data.pipeline.core.api.impl.AbstractPipelineJobAPIImpl;
@@ -122,6 +121,12 @@ public final class MigrationJobAPIImpl extends 
AbstractPipelineJobAPIImpl implem
         return DigestUtils.md5Hex(text.getBytes(StandardCharsets.UTF_8));
     }
     
+    @SuppressWarnings("unchecked")
+    @Override
+    public List<MigrationJobInfo> list() {
+        return (List<MigrationJobInfo>) super.list();
+    }
+    
     @Override
     public void extendYamlJobConfiguration(final YamlPipelineJobConfiguration 
yamlJobConfig) {
         YamlMigrationJobConfiguration config = (YamlMigrationJobConfiguration) 
yamlJobConfig;
@@ -215,16 +220,16 @@ public final class MigrationJobAPIImpl extends 
AbstractPipelineJobAPIImpl implem
         return new MigrationProcessContext(pipelineJobConfig.getJobId(), 
processConfig);
     }
     
-    protected PipelineJobInfo getJobInfo(final String jobName) {
+    @Override
+    protected MigrationJobInfo getJobInfo(final String jobName) {
         MigrationJobInfo result = new MigrationJobInfo(jobName);
         JobConfigurationPOJO jobConfigPOJO = 
getElasticJobConfigPOJO(result.getJobId());
         MigrationJobConfiguration jobConfig = 
getJobConfiguration(jobConfigPOJO);
         result.setActive(!jobConfigPOJO.isDisabled());
         result.setShardingTotalCount(jobConfig.getJobShardingCount());
-        result.setTables(jobConfig.getSourceTableName());
+        result.setTable(jobConfig.getSourceTableName());
         
result.setCreateTime(jobConfigPOJO.getProps().getProperty("create_time"));
         result.setStopTime(jobConfigPOJO.getProps().getProperty("stop_time"));
-        result.setJobParameter(jobConfigPOJO.getJobParameter());
         return result;
     }
     
diff --git 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
index 438bb2f6cc1..c63d89abccb 100644
--- 
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
@@ -28,7 +28,7 @@ import 
org.apache.shardingsphere.data.pipeline.api.job.PipelineJobId;
 import 
org.apache.shardingsphere.data.pipeline.api.job.progress.InventoryIncrementalJobItemProgress;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.CreateMigrationJobParameter;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.DataConsistencyCheckAlgorithmInfo;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
+import org.apache.shardingsphere.data.pipeline.api.pojo.MigrationJobInfo;
 import 
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPI;
 import 
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationProcessContext;
 import 
org.apache.shardingsphere.infra.config.rule.data.pipeline.PipelineProcessConfiguration;
@@ -81,7 +81,7 @@ public final class MigrationJobAPIFixture implements 
MigrationJobAPI {
     }
     
     @Override
-    public List<PipelineJobInfo> list() {
+    public List<MigrationJobInfo> list() {
         return null;
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
 
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
index a217614de46..feff2a6b343 100644
--- 
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
+++ 
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
@@ -29,7 +29,7 @@ import 
org.apache.shardingsphere.data.pipeline.api.job.JobStatus;
 import org.apache.shardingsphere.data.pipeline.api.job.JobType;
 import 
org.apache.shardingsphere.data.pipeline.api.job.progress.InventoryIncrementalJobItemProgress;
 import 
org.apache.shardingsphere.data.pipeline.api.pojo.CreateMigrationJobParameter;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
+import org.apache.shardingsphere.data.pipeline.api.pojo.MigrationJobInfo;
 import 
org.apache.shardingsphere.data.pipeline.core.api.GovernanceRepositoryAPI;
 import org.apache.shardingsphere.data.pipeline.core.api.PipelineAPIFactory;
 import 
org.apache.shardingsphere.data.pipeline.core.datasource.creator.PipelineDataSourceCreatorFactory;
@@ -94,18 +94,18 @@ public final class MigrationJobAPIImplTest {
     public void assertStartAndList() {
         Optional<String> jobId = 
jobAPI.start(JobConfigurationBuilder.createJobConfiguration());
         assertTrue(jobId.isPresent());
-        PipelineJobInfo jobInfo = getNonNullJobInfo(jobId.get());
+        MigrationJobInfo jobInfo = getNonNullJobInfo(jobId.get());
         assertTrue(jobInfo.isActive());
-        assertThat(jobInfo.getTables(), is("t_order"));
+        assertThat(jobInfo.getTable(), is("t_order"));
         assertThat(jobInfo.getShardingTotalCount(), is(1));
     }
     
-    private Optional<PipelineJobInfo> getJobInfo(final String jobId) {
+    private Optional<MigrationJobInfo> getJobInfo(final String jobId) {
         return jobAPI.list().stream().filter(each -> 
Objects.equals(each.getJobId(), jobId)).reduce((a, b) -> a);
     }
     
-    private PipelineJobInfo getNonNullJobInfo(final String jobId) {
-        Optional<PipelineJobInfo> result = getJobInfo(jobId);
+    private MigrationJobInfo getNonNullJobInfo(final String jobId) {
+        Optional<MigrationJobInfo> result = getJobInfo(jobId);
         assertTrue(result.isPresent());
         return result.get();
     }

Reply via email to