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 c1c5957e779 Add DROP MIGRATION SOURCE RESOURCE DistSQL and 
implementation (#20307)
c1c5957e779 is described below

commit c1c5957e7796a4e9872a11228c443e85eea9f0cc
Author: Xinze Guo <[email protected]>
AuthorDate: Fri Aug 19 21:41:58 2022 +0800

    Add DROP MIGRATION SOURCE RESOURCE DistSQL and implementation (#20307)
    
    * Add DROP MIGRATION SOURCE RESOURCE DistSQL and implementation
    
    * Fix ci error
---
 .../update/DropMigrationSourceResourceUpdater.java | 43 +++++++++++++++++++
 ....shardingsphere.infra.distsql.update.RALUpdater |  1 +
 .../main/antlr4/imports/migration/RALStatement.g4  |  4 ++
 .../parser/autogen/MigrationDistSQLStatement.g4    |  1 +
 .../core/MigrationDistSQLStatementVisitor.java     | 12 +++++-
 .../DropMigrationSourceResourceStatement.java}     | 39 +++++++----------
 .../data/pipeline/api/MigrationJobPublicAPI.java   |  7 +++
 .../DropMigrationSourceResourceException.java      | 40 +++++++----------
 .../scenario/migration/MigrationJobAPIImpl.java    | 14 ++++++
 .../core/fixture/MigrationJobAPIFixture.java       |  4 ++
 .../UpdatableScalingRALStatementAssert.java        |  9 +++-
 ...DropMigrationSourceResourceStatementAssert.java | 50 ++++++++++++++++++++++
 .../jaxb/cases/domain/SQLParserTestCases.java      |  6 ++-
 ...ddMigrationSourceResourceStatementTestCase.java |  2 +-
 ...pMigrationSourceResourceStatementTestCase.java} |  7 ++-
 .../src/main/resources/case/ral/migration.xml      |  5 +++
 .../main/resources/sql/supported/ral/migration.xml |  1 +
 17 files changed, 188 insertions(+), 57 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/DropMigrationSourceResourceUpdater.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/DropMigrationSourceResourceUpdater.java
new file mode 100644
index 00000000000..70a3f046b05
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/DropMigrationSourceResourceUpdater.java
@@ -0,0 +1,43 @@
+/*
+ * 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.migration.distsql.handler.update;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.data.pipeline.api.MigrationJobPublicAPI;
+import org.apache.shardingsphere.data.pipeline.api.PipelineJobPublicAPIFactory;
+import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
+import 
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
+
+/**
+ * Drop migration source resource updater.
+ */
+@Slf4j
+public final class DropMigrationSourceResourceUpdater implements 
RALUpdater<DropMigrationSourceResourceStatement> {
+    
+    private static final MigrationJobPublicAPI JOB_API = 
PipelineJobPublicAPIFactory.getMigrationJobPublicAPI();
+    
+    @Override
+    public void executeUpdate(final String databaseName, final 
DropMigrationSourceResourceStatement sqlStatement) {
+        JOB_API.dropMigrationSourceResources(sqlStatement.getNames());
+    }
+    
+    @Override
+    public String getType() {
+        return DropMigrationSourceResourceStatement.class.getName();
+    }
+}
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
index d5e9ec7516e..67290b1ac15 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
@@ -24,3 +24,4 @@ 
org.apache.shardingsphere.migration.distsql.handler.update.StopMigrationSourceWr
 
org.apache.shardingsphere.migration.distsql.handler.update.RestoreMigrationSourceWritingUpdater
 
org.apache.shardingsphere.migration.distsql.handler.update.ApplyMigrationUpdater
 
org.apache.shardingsphere.migration.distsql.handler.update.AddMigrationSourceResourceUpdater
+org.apache.shardingsphere.migration.distsql.handler.update.DropMigrationSourceResourceUpdater
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/migration/RALStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/migration/RALStatement.g4
index 82f4e99aff8..9c799a400db 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/migration/RALStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/migration/RALStatement.g4
@@ -134,3 +134,7 @@ password
 addMigrationSourceResource
     : ADD MIGRATION SOURCE RESOURCE resourceDefinition (COMMA 
resourceDefinition)*
     ;
+    
+dropMigrationSourceResource
+    : DROP MIGRATION SOURCE RESOURCE resourceName (COMMA resourceName)*
+    ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
index 4d65113f249..df0c8e1b5c4 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
@@ -38,5 +38,6 @@ execute
     | enableShardingScalingRule
     | disableShardingScalingRule
     | addMigrationSourceResource
+    | dropMigrationSourceResource
     ) SEMI?
     ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
