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/09/06 10:42:35 UTC
[shardingsphere] branch master updated: [Issue #20370]-Added unit test for FlushStatementHandler (#20829)
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 2dc8460039b [Issue #20370]-Added unit test for FlushStatementHandler (#20829)
2dc8460039b is described below
commit 2dc8460039b89d25d6ce3c50d578d2137056f20c
Author: Abhinav Koppula <ab...@gmail.com>
AuthorDate: Tue Sep 6 16:12:26 2022 +0530
[Issue #20370]-Added unit test for FlushStatementHandler (#20829)
---
.../handler/dal/FlushStatementHandlerTest.java | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dal/FlushStatementHandlerTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dal/FlushStatementHandlerTest.java
new file mode 100644
index 00000000000..b16bd851762
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dal/FlushStatementHandlerTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sql.dialect.handler.dal;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLFlushStatement;
+import org.junit.Test;
+
+public final class FlushStatementHandlerTest {
+
+ @Test
+ public void assertGetSimpleTableSegmentForMySQL() {
+ MySQLFlushStatement mySQLFlushStatement = new MySQLFlushStatement();
+ assertTrue(FlushStatementHandler.getSimpleTableSegment(mySQLFlushStatement).isEmpty());
+ mySQLFlushStatement.getTables().add(new SimpleTableSegment(new TableNameSegment(0, 2, new IdentifierValue("foo_table"))));
+ assertThat(FlushStatementHandler.getSimpleTableSegment(mySQLFlushStatement), is(mySQLFlushStatement.getTables()));
+ }
+
+ @Test
+ public void assertGetSimpleTableSegmentForOtherDatabases() {
+ assertTrue(FlushStatementHandler.getSimpleTableSegment(null).isEmpty());
+ }
+}