You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by xi...@apache.org on 2020/10/19 07:32:41 UTC
[shardingsphere] branch master updated: Add
PostgreSQLDatabaseMetaDataDialectHandlerTest (#7842) (#7845)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu 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 cfe24a5 Add PostgreSQLDatabaseMetaDataDialectHandlerTest (#7842) (#7845)
cfe24a5 is described below
commit cfe24a519edf331d59d87d5259e5af4aa993a74d
Author: lzn312 <51...@qq.com>
AuthorDate: Mon Oct 19 15:31:26 2020 +0800
Add PostgreSQLDatabaseMetaDataDialectHandlerTest (#7842) (#7845)
* Add PostgreSQLDatabaseMetaDataDialectHandlerTest (#7842)
* Add PostgreSQLDatabaseMetaDataDialectHandlerTest (#7842)
---
...stgreSQLDatabaseMetaDataDialectHandlerTest.java | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/model/physical/jdbc/handler/PostgreSQLDatabaseMetaDataDialectHandlerTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/model/physical/jdbc/handler/PostgreSQLDatabaseMetaDataDialectHandlerTest.java
new file mode 100644
index 0000000..6708ea2
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/model/physical/jdbc/handler/PostgreSQLDatabaseMetaDataDialectHandlerTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.infra.metadata.model.physical.jdbc.handler;
+
+import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
+import org.junit.Test;
+
+import java.sql.SQLException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.when;
+
+public final class PostgreSQLDatabaseMetaDataDialectHandlerTest extends AbstractDatabaseMetaDataDialectHandlerTest {
+
+ @Test
+ public void assertGetSchema() throws SQLException {
+ when(getConnection().getSchema()).thenReturn(DATABASE_NAME);
+ String postgresqlSchema = getSchema(new PostgreSQLDatabaseType());
+ assertThat(postgresqlSchema, is(DATABASE_NAME));
+ }
+
+ @Test
+ public void assertFormatTableNamePattern() {
+ String postgresqlTableNamePattern = formatTableNamePattern(new PostgreSQLDatabaseType());
+ assertThat(postgresqlTableNamePattern, is(TABLE_NAME_PATTERN));
+ }
+
+ @Test
+ public void assertGetQuoteCharacter() {
+ QuoteCharacter postgresqlQuoteCharacter = getQuoteCharacter(new PostgreSQLDatabaseType());
+ assertThat(postgresqlQuoteCharacter.getStartDelimiter(), is("\""));
+ assertThat(postgresqlQuoteCharacter.getEndDelimiter(), is("\""));
+ }
+}