index 7c926671bed..54e8a0bcc09 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
@@ -26,11 +26,12 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatemen
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ApplyScalingContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.BatchSizeContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CheckScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CleanScalingContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CompletionDetectorContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CreateShardingScalingRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.DataConsistencyCheckerContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.DisableShardingScalingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CleanScalingContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.DropMigrationSourceResourceContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.EnableShardingScalingRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.InputDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.MigrateTableContext;
@@ -61,9 +62,10 @@ import 
org.apache.shardingsphere.distsql.parser.segment.URLBasedDataSourceSegmen
 import 
org.apache.shardingsphere.migration.distsql.statement.AddMigrationSourceResourceStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.CheckMigrationStatement;
+import 
org.apache.shardingsphere.migration.distsql.statement.CleanMigrationStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.CreateShardingScalingRuleStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.DisableShardingScalingRuleStatement;
-import 
org.apache.shardingsphere.migration.distsql.statement.CleanMigrationStatement;
+import 
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.DropShardingScalingRuleStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.EnableShardingScalingRuleStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.MigrateTableStatement;
@@ -87,6 +89,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Properties;
+import java.util.stream.Collectors;
 
 /**
  * SQL statement visitor for migration dist SQL.
@@ -327,4 +330,9 @@ public final class MigrationDistSQLStatementVisitor extends 
MigrationDistSQLStat
         }
         return new AddMigrationSourceResourceStatement(dataSources);
     }
+    
+    @Override
+    public ASTNode visitDropMigrationSourceResource(final 
DropMigrationSourceResourceContext ctx) {
+        return new 
DropMigrationSourceResourceStatement(ctx.resourceName().stream().map(ParseTree::getText).map(each
 -> new IdentifierValue(each).getValue()).collect(Collectors.toList()));
+    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/DropMigrationSourceResourceStatement.java
similarity index 57%
copy from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/DropMigrationSourceResourceStatement.java
index 4d65113f249..e043bf95f3f 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/DropMigrationSourceResourceStatement.java
@@ -15,28 +15,21 @@
  * limitations under the License.
  */
 
-grammar MigrationDistSQLStatement;
+package org.apache.shardingsphere.migration.distsql.statement;
 
-import Symbol, RALStatement, RDLStatement, RQLStatement;
+import lombok.Getter;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
 
-execute
-    : (showScalingList
-    | showScalingStatus
-    | migrateTable
-    | startScaling
-    | stopScaling
-    | cleanScaling
-    | resetScaling
-    | checkScaling
-    | showScalingCheckAlgorithms
-    | stopScalingSourceWriting
-    | restoreScalingSourceWriting
-    | applyScaling
-    | showShardingScalingRules
-    | createShardingScalingRule
-    | dropShardingScalingRule
-    | enableShardingScalingRule
-    | disableShardingScalingRule
-    | addMigrationSourceResource
-    ) SEMI?
-    ;
+import java.util.Collection;
+
+/**
+ * Drop resource statement.
+ */
+@Getter
+public final class DropMigrationSourceResourceStatement extends 
UpdatableScalingRALStatement {
+    private final Collection<String> names;
+    
+    public DropMigrationSourceResourceStatement(final Collection<String> 
names) {
+        this.names = names;
+    }
+}
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 7787f4d31b3..ce1e9f18b28 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
@@ -119,4 +119,11 @@ public interface MigrationJobPublicAPI extends 
PipelineJobPublicAPI, RequiredSPI
      * @param sourcePropertiesMap source properties map
      */
     void addMigrationSourceResources(Map<String, DataSourceProperties> 
sourcePropertiesMap);
+    
+    /**
+     * Drop migration source resource.
+     *
+     * @param resourceNames resource names
+     */
+    void dropMigrationSourceResources(Collection<String> resourceNames);
 }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/DropMigrationSourceResourceException.java
similarity index 57%
copy from 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
copy to 
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/DropMigrationSourceResourceException.java
index 4d65113f249..b8cc1184fc9 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
+++ 
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/DropMigrationSourceResourceException.java
@@ -15,28 +15,20 @@
  * limitations under the License.
  */
 
-grammar MigrationDistSQLStatement;
+package org.apache.shardingsphere.data.pipeline.core.exception;
 
