This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 ab3a05a0ca8 Add coverage for metadata helpers across dialects (#37578)
ab3a05a0ca8 is described below
commit ab3a05a0ca8220c9b8b8f48b3cc0542c6e327d80
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 30 13:33:23 2025 +0800
Add coverage for metadata helpers across dialects (#37578)
* Add coverage for metadata helpers across dialects
* Add coverage for metadata helpers across dialects
---
.../revise/SchemaTableMetaDataAggregatorTest.java | 67 +++++++++++++++++
database/connector/dialect/doris/pom.xml | 2 +-
.../doris/type/DorisDatabaseTypeTest.java | 46 ++++++++++++
.../database/option/FirebirdSchemaOptionTest.java | 58 +++++++++++++++
.../h2/checker/H2DatabasePrivilegeCheckerTest.java | 42 +++++++++++
.../database/system/H2SystemDatabaseTest.java | 48 ++++++++++++
.../MySQLDefaultQueryPropertiesProviderTest.java | 59 +++++++++++++++
.../database/option/MySQLDataTypeOptionTest.java | 86 ++++++++++++++++++++++
.../MySQLKernelSupportedSystemTableTest.java | 46 ++++++++++++
.../option/OpenGaussDataTypeOptionTest.java | 66 +++++++++++++++++
.../database/option/OpenGaussSchemaOptionTest.java | 58 +++++++++++++++
.../OpenGaussKernelSupportedSystemTableTest.java | 48 ++++++++++++
.../database/option/OracleDataTypeOptionTest.java | 63 ++++++++++++++++
.../option/PostgreSQLDataTypeOptionTest.java | 67 +++++++++++++++++
.../option/PostgreSQLSchemaOptionTest.java | 58 +++++++++++++++
.../PostgreSQLKernelSupportedSystemTableTest.java | 45 +++++++++++
.../PrestoConnectionPropertiesParserTest.java | 46 ++++++++++++
17 files changed, 904 insertions(+), 1 deletion(-)
diff --git
a/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/data/revise/SchemaTableMetaDataAggregatorTest.java
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/data/revise/SchemaTableMetaDataAggregatorTest.java
new file mode 100644
index 00000000000..18e67d59956
--- /dev/null
+++
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/metadata/data/revise/SchemaTableMetaDataAggregatorTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.database.connector.core.metadata.data.revise;
+
+import
org.apache.shardingsphere.database.connector.core.exception.RuleAndStorageMetaDataMismatchedException;
+import
org.apache.shardingsphere.database.connector.core.metadata.data.model.ColumnMetaData;
+import
org.apache.shardingsphere.database.connector.core.metadata.data.model.TableMetaData;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class SchemaTableMetaDataAggregatorTest {
+
+ @Test
+ void assertAggregate() {
+ SchemaTableMetaDataAggregator aggregator = new
SchemaTableMetaDataAggregator(false);
+ Map<String, Collection<TableMetaData>> input = new LinkedHashMap<>(2,
1F);
+ input.put("foo_tbl", Arrays.asList(createTableMetaData("foo_tbl_a",
"foo_col_a"), createTableMetaData("foo_tbl_b", "foo_col_b")));
+ input.put("bar_tbl",
Collections.singletonList(createTableMetaData("bar_tbl_a", "bar_col_a")));
+ Collection<TableMetaData> actual = aggregator.aggregate(input);
+ Collection<String> actualNames =
actual.stream().map(TableMetaData::getName).collect(Collectors.toList());
+ assertThat(actualNames.size(), is(2));
+ assertThat(actualNames, hasItems("foo_tbl_a", "bar_tbl_a"));
+ }
+
+ @Test
+ void assertAggregateWithViolationThrowsException() {
+ SchemaTableMetaDataAggregator aggregator = new
SchemaTableMetaDataAggregator(true);
+ Map<String, Collection<TableMetaData>> input =
Collections.singletonMap("foo_tbl",
+ Arrays.asList(createTableMetaData("foo_tbl_a", "foo_col_a"),
createTableMetaData("foo_tbl_b", "foo_col_b")));
+ RuleAndStorageMetaDataMismatchedException actual =
assertThrows(RuleAndStorageMetaDataMismatchedException.class, () ->
aggregator.aggregate(input));
+ assertTrue(actual.getMessage().contains("foo_tbl"));
+ assertTrue(actual.getMessage().contains("foo_tbl_b"));
+ }
+
+ private TableMetaData createTableMetaData(final String tableName, final
String columnName) {
+ ColumnMetaData columnMetaData = new ColumnMetaData(columnName,
Types.INTEGER, true, false, true, true, false, false);
+ return new TableMetaData(tableName,
Collections.singleton(columnMetaData), Collections.emptyList(),
Collections.emptyList());
+ }
+}
diff --git a/database/connector/dialect/doris/pom.xml
b/database/connector/dialect/doris/pom.xml
index 9b2143439a6..2877e8d5a2f 100644
--- a/database/connector/dialect/doris/pom.xml
+++ b/database/connector/dialect/doris/pom.xml
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-database-connector-core</artifactId>
+ <artifactId>shardingsphere-database-connector-mysql</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git
a/database/connector/dialect/doris/src/test/java/org/apache/shardingsphere/database/connector/doris/type/DorisDatabaseTypeTest.java
b/database/connector/dialect/doris/src/test/java/org/apache/shardingsphere/database/connector/doris/type/DorisDatabaseTypeTest.java
new file mode 100644
index 00000000000..9aed65cd433
--- /dev/null
+++
b/database/connector/dialect/doris/src/test/java/org/apache/shardingsphere/database/connector/doris/type/DorisDatabaseTypeTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.database.connector.doris.type;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class DorisDatabaseTypeTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "Doris");
+
+ @Test
+ void assertGetJdbcUrlPrefixes() {
+ assertThat(databaseType.getJdbcUrlPrefixes(),
is(Arrays.asList("jdbc:mysql:", "jdbc:mysqlx:")));
+ }
+
+ @Test
+ void assertGetTrunkDatabaseType() {
+ Optional<DatabaseType> actual = databaseType.getTrunkDatabaseType();
+ assertTrue(actual.isPresent());
+ assertThat(actual.get().getType(), is("MySQL"));
+ }
+}
diff --git
a/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdSchemaOptionTest.java
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdSchemaOptionTest.java
new file mode 100644
index 00000000000..7cd5b5791d6
--- /dev/null
+++
b/database/connector/dialect/firebird/src/test/java/org/apache/shardingsphere/database/connector/firebird/metadata/database/option/FirebirdSchemaOptionTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.database.connector.firebird.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+class FirebirdSchemaOptionTest {
+
+ private final FirebirdSchemaOption schemaOption = new
FirebirdSchemaOption();
+
+ @Test
+ void assertIsSchemaAvailable() {
+ assertFalse(schemaOption.isSchemaAvailable());
+ }
+
+ @Test
+ void assertGetSchema() throws SQLException {
+ Connection connection = mock(Connection.class);
+ when(connection.getSchema()).thenReturn("foo_schema");
+ assertThat(schemaOption.getSchema(connection), is("foo_schema"));
+ }
+
+ @Test
+ void assertGetDefaultSchema() {
+ assertFalse(schemaOption.getDefaultSchema().isPresent());
+ }
+
+ @Test
+ void assertGetDefaultSystemSchema() {
+ assertTrue(schemaOption.getDefaultSystemSchema().isPresent());
+ assertThat(schemaOption.getDefaultSystemSchema().get(),
is("system_tables"));
+ }
+}
diff --git
a/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/checker/H2DatabasePrivilegeCheckerTest.java
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/checker/H2DatabasePrivilegeCheckerTest.java
new file mode 100644
index 00000000000..e95eb298fe3
--- /dev/null
+++
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/checker/H2DatabasePrivilegeCheckerTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.database.connector.h2.checker;
+
+import
org.apache.shardingsphere.database.connector.core.checker.DialectDatabasePrivilegeChecker;
+import
org.apache.shardingsphere.database.connector.core.checker.PrivilegeCheckType;
+import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import javax.sql.DataSource;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.mockito.Mockito.mock;
+
+class H2DatabasePrivilegeCheckerTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "H2");
+
+ private final DialectDatabasePrivilegeChecker checker =
DatabaseTypedSPILoader.getService(DialectDatabasePrivilegeChecker.class,
databaseType);
+
+ @Test
+ void assertCheck() {
+ assertDoesNotThrow(() -> checker.check(mock(DataSource.class),
PrivilegeCheckType.SELECT));
+ }
+}
diff --git
a/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/system/H2SystemDatabaseTest.java
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/system/H2SystemDatabaseTest.java
new file mode 100644
index 00000000000..48cc7239803
--- /dev/null
+++
b/database/connector/dialect/h2/src/test/java/org/apache/shardingsphere/database/connector/h2/metadata/database/system/H2SystemDatabaseTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.database.connector.h2.metadata.database.system;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.system.DialectSystemDatabase;
+import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class H2SystemDatabaseTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "H2");
+
+ private final DialectSystemDatabase systemDatabase =
DatabaseTypedSPILoader.getService(DialectSystemDatabase.class, databaseType);
+
+ @Test
+ void assertGetSystemDatabasesEmpty() {
+ assertTrue(systemDatabase.getSystemDatabases().isEmpty());
+ }
+
+ @Test
+ void assertGetSystemSchemasWithDatabaseNameEmpty() {
+ assertTrue(systemDatabase.getSystemSchemas("foo_db").isEmpty());
+ }
+
+ @Test
+ void assertGetSystemSchemasEmpty() {
+ assertTrue(systemDatabase.getSystemSchemas().isEmpty());
+ }
+}
diff --git
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/jdbcurl/MySQLDefaultQueryPropertiesProviderTest.java
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/jdbcurl/MySQLDefaultQueryPropertiesProviderTest.java
new file mode 100644
index 00000000000..2ba0a209f42
--- /dev/null
+++
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/jdbcurl/MySQLDefaultQueryPropertiesProviderTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.database.connector.mysql.jdbcurl;
+
+import
org.apache.shardingsphere.database.connector.core.jdbcurl.DialectDefaultQueryPropertiesProvider;
+import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLDefaultQueryPropertiesProviderTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+
+ private final DialectDefaultQueryPropertiesProvider provider =
DatabaseTypedSPILoader.getService(DialectDefaultQueryPropertiesProvider.class,
databaseType);
+
+ @Test
+ void assertGetDefaultQueryProperties() {
+ Properties actual = provider.getDefaultQueryProperties();
+ Properties expected = PropertiesBuilder.build(
+ new Property("useServerPrepStmts", Boolean.TRUE.toString()),
+ new Property("cachePrepStmts", Boolean.TRUE.toString()),
+ new Property("prepStmtCacheSize", "8192"),
+ new Property("prepStmtCacheSqlLimit", "2048"),
+ new Property("useLocalSessionState", Boolean.TRUE.toString()),
+ new Property("rewriteBatchedStatements",
Boolean.TRUE.toString()),
+ new Property("cacheResultSetMetadata",
Boolean.FALSE.toString()),
+ new Property("cacheServerConfiguration",
Boolean.TRUE.toString()),
+ new Property("elideSetAutoCommits", Boolean.TRUE.toString()),
+ new Property("maintainTimeStats", Boolean.FALSE.toString()),
+ new Property("netTimeoutForStreamingResults", "0"),
+ new Property("tinyInt1isBit", Boolean.FALSE.toString()),
+ new Property("useSSL", Boolean.FALSE.toString()),
+ new Property("zeroDateTimeBehavior", "round"));
+ assertThat(actual, is(expected));
+ }
+}
diff --git
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLDataTypeOptionTest.java
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLDataTypeOptionTest.java
new file mode 100644
index 00000000000..9b26b3ce24f
--- /dev/null
+++
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/option/MySQLDataTypeOptionTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.database.connector.mysql.metadata.database.option;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigInteger;
+import java.sql.Types;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MySQLDataTypeOptionTest {
+
+ private final DialectDataTypeOption dataTypeOption = new
MySQLDataTypeOption();
+
+ @Test
+ void assertGetExtraDataTypes() {
+ Map<String, Integer> extraDataTypes =
dataTypeOption.getExtraDataTypes();
+ assertThat(extraDataTypes.size(), is(10));
+ assertThat(extraDataTypes.get("JSON"), is(Types.LONGVARCHAR));
+ assertThat(extraDataTypes.get("geometry"), is(Types.BINARY));
+ assertThat(extraDataTypes.get("YEAR"), is(Types.DATE));
+ }
+
+ @Test
+ void assertFindExtraSQLTypeClass() {
+ Optional<Class<?>> tinyintActual =
dataTypeOption.findExtraSQLTypeClass(Types.TINYINT, false);
+ assertTrue(tinyintActual.isPresent());
+ assertThat(tinyintActual.get(), is(Integer.class));
+ Optional<Class<?>> smallintActual =
dataTypeOption.findExtraSQLTypeClass(Types.SMALLINT, false);
+ assertTrue(smallintActual.isPresent());
+ assertThat(smallintActual.get(), is(Integer.class));
+ Optional<Class<?>> integerUnsignedActual =
dataTypeOption.findExtraSQLTypeClass(Types.INTEGER, true);
+ assertTrue(integerUnsignedActual.isPresent());
+ assertThat(integerUnsignedActual.get(), is(Long.class));
+ Optional<Class<?>> integerSignedActual =
dataTypeOption.findExtraSQLTypeClass(Types.INTEGER, false);
+ assertTrue(integerSignedActual.isPresent());
+ assertThat(integerSignedActual.get(), is(Integer.class));
+ Optional<Class<?>> bigintUnsignedActual =
dataTypeOption.findExtraSQLTypeClass(Types.BIGINT, true);
+ assertTrue(bigintUnsignedActual.isPresent());
+ assertThat(bigintUnsignedActual.get(), is(BigInteger.class));
+ Optional<Class<?>> bigintSignedActual =
dataTypeOption.findExtraSQLTypeClass(Types.BIGINT, false);
+ assertTrue(bigintSignedActual.isPresent());
+ assertThat(bigintSignedActual.get(), is(Long.class));
+ assertFalse(dataTypeOption.findExtraSQLTypeClass(Types.VARCHAR,
false).isPresent());
+ }
+
+ @Test
+ void assertIsIntegerDataType() {
+ assertTrue(dataTypeOption.isIntegerDataType(Types.INTEGER));
+ assertFalse(dataTypeOption.isIntegerDataType(Types.VARCHAR));
+ }
+
+ @Test
+ void assertIsStringDataType() {
+ assertTrue(dataTypeOption.isStringDataType(Types.VARCHAR));
+ assertFalse(dataTypeOption.isStringDataType(Types.INTEGER));
+ }
+
+ @Test
+ void assertIsBinaryDataType() {
+ assertTrue(dataTypeOption.isBinaryDataType(Types.BINARY));
+ assertFalse(dataTypeOption.isBinaryDataType(Types.INTEGER));
+ }
+}
diff --git
a/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/system/MySQLKernelSupportedSystemTableTest.java
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/system/MySQLKernelSupportedSystemTableTest.java
new file mode 100644
index 00000000000..176b42002b0
--- /dev/null
+++
b/database/connector/dialect/mysql/src/test/java/org/apache/shardingsphere/database/connector/mysql/metadata/database/system/MySQLKernelSupportedSystemTableTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.database.connector.mysql.metadata.database.system;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.system.DialectKernelSupportedSystemTable;
+import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLKernelSupportedSystemTableTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+
+ private final DialectKernelSupportedSystemTable kernelSupportedSystemTable
= DatabaseTypedSPILoader.getService(DialectKernelSupportedSystemTable.class,
databaseType);
+
+ @Test
+ void assertGetSchemaAndTablesMap() {
+ Map<String, Collection<String>> actual =
kernelSupportedSystemTable.getSchemaAndTablesMap();
+ assertThat(actual.size(), is(1));
+ assertThat(actual.keySet().iterator().next(), is("sys"));
+ assertThat(actual.get("sys"), hasItem("sys_config"));
+ }
+}
diff --git
a/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussDataTypeOptionTest.java
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussDataTypeOptionTest.java
new file mode 100644
index 00000000000..10d2ca072a3
--- /dev/null
+++
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussDataTypeOptionTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.database.connector.opengauss.metadata.database.option;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class OpenGaussDataTypeOptionTest {
+
+ private final DialectDataTypeOption dataTypeOption = new
OpenGaussDataTypeOption();
+
+ @Test
+ void assertGetExtraDataTypes() {
+ assertThat(dataTypeOption.getExtraDataTypes().get("SMALLINT"),
is(Types.SMALLINT));
+ assertThat(dataTypeOption.getExtraDataTypes().get("INT"),
is(Types.INTEGER));
+ assertThat(dataTypeOption.getExtraDataTypes().get("INTEGER"),
is(Types.INTEGER));
+ assertThat(dataTypeOption.getExtraDataTypes().get("BIGINT"),
is(Types.BIGINT));
+ assertThat(dataTypeOption.getExtraDataTypes().get("DECIMAL"),
is(Types.DECIMAL));
+ assertThat(dataTypeOption.getExtraDataTypes().get("NUMERIC"),
is(Types.NUMERIC));
+ assertThat(dataTypeOption.getExtraDataTypes().get("REAL"),
is(Types.REAL));
+ assertThat(dataTypeOption.getExtraDataTypes().get("BOOL"),
is(Types.BOOLEAN));
+ assertThat(dataTypeOption.getExtraDataTypes().get("CHARACTER
VARYING"), is(Types.VARCHAR));
+ }
+
+ @Test
+ void assertFindExtraSQLTypeClass() {
+ assertFalse(dataTypeOption.findExtraSQLTypeClass(Types.SMALLINT,
false).isPresent());
+ }
+
+ @Test
+ void assertIsIntegerDataType() {
+ assertTrue(dataTypeOption.isIntegerDataType(Types.INTEGER));
+ }
+
+ @Test
+ void assertIsStringDataType() {
+ assertTrue(dataTypeOption.isStringDataType(Types.VARCHAR));
+ }
+
+ @Test
+ void assertIsBinaryDataType() {
+ assertTrue(dataTypeOption.isBinaryDataType(Types.BINARY));
+ }
+}
diff --git
a/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussSchemaOptionTest.java
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussSchemaOptionTest.java
new file mode 100644
index 00000000000..3f43f8ac06b
--- /dev/null
+++
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/option/OpenGaussSchemaOptionTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.database.connector.opengauss.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+class OpenGaussSchemaOptionTest {
+
+ private final OpenGaussSchemaOption schemaOption = new
OpenGaussSchemaOption();
+
+ @Test
+ void assertIsSchemaAvailable() {
+ assertTrue(schemaOption.isSchemaAvailable());
+ }
+
+ @Test
+ void assertGetSchema() throws SQLException {
+ Connection connection = mock(Connection.class);
+ when(connection.getSchema()).thenReturn("foo_schema");
+ assertThat(schemaOption.getSchema(connection), is("foo_schema"));
+ }
+
+ @Test
+ void assertGetDefaultSchema() {
+ assertTrue(schemaOption.getDefaultSchema().isPresent());
+ assertThat(schemaOption.getDefaultSchema().get(), is("public"));
+ }
+
+ @Test
+ void assertGetDefaultSystemSchema() {
+ assertTrue(schemaOption.getDefaultSystemSchema().isPresent());
+ assertThat(schemaOption.getDefaultSystemSchema().get(),
is("pg_catalog"));
+ }
+}
diff --git
a/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/system/OpenGaussKernelSupportedSystemTableTest.java
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/system/OpenGaussKernelSupportedSystemTableTest.java
new file mode 100644
index 00000000000..b3f10dbc44f
--- /dev/null
+++
b/database/connector/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/connector/opengauss/metadata/database/system/OpenGaussKernelSupportedSystemTableTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.database.connector.opengauss.metadata.database.system;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.system.DialectKernelSupportedSystemTable;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class OpenGaussKernelSupportedSystemTableTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "openGauss");
+
+ private final DialectKernelSupportedSystemTable kernelSupportedSystemTable
= TypedSPILoader.getService(DialectKernelSupportedSystemTable.class,
databaseType);
+
+ @Test
+ void assertGetSchemaAndTablesMap() {
+ Map<String, Collection<String>> actual =
kernelSupportedSystemTable.getSchemaAndTablesMap();
+ assertThat(actual.size(), is(15));
+ assertTrue(actual.containsKey("information_schema"));
+ assertTrue(actual.containsKey("pg_catalog"));
+ assertThat(actual.get("pg_catalog"), hasItems("pg_class",
"pg_namespace", "pg_database", "pg_roles", "pg_tables", "pg_tablespace"));
+ assertTrue(actual.get("information_schema").isEmpty());
+ }
+}
diff --git
a/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleDataTypeOptionTest.java
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleDataTypeOptionTest.java
new file mode 100644
index 00000000000..40524a41773
--- /dev/null
+++
b/database/connector/dialect/oracle/src/test/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleDataTypeOptionTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.database.connector.oracle.metadata.database.option;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class OracleDataTypeOptionTest {
+
+ private final DialectDataTypeOption dataTypeOption = new
OracleDataTypeOption();
+
+ @Test
+ void assertGetExtraDataTypes() {
+ Map<String, Integer> extraDataTypes =
dataTypeOption.getExtraDataTypes();
+ assertThat(extraDataTypes.size(), is(11));
+ assertThat(extraDataTypes.get("SMALLINT"), is(Types.SMALLINT));
+ assertThat(extraDataTypes.get("TEXT"), is(Types.LONGVARCHAR));
+ assertThat(extraDataTypes.get("BINARY_DOUBLE"), is(Types.DOUBLE));
+ }
+
+ @Test
+ void assertFindExtraSQLTypeClass() {
+ assertFalse(dataTypeOption.findExtraSQLTypeClass(Types.INTEGER,
false).isPresent());
+ }
+
+ @Test
+ void assertIsIntegerDataType() {
+ assertTrue(dataTypeOption.isIntegerDataType(Types.INTEGER));
+ }
+
+ @Test
+ void assertIsStringDataType() {
+ assertTrue(dataTypeOption.isStringDataType(Types.VARCHAR));
+ }
+
+ @Test
+ void assertIsBinaryDataType() {
+ assertTrue(dataTypeOption.isBinaryDataType(Types.BINARY));
+ }
+}
diff --git
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLDataTypeOptionTest.java
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLDataTypeOptionTest.java
new file mode 100644
index 00000000000..8bab7e45346
--- /dev/null
+++
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLDataTypeOptionTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.database.connector.postgresql.metadata.database.option;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class PostgreSQLDataTypeOptionTest {
+
+ private final DialectDataTypeOption dataTypeOption = new
PostgreSQLDataTypeOption();
+
+ @Test
+ void assertGetExtraDataTypes() {
+ Map<String, Integer> extraDataTypes =
dataTypeOption.getExtraDataTypes();
+ assertThat(extraDataTypes.size(), is(9));
+ assertThat(extraDataTypes.get("SMALLINT"), is(Types.SMALLINT));
+ assertThat(extraDataTypes.get("BOOL"), is(Types.BOOLEAN));
+ assertThat(extraDataTypes.get("CHARACTER VARYING"), is(Types.VARCHAR));
+ }
+
+ @Test
+ void assertFindExtraSQLTypeClass() {
+ Optional<Class<?>> smallintActual =
dataTypeOption.findExtraSQLTypeClass(Types.SMALLINT, false);
+ assertTrue(smallintActual.isPresent());
+ assertThat(smallintActual.get(), is(Integer.class));
+ assertFalse(dataTypeOption.findExtraSQLTypeClass(Types.INTEGER,
false).isPresent());
+ }
+
+ @Test
+ void assertIsIntegerDataType() {
+ assertTrue(dataTypeOption.isIntegerDataType(Types.INTEGER));
+ }
+
+ @Test
+ void assertIsStringDataType() {
+ assertTrue(dataTypeOption.isStringDataType(Types.VARCHAR));
+ }
+
+ @Test
+ void assertIsBinaryDataType() {
+ assertTrue(dataTypeOption.isBinaryDataType(Types.BINARY));
+ }
+}
diff --git
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLSchemaOptionTest.java
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLSchemaOptionTest.java
new file mode 100644
index 00000000000..f66acaf37d6
--- /dev/null
+++
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/option/PostgreSQLSchemaOptionTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.database.connector.postgresql.metadata.database.option;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+class PostgreSQLSchemaOptionTest {
+
+ private final PostgreSQLSchemaOption schemaOption = new
PostgreSQLSchemaOption();
+
+ @Test
+ void assertIsSchemaAvailable() {
+ assertTrue(schemaOption.isSchemaAvailable());
+ }
+
+ @Test
+ void assertGetSchema() throws SQLException {
+ Connection connection = mock(Connection.class);
+ when(connection.getSchema()).thenReturn("foo_schema");
+ assertThat(schemaOption.getSchema(connection), is("foo_schema"));
+ }
+
+ @Test
+ void assertGetDefaultSchema() {
+ assertTrue(schemaOption.getDefaultSchema().isPresent());
+ assertThat(schemaOption.getDefaultSchema().get(), is("public"));
+ }
+
+ @Test
+ void assertGetDefaultSystemSchema() {
+ assertTrue(schemaOption.getDefaultSystemSchema().isPresent());
+ assertThat(schemaOption.getDefaultSystemSchema().get(),
is("pg_catalog"));
+ }
+}
diff --git
a/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/system/PostgreSQLKernelSupportedSystemTableTest.java
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/system/PostgreSQLKernelSupportedSystemTableTest.java
new file mode 100644
index 00000000000..59ee47f54cf
--- /dev/null
+++
b/database/connector/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/connector/postgresql/metadata/database/system/PostgreSQLKernelSupportedSystemTableTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.database.connector.postgresql.metadata.database.system;
+
+import
org.apache.shardingsphere.database.connector.core.metadata.database.system.DialectKernelSupportedSystemTable;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class PostgreSQLKernelSupportedSystemTableTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "PostgreSQL");
+
+ private final DialectKernelSupportedSystemTable kernelSupportedSystemTable
= TypedSPILoader.getService(DialectKernelSupportedSystemTable.class,
databaseType);
+
+ @Test
+ void assertGetSchemaAndTablesMap() {
+ Map<String, Collection<String>> actual =
kernelSupportedSystemTable.getSchemaAndTablesMap();
+ assertThat(actual.size(), is(2));
+ assertThat(actual.get("information_schema"), hasItems("columns",
"tables", "views"));
+ assertThat(actual.get("pg_catalog"), hasItems("pg_aggregate",
"pg_class", "pg_database", "pg_tables", "pg_inherits", "pg_tablespace",
"pg_trigger", "pg_namespace", "pg_roles"));
+ }
+}
diff --git
a/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/jdbcurl/PrestoConnectionPropertiesParserTest.java
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/jdbcurl/PrestoConnectionPropertiesParserTest.java
new file mode 100644
index 00000000000..7518c3080f9
--- /dev/null
+++
b/database/connector/dialect/presto/src/test/java/org/apache/shardingsphere/database/connector/presto/jdbcurl/PrestoConnectionPropertiesParserTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.database.connector.presto.jdbcurl;
+
+import
org.apache.shardingsphere.database.connector.core.jdbcurl.parser.ConnectionProperties;
+import
org.apache.shardingsphere.database.connector.core.jdbcurl.parser.ConnectionPropertiesParser;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class PrestoConnectionPropertiesParserTest {
+
+ private final DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "Presto");
+
+ private final ConnectionPropertiesParser parser =
TypedSPILoader.getService(ConnectionPropertiesParser.class, databaseType);
+
+ @Test
+ void assertParse() {
+ ConnectionProperties actual =
parser.parse("jdbc:presto://localhost/foo_catalog?schema=foo_schema",
"unused_user", "unused_catalog");
+ assertThat(actual.getHostname(), is("localhost"));
+ assertThat(actual.getPort(), is(8080));
+ assertThat(actual.getCatalog(), is("foo_catalog"));
+ assertThat(actual.getSchema(), is("foo_schema"));
+ assertThat(actual.getQueryProperties(), is(PropertiesBuilder.build(new
Property("schema", "foo_schema"))));
+ }
+}