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/05/10 01:23:03 UTC
[shardingsphere] branch master updated: Add unit test for SingleTableMetadataValidatorFactory (#17475)
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 62b89c1fe29 Add unit test for SingleTableMetadataValidatorFactory (#17475)
62b89c1fe29 is described below
commit 62b89c1fe2929bd48ca6c779421db8ba803cd35f
Author: VOPEN.XYZ <x_...@yeah.net>
AuthorDate: Tue May 10 09:22:53 2022 +0800
Add unit test for SingleTableMetadataValidatorFactory (#17475)
* Add unit test for SingleTableMetadataValidatorFactory
* Removed useless blank lines .
* Update SingleTableMetadataValidatorFactoryTest.java
Removed useless blank line.
---
.../SingleTableMetadataValidatorFactoryTest.java | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/route/validator/SingleTableMetadataValidatorFactoryTest.java b/shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/route/validator/SingleTableMetadataValidatorFactoryTest.java
new file mode 100644
index 00000000000..7118df0d488
--- /dev/null
+++ b/shardingsphere-kernel/shardingsphere-single-table/shardingsphere-single-table-core/src/test/java/org/apache/shardingsphere/singletable/route/validator/SingleTableMetadataValidatorFactoryTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.singletable.route.validator;
+
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropSchemaStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropSchemaStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerDropSchemaStatement;
+import org.junit.Test;
+
+import java.util.Optional;
+
+import static org.junit.Assert.assertTrue;
+
+public final class SingleTableMetadataValidatorFactoryTest {
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void assertNewInstanceForPostgreSQL() {
+ SQLStatement statement = new PostgreSQLDropSchemaStatement();
+ Optional<SingleTableMetadataValidator> actual = SingleTableMetadataValidatorFactory.newInstance(statement);
+ assertTrue(actual.isPresent());
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void assertNewInstanceForSQLServer() {
+ SQLStatement statement = new SQLServerDropSchemaStatement();
+ Optional<SingleTableMetadataValidator> actual = SingleTableMetadataValidatorFactory.newInstance(statement);
+ assertTrue(actual.isPresent());
+ }
+
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void assertNewInstanceForOpenGauss() {
+ SQLStatement statement = new OpenGaussDropSchemaStatement();
+ Optional<SingleTableMetadataValidator> actual = SingleTableMetadataValidatorFactory.newInstance(statement);
+ assertTrue(actual.isPresent());
+ }
+}