-import Symbol, RALStatement, RDLStatement, RQLStatement;
-
-execute
-    : (showScalingList
-    | showScalingStatus
-    | migrateTable
-    | startScaling
-    | stopScaling
-    | cleanScaling
-    | resetScaling
-    | checkScaling
-    | showScalingCheckAlgorithms
-    | stopScalingSourceWriting
-    | restoreScalingSourceWriting
-    | applyScaling
-    | showShardingScalingRules
-    | createShardingScalingRule
-    | dropShardingScalingRule
-    | enableShardingScalingRule
-    | disableShardingScalingRule
-    | addMigrationSourceResource
-    ) SEMI?
-    ;
+/**
+ * Drop migration source resource exception.
+ */
+public final class DropMigrationSourceResourceException extends 
RuntimeException {
+    
+    private static final long serialVersionUID = 1L;
+    
+    public DropMigrationSourceResourceException(final String message) {
+        super(message);
+    }
+    
+    public DropMigrationSourceResourceException(final Throwable cause) {
+        super(cause);
+    }
+}
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 0508bcf0d17..ba19be8209e 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,6 +48,7 @@ import 
org.apache.shardingsphere.data.pipeline.core.check.consistency.DataConsis
 import 
org.apache.shardingsphere.data.pipeline.core.check.consistency.DataConsistencyChecker;
 import org.apache.shardingsphere.data.pipeline.core.context.PipelineContext;
 import 
org.apache.shardingsphere.data.pipeline.core.exception.AddMigrationSourceResourceException;
+import 
org.apache.shardingsphere.data.pipeline.core.exception.DropMigrationSourceResourceException;
 import 
org.apache.shardingsphere.data.pipeline.core.exception.PipelineVerifyFailedException;
 import org.apache.shardingsphere.data.pipeline.core.job.PipelineJobCenter;
 import 
org.apache.shardingsphere.data.pipeline.core.job.progress.PipelineJobProgressDetector;
@@ -431,6 +432,19 @@ public final class MigrationJobAPIImpl extends 
AbstractPipelineJobAPIImpl implem
         pipelineResourceAPI.persistMetaDataDataSource(JobType.MIGRATION, 
result);
     }
     
