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 84b8d574afb Add ClearHintStatementAssert and 
ClearShardingHintStatementAssert (#22742)
84b8d574afb is described below

commit 84b8d574afbc29d893c7c6f6028052d2f429043b
Author: Zichao <[email protected]>
AuthorDate: Thu Dec 8 20:10:00 2022 +1300

    Add ClearHintStatementAssert and ClearShardingHintStatementAssert (#22742)
---
 .../statement/ral/impl/HintRALStatementAssert.java | 10 +++++
 .../ral/impl/hint/ClearHintStatementAssert.java    | 49 ++++++++++++++++++++++
 .../hint/ClearShardingHintStatementAssert.java     | 49 ++++++++++++++++++++++
 3 files changed, 108 insertions(+)

diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/HintRALStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/HintRALStatementAssert.java
index 8ae1b3483ea..705d99c7bcc 100644
--- 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/HintRALStatementAssert.java
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/HintRALStatementAssert.java
@@ -20,8 +20,10 @@ package 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.distsql.parser.statement.ral.HintRALStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.hint.ClearHintStatement;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.hint.AddShardingHintDatabaseValueStatement;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.hint.AddShardingHintTableValueStatement;
+import 
org.apache.shardingsphere.sharding.distsql.parser.statement.hint.ClearShardingHintStatement;
 import 
org.apache.shardingsphere.sharding.distsql.parser.statement.hint.SetShardingHintDatabaseValueStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.SetReadwriteSplittingHintStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.ShowReadwriteSplittingHintStatusStatement;
@@ -30,6 +32,8 @@ import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hin
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.AddShardingHintDatabaseValueStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.AddShardingHintTableValueStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.ClearHintStatementAssert;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.ClearShardingHintStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.SetShardingHintDatabaseValueStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.SetReadwriteSplittingHintStatementAssert;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.hint.ShowReadwriteSplittingHintStatusStatementAssert;
@@ -38,6 +42,8 @@ import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.r
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.AddShardingHintDatabaseValueStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.AddShardingHintTableValueStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ClearHintStatementTestCase;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ClearShardingHintStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.SetShardingHintDatabaseValueStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.SetReadwriteSplittingHintStatementTestCase;
 import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ShowReadwriteSplittingHintStatusStatementTestCase;
@@ -72,6 +78,10 @@ public final class HintRALStatementAssert {
             ShowShardingHintStatusStatementAssert.assertIs(assertContext, 
(ShowShardingHintStatusStatement) actual, 
(ShowShardingHintStatusStatementTestCase) expected);
         } else if (actual instanceof ClearReadwriteSplittingHintStatement) {
             ClearReadwriteSplittingHintStatementAssert.assertIs(assertContext, 
(ClearReadwriteSplittingHintStatement) actual, 
(ClearReadwriteSplittingHintStatementTestCase) expected);
+        } else if (actual instanceof ClearShardingHintStatement) {
+            ClearShardingHintStatementAssert.assertIs(assertContext, 
(ClearShardingHintStatement) actual, (ClearShardingHintStatementTestCase) 
expected);
+        } else if (actual instanceof ClearHintStatement) {
+            ClearHintStatementAssert.assertIs(assertContext, 
(ClearHintStatement) actual, (ClearHintStatementTestCase) expected);
         }
     }
 }
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearHintStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearHintStatementAssert.java
new file mode 100644
index 00000000000..24f0407cc51
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearHintStatementAssert.java
@@ -0,0 +1,49 @@
+/*
+ * 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.asserts.statement.ral.impl.hint;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.hint.ClearHintStatement;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ClearHintStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Clear hint statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ClearHintStatementAssert {
+    
+    /**
+     * Assert clear hint statement is correct with expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual clear hint statement
+     * @param expected expected clear hint statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final ClearHintStatement actual, final ClearHintStatementTestCase expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should 
exist."), actual);
+        }
+    }
+}
diff --git 
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearShardingHintStatementAssert.java
 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearShardingHintStatementAssert.java
new file mode 100644
index 00000000000..11868169102
--- /dev/null
+++ 
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/hint/ClearShardingHintStatementAssert.java
@@ -0,0 +1,49 @@
+/*
+ * 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.asserts.statement.ral.impl.hint;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sharding.distsql.parser.statement.hint.ClearShardingHintStatement;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import 
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.ClearShardingHintStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Clear sharding hint statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ClearShardingHintStatementAssert {
+    
+    /**
+     * Assert clear sharding hint statement is correct with expected parser 
result.
+     *
+     * @param assertContext assert context
+     * @param actual actual clear sharding hint statement
+     * @param expected expected clear sharding hint statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, 
final ClearShardingHintStatement actual, final 
ClearShardingHintStatementTestCase expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not 
exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should 
exist."), actual);
+        }
+    }
+}

Reply via email to