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

jianglongtao 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 e94d5765f67 Add RQL parser test case for `mask rule` (#23471)
e94d5765f67 is described below

commit e94d5765f6782c5239162048f5e0bb65b0ff902c
Author: Zichao <[email protected]>
AuthorDate: Tue Jan 10 21:43:23 2023 +1300

    Add RQL parser test case for `mask rule` (#23471)
    
    * Add RQL parser test case for `mask rule`
    
    * Add RQL parser test for `mask rule`
---
 .../cases/parser/jaxb/RootSQLParserTestCases.java  |  8 +++++
 .../rule/mask/CountMaskRuleStatementTestCase.java  | 26 ++++++++++++++++
 .../rule/mask/ShowMaskRulesStatementTestCase.java  | 35 ++++++++++++++++++++++
 .../it/parser/src/main/resources/case/rql/show.xml |  8 +++++
 .../src/main/resources/sql/supported/rql/show.xml  |  2 ++
 5 files changed, 79 insertions(+)

diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index 6674cdd56ed..5f67a932e98 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -387,6 +387,8 @@ import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.dbdiscovery.ShowDatabaseDiscoveryRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.encrypt.CountEncryptRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.encrypt.ShowEncryptRulesStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.mask.CountMaskRuleStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.mask.ShowMaskRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.readwritesplitting.CountReadwriteSplittingRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.readwritesplitting.ShowReadwriteSplittingRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.shadow.CountShadowRuleStatementTestCase;
@@ -1253,6 +1255,9 @@ public final class RootSQLParserTestCases {
     @XmlElement(name = "show-default-sharding-strategy")
     private final List<ShowDefaultShardingStrategyStatementTestCase> 
showDefaultShardingStrategyTestCases = new LinkedList<>();
     
+    @XmlElement(name = "show-mask-rules")
+    private final List<ShowMaskRulesStatementTestCase> 
showMaskRulesStatementTestCases = new LinkedList<>();
+    
     @XmlElement(name = "delimiter")
     private final List<DelimiterStatementTestCase> delimiterTestCases = new 
LinkedList<>();
     
@@ -1604,6 +1609,9 @@ public final class RootSQLParserTestCases {
     @XmlElement(name = "count-shadow-rule")
     private final List<CountShadowRuleStatementTestCase> 
countShadowRuleStatementTestCases = new LinkedList<>();
     
+    @XmlElement(name = "count-mask-rule")
+    private final List<CountMaskRuleStatementTestCase> 
countMaskRuleStatementTestCases = new LinkedList<>();
+    
     @XmlElement(name = "create-collation")
     private final List<CreateCollationStatementTestCase> 
createCollationStatementTestCases = new LinkedList<>();
     
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/CountMaskRuleStatementTestCase.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/CountMaskRuleStatementTestCase.java
new file mode 100644
index 00000000000..5757b24d4f9
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/CountMaskRuleStatementTestCase.java
@@ -0,0 +1,26 @@
+/*
+ * 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.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.mask;
+
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.DatabaseContainedTestCase;
+
+/**
+ * Count mask rule statement test case.
+ */
+public final class CountMaskRuleStatementTestCase extends 
DatabaseContainedTestCase {
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/ShowMaskRulesStatementTestCase.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/ShowMaskRulesStatementTestCase.java
new file mode 100644
index 00000000000..1ab8bd1cfeb
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/mask/ShowMaskRulesStatementTestCase.java
@@ -0,0 +1,35 @@
+/*
+ * 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.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.mask;
+
+import lombok.Getter;
+import lombok.Setter;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.DatabaseContainedTestCase;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Show mask rules statement test case.
+ */
+@Getter
+@Setter
+public final class ShowMaskRulesStatementTestCase extends 
DatabaseContainedTestCase {
+    
+    @XmlAttribute
+    private String name;
+}
diff --git a/test/it/parser/src/main/resources/case/rql/show.xml 
b/test/it/parser/src/main/resources/case/rql/show.xml
index 99db2ee61f4..bf7e8455fc4 100644
--- a/test/it/parser/src/main/resources/case/rql/show.xml
+++ b/test/it/parser/src/main/resources/case/rql/show.xml
@@ -107,6 +107,10 @@
         <database name="sharding_db" start-index="36" stop-index="46" />
     </show-default-sharding-strategy>
     
+    <show-mask-rules sql-case-id="show-mask-rules">
+        <database name="mask_db" start-index="21" stop-index="27" />
+    </show-mask-rules>
+    
     <show-unused-sharding-algorithms 
sql-case-id="show-unused-sharding-algorithms">
         <database name="databaseName" start-index="37" stop-index="48" />
     </show-unused-sharding-algorithms>
@@ -158,4 +162,8 @@
     <count-shadow-rule sql-case-id="count-shadow-rule">
         <database name="db1" start-index="23" stop-index="25" />
     </count-shadow-rule>
+    
+    <count-mask-rule sql-case-id="count-mask-rule">
+        <database name="db1" start-index="21" stop-index="23" />
+    </count-mask-rule>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/rql/show.xml 
b/test/it/parser/src/main/resources/sql/supported/rql/show.xml
index 09dfb95c00c..5ae330176d9 100644
--- a/test/it/parser/src/main/resources/sql/supported/rql/show.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rql/show.xml
@@ -39,6 +39,7 @@
     <sql-case id="show-sharding-table-nodes" value="SHOW SHARDING TABLE NODES 
t_order FROM sharding_db" db-types="ShardingSphere" />
     <sql-case id="show-sharding-key-generators" value="SHOW SHARDING KEY 
GENERATORS FROM sharding_db" db-types="ShardingSphere" />
     <sql-case id="show-default-sharding-strategy" value="SHOW DEFAULT SHARDING 
STRATEGY FROM sharding_db" db-types="ShardingSphere" />
+    <sql-case id="show-mask-rules" value="SHOW MASK RULES FROM mask_db" 
db-types="ShardingSphere" />
     <sql-case id="show-unused-sharding-algorithms" value="SHOW UNUSED SHARDING 
ALGORITHMS FROM databaseName" db-types="ShardingSphere" />
     <sql-case id="show-unused-sharding-key-generators" value="SHOW UNUSED 
SHARDING KEY GENERATORS FROM databaseName" db-types="ShardingSphere" />
     <sql-case id="show-unused-sharding-auditors" value="SHOW UNUSED SHARDING 
AUDITORS FROM databaseName" db-types="ShardingSphere" />
@@ -52,4 +53,5 @@
     <sql-case id="count-db-discovery-rule" value="COUNT DB_DISCOVERY RULE FROM 
db1" db-types="ShardingSphere" />
     <sql-case id="count-encrypt-rule" value="COUNT ENCRYPT RULE FROM db1" 
db-types="ShardingSphere" />
     <sql-case id="count-shadow-rule" value="COUNT SHADOW RULE FROM db1" 
db-types="ShardingSphere" />
+    <sql-case id="count-mask-rule" value="COUNT MASK RULE FROM db1" 
db-types="ShardingSphere" />
 </sql-cases>

Reply via email to