You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/11/15 16:59:28 UTC

[shardingsphere] branch master updated: test(issue-21461): ShowReadwriteSplittingHintStatusStatement (#22175)

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 8aab5418794 test(issue-21461): ShowReadwriteSplittingHintStatusStatement (#22175)
8aab5418794 is described below

commit 8aab54187941c8f76dc179c0ccba3eba9d589562
Author: Xin Huang <57...@users.noreply.github.com>
AuthorDate: Wed Nov 16 00:59:20 2022 +0800

    test(issue-21461): ShowReadwriteSplittingHintStatusStatement (#22175)
    
    * test(issue-21461): ShowReadwriteSplittingHintStatusStatement
    
    * bugfix(issue-21461): rename readwrite-splitting
---
 .../distsql/ral/impl/HintRALStatementAssert.java   |  5 +++
 ...eadwriteSplittingHintStatusStatementAssert.java | 49 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/HintRALStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/HintRALStatementAssert.java
index 11c63ef31e3..c0d83343b0d 100644
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/HintRALStatementAssert.java
+++ b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/HintRALStatementAssert.java
@@ -24,16 +24,19 @@ import org.apache.shardingsphere.sharding.distsql.parser.statement.hint.AddShard
 import org.apache.shardingsphere.sharding.distsql.parser.statement.hint.AddShardingHintTableValueStatement;
 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;
 import org.apache.shardingsphere.test.sql.parser.internal.asserts.SQLCaseAssertContext;
 import org.apache.shardingsphere.test.sql.parser.internal.asserts.statement.distsql.ral.impl.hint.AddShardingHintDatabaseValueStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.internal.asserts.statement.distsql.ral.impl.hint.AddShardingHintTableValueStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.internal.asserts.statement.distsql.ral.impl.hint.SetShardingHintDatabaseValueStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.internal.asserts.statement.distsql.ral.impl.hint.SetReadwriteSplittingHintStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.internal.asserts.statement.distsql.ral.impl.hint.ShowReadwriteSplittingHintStatusStatementAssert;
 import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.SQLParserTestCase;
 import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.AddShardingHintDatabaseValueStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.AddShardingHintTableValueStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.SetShardingHintDatabaseValueStatementTestCase;
 import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.SetReadwriteSplittingHintStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingHintStatusStatementTestCase;
 
 /**
  * Hint RAL statement assert.
@@ -57,6 +60,8 @@ public class HintRALStatementAssert {
             SetShardingHintDatabaseValueStatementAssert.assertIs(assertContext, (SetShardingHintDatabaseValueStatement) actual, (SetShardingHintDatabaseValueStatementTestCase) expected);
         } else if (actual instanceof SetReadwriteSplittingHintStatement) {
             SetReadwriteSplittingHintStatementAssert.assertIs(assertContext, (SetReadwriteSplittingHintStatement) actual, (SetReadwriteSplittingHintStatementTestCase) expected);
+        } else if (actual instanceof ShowReadwriteSplittingHintStatusStatement) {
+            ShowReadwriteSplittingHintStatusStatementAssert.assertIs(assertContext, (ShowReadwriteSplittingHintStatusStatement) actual, (ShowReadwriteSplittingHintStatusStatementTestCase) expected);
         }
     }
 }
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/hint/ShowReadwriteSplittingHintStatusStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/hint/ShowReadwriteSplittingHintStatusStatementAssert.java
new file mode 100644
index 00000000000..ed45aa60614
--- /dev/null
+++ b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/distsql/ral/impl/hint/ShowReadwriteSplittingHintStatusStatementAssert.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.sql.parser.internal.asserts.statement.distsql.ral.impl.hint;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.ShowReadwriteSplittingHintStatusStatement;
+import org.apache.shardingsphere.test.sql.parser.internal.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingHintStatusStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Add readwrite-splitting hint status statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class ShowReadwriteSplittingHintStatusStatementAssert {
+    
+    /**
+     * Assert show readwrite-splitting hint status statement is correct with expected parser result.
+     *
+     * @param assertContext assert context
+     * @param actual actual show readwrite-splitting status statement
+     * @param expected expected show readwrite-splitting status statement test case
+     */
+    public static void assertIs(final SQLCaseAssertContext assertContext, final ShowReadwriteSplittingHintStatusStatement actual, final ShowReadwriteSplittingHintStatusStatementTestCase expected) {
+        if (null == expected) {
+            assertNull(assertContext.getText("Actual statement should not exist."), actual);
+        } else {
+            assertNotNull(assertContext.getText("Actual statement should exist."), actual);
+        }
+    }
+}