+    @Override
+    public void dropMigrationSourceResources(final Collection<String> 
resourceNames) {
+        Map<String, DataSourceProperties> metaDataDataSource = 
pipelineResourceAPI.getMetaDataDataSource(JobType.MIGRATION);
+        List<String> noExistResources = resourceNames.stream().filter(each -> 
!metaDataDataSource.containsKey(each)).collect(Collectors.toList());
+        if (!noExistResources.isEmpty()) {
+            throw new 
DropMigrationSourceResourceException(String.format("Resource names %s not 
exist.", resourceNames));
+        }
+        for (String each : resourceNames) {
+            metaDataDataSource.remove(each);
+        }
+        pipelineResourceAPI.persistMetaDataDataSource(JobType.MIGRATION, 
metaDataDataSource);
+    }
+    
     @Override
     public String getType() {
         return JobType.MIGRATION.getTypeName();
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 3a29eb699e6..5b313dbac2a 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
@@ -149,6 +149,10 @@ public final class MigrationJobAPIFixture implements 
MigrationJobAPI {
     public void addMigrationSourceResources(final Map<String, 
DataSourceProperties> sourcePropertiesMap) {
     }
     
+    @Override
+    public void dropMigrationSourceResources(final Collection<String> 
resourceNames) {
+    }
+    
     @Override
     public MigrationJobConfiguration getJobConfiguration(final String jobId) {
         return null;
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
index 8b4878c17ae..a0a1f3483d8 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
@@ -23,6 +23,7 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableS
 import 
org.apache.shardingsphere.migration.distsql.statement.AddMigrationSourceResourceStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.CleanMigrationStatement;
+import 
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.MigrateTableStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.ResetMigrationStatement;
 import 
org.apache.shardingsphere.migration.distsql.statement.RestoreMigrationSourceWritingStatement;
@@ -33,6 +34,7 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAs
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.AddMigrationSourceResourceStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.ApplyMigrationStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.CleanMigrationStatementAssert;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.DropMigrationSourceResourceStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.MigrateTableStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.ResetMigrationStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.RestoreMigrationSourceWritingStatementAssert;
@@ -40,15 +42,16 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.StopMigrationSourceWritingStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.StopMigrationStatementAssert;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ApplyMigrationStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CleanMigrationStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.DropMigrationSourceResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.MigrateTableStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ResetMigrationStatementTestCase;
-import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CleanMigrationStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.RestoreMigrationSourceWritingStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StartMigrationStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationSourceWritingStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationStatementTestCase;
-import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
 
 /**
  * Updatable Scaling RAL statement assert.
@@ -83,6 +86,8 @@ public final class UpdatableScalingRALStatementAssert {
             StartMigrationStatementAssert.assertIs(assertContext, 
(StartMigrationStatement) actual, (StartMigrationStatementTestCase) expected);
         } else if (actual instanceof AddMigrationSourceResourceStatement) {
             AddMigrationSourceResourceStatementAssert.assertIs(assertContext, 
(AddMigrationSourceResourceStatement) actual, 
(AddMigrationSourceResourceStatementTestCase) expected);
+        } else if (actual instanceof DropMigrationSourceResourceStatement) {
+            DropMigrationSourceResourceStatementAssert.assertIs(assertContext, 
(DropMigrationSourceResourceStatement) actual, 
(DropMigrationSourceResourceStatementTestCase) expected);
         }
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/DropMigrationSourceResourceStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/DropMigrationSourceResourceStatementAssert.java
new file mode 100644
index 00000000000..d5adf906ebc
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/DropMigrationSourceResourceStatementAssert.java
@@ -0,0 +1,50 @@
+/*
+ * 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.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.DropMigrationSourceResourceStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Drop Resource statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DropMigrationSourceResourceStatementAssert {
+    
+    /**
+     * Assert drop migration source resource statement is correct with 
expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual drop resource statement
+     * @param expected expected drop resource statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final DropMigrationSourceResourceStatement actual, final 
DropMigrationSourceResourceStatementTestCase expected) {
+        if (null == expected.getDataSources()) {
+            assertNull(assertContext.getText("Actual resource should not 
exist."), actual);
+        } else {
+            assertThat(assertContext.getText("resource assertion error: "), 
actual.getNames(), is(expected.getDataSources()));
+        }
+    }
+}
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index daf9654fcbe..a1c6dd42c30 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -306,9 +306,11 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowTransactionRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowVariableStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.UnlabelInstanceStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ApplyMigrationStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CheckMigrationStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CleanMigrationStatementTestCase;
+import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.DropMigrationSourceResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.MigrateTableStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ResetMigrationStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.RestoreMigrationSourceWritingStatementTestCase;
@@ -337,7 +339,6 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShardingTableRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.DisableShardingScalingRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.EnableShardingScalingRuleStatementTestCase;
-import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.AddResourceStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateDatabaseDiscoveryConstructionRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateDatabaseDiscoveryDefinitionRuleStatementTestCase;
@@ -1667,6 +1668,9 @@ public final class SQLParserTestCases {
     @XmlElement(name = "create-operator")
     private final List<CreateOperatorStatementTestCase> 
createOperatorStatementTestCases = new LinkedList<>();
     
+    @XmlElement(name = "drop-migration-source-resource")
+    private final List<DropMigrationSourceResourceStatementTestCase> 
dropMigrationSourceResourceTestCases = new LinkedList<>();
+    
     /**
      * Get all SQL parser test cases.
      *
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
index f8f5c464269..6cec74dd815 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
@@ -26,7 +26,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 /**
- * Apply migration statement test case.
+ * Add migration statement test case.
  */
 @Getter
 public final class AddMigrationSourceResourceStatementTestCase extends 
SQLParserTestCase {
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/DropMigrationSourceResourceStatementTestCase.java
similarity index 78%
copy from 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
copy to 
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/DropMigrationSourceResourceStatementTestCase.java
index f8f5c464269..1d66481e98e 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/AddMigrationSourceResourceStatementTestCase.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/DropMigrationSourceResourceStatementTestCase.java
@@ -18,7 +18,6 @@
 package 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration;
 
 import lombok.Getter;
-import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.ExpectedDataSource;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
 
 import javax.xml.bind.annotation.XmlElement;
@@ -26,11 +25,11 @@ import java.util.LinkedList;
 import java.util.List;
 
 /**
- * Apply migration statement test case.
+ * Drop migration statement test case.
  */
 @Getter
-public final class AddMigrationSourceResourceStatementTestCase extends 
SQLParserTestCase {
+public final class DropMigrationSourceResourceStatementTestCase extends 
SQLParserTestCase {
     
     @XmlElement(name = "data-source")
-    private final List<ExpectedDataSource> dataSources = new LinkedList<>();
+    private final List<String> dataSources = new LinkedList<>();
 }
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
index e620dc9fed1..6a7b76acb8b 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
@@ -77,4 +77,9 @@
     <start-scaling sql-case-id="start-scaling">
         <job-id>123</job-id>
     </start-scaling>
+    
+    <drop-migration-source-resource 
sql-case-id="drop-migration-source-resource">
+        <data-source>ds_0</data-source>
+        <data-source>ds_1</data-source>
+    </drop-migration-source-resource>
 </sql-parser-test-cases>
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
index 3511bb87c08..5189569af6a 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
@@ -32,4 +32,5 @@
     <distsql-case id="reset-scaling" value="RESET SCALING 123;" />
     <distsql-case id="stop-scaling" value="STOP SCALING 123;" />
     <distsql-case id="start-scaling" value="START SCALING 123;" />
+    <distsql-case id="drop-migration-source-resource" value="DROP MIGRATION 
SOURCE RESOURCE ds_0,ds_1" />
 </sql-cases>

Reply via email to