You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/11/12 11:58:31 UTC

[shardingsphere] branch master updated: Refactor DynamicSQLCaseLoaderStrategy and remove not github url loader (#22112)

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

duanzhengqiang 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 f8e2345c42c Refactor DynamicSQLCaseLoaderStrategy and remove not github url loader (#22112)
f8e2345c42c is described below

commit f8e2345c42c004a005c8f35b004d74eab1861ffa
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Nov 12 19:58:24 2022 +0800

    Refactor DynamicSQLCaseLoaderStrategy and remove not github url loader (#22112)
---
 .../parser/loader/DynamicSQLCaseGitHubLoader.java  |  5 +-
 .../parser/loader/DynamicSQLCaseGiteeLoader.java   | 57 ----------------------
 .../loader/DynamicSQLCaseLoaderStrategy.java       |  3 ++
 .../parser/loader/DynamicSQLCaseLocalLoader.java   |  2 +-
 4 files changed, 8 insertions(+), 59 deletions(-)

diff --git a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGitHubLoader.java b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGitHubLoader.java
index 6b30d86b430..93eb3fdf966 100644
--- a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGitHubLoader.java
+++ b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGitHubLoader.java
@@ -25,7 +25,10 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.Map;
 
-public class DynamicSQLCaseGitHubLoader extends DynamicLoadingSQLParserParameterizedTest implements DynamicSQLCaseLoaderStrategy {
+/**
+ * Dynamic SQL case loader with GitHub.
+ */
+public final class DynamicSQLCaseGitHubLoader extends DynamicLoadingSQLParserParameterizedTest implements DynamicSQLCaseLoaderStrategy {
     
     public DynamicSQLCaseGitHubLoader() {
         super("", "", "", new SQLParserCSVResultProcessor(""));
diff --git a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGiteeLoader.java b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGiteeLoader.java
deleted file mode 100644
index 3db9fdf01eb..00000000000
--- a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseGiteeLoader.java
+++ /dev/null
@@ -1,57 +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.sql.parser.loader;
-
-import org.apache.shardingsphere.sql.parser.base.DynamicLoadingSQLParserParameterizedTest;
-import org.apache.shardingsphere.sql.parser.result.SQLParserCSVResultProcessor;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-
-public class DynamicSQLCaseGiteeLoader extends DynamicLoadingSQLParserParameterizedTest implements DynamicSQLCaseLoaderStrategy {
-    
-    public DynamicSQLCaseGiteeLoader() {
-        super("", "", "", new SQLParserCSVResultProcessor(""));
-    }
-    
-    /**
-     * Get test parameters.
-     *
-     * @param sqlCaseTestURI the URI of sql test case
-     *
-     * @param sqlCaseResultURI the URI of sql result case
-     *
-     * @return Test cases from Gitee.
-     **/
-    public Collection<Object[]> getTestParameters(final URI sqlCaseTestURI, final URI sqlCaseResultURI) {
-        Collection<Object[]> result = new LinkedList<>();
-        Map<String, String> resultResponse = getResultResponse("https://gitee.com/api/v5/repos/", sqlCaseResultURI);
-        for (Map<String, String> each : getResponse("https://gitee.com/api/v5/repos/", sqlCaseTestURI)) {
-            String sqlCaseFileName = each.get("name").split("\\.")[0];
-            String sqlCaseTestFileContent = getContent(URI.create(each.get("download_url")));
-            String sqlCaseResultFileContent = getContent(URI.create(resultResponse.get(each.get("name"))));
-            result.addAll(getSQLCases(sqlCaseFileName, sqlCaseTestFileContent, sqlCaseResultFileContent));
-        }
-        if (result.isEmpty()) {
-            result.add(new Object[]{"", ""});
-        }
-        return result;
-    }
-}
diff --git a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLoaderStrategy.java b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLoaderStrategy.java
index a02aea56f33..cc41a15029e 100644
--- a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLoaderStrategy.java
+++ b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLoaderStrategy.java
@@ -20,6 +20,9 @@ package org.apache.shardingsphere.sql.parser.loader;
 import java.net.URI;
 import java.util.Collection;
 
+/**
+ * Dynamic SQL case loader strategy.
+ */
 public interface DynamicSQLCaseLoaderStrategy {
     
     /**
diff --git a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLocalLoader.java b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLocalLoader.java
index e0bb16c7cab..b299bcfed7f 100644
--- a/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLocalLoader.java
+++ b/test/integration-test/sql-parser/src/test/java/org/apache/shardingsphere/sql/parser/loader/DynamicSQLCaseLocalLoader.java
@@ -25,7 +25,7 @@ import java.util.Collection;
 import java.util.LinkedList;
 
 /**
- * Dynamic SQL case local loader.
+ * Dynamic SQL case loader with local file.
  */
 public final class DynamicSQLCaseLocalLoader extends DynamicLoadingSQLParserParameterizedTest implements DynamicSQLCaseLoaderStrategy {