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 2f9c9d07f89 Add more test cases on proxy backend dialect modules 
(#37530)
2f9c9d07f89 is described below

commit 2f9c9d07f8936e891f47895bec4493f1b2f678b9
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Dec 26 13:45:53 2025 +0800

    Add more test cases on proxy backend dialect modules (#37530)
    
    * Add more test cases on proxy backend dialect modules
    
    * Add more test cases on proxy backend dialect modules
---
 .../FirebirdCharsetVariableProviderTest.java       | 62 +++++++++++++++
 .../select/ShowCurrentDatabaseExecutorTest.java    | 54 +++++++++++++
 .../sysvar/MySQLSystemVariableScopeTest.java       | 36 +++++++++
 .../MySQLReplayedSessionVariableProviderTest.java  | 39 ++++++++++
 .../factory/MySQLShowAdminExecutorFactoryTest.java | 72 +++++++++++++++++
 .../MySQLInformationSchemaExecutorFactoryTest.java | 89 ++++++++++++++++++++++
 .../MySQLMySQLSchemaExecutorFactoryTest.java       | 80 +++++++++++++++++++
 .../MySQLPerformanceSchemaExecutorFactoryTest.java | 80 +++++++++++++++++++
 .../schema/MySQLSysSchemaExecutorFactoryTest.java  | 81 ++++++++++++++++++++
 .../MySQLProxyStateSupportedSQLProviderTest.java   | 47 ++++++++++++
 .../OpenGaussSelectAdminExecutorFactoryTest.java   | 87 +++++++++++++++++++++
 .../frontend/executor/UserExecutorGroupTest.java   | 34 +++++++++
 .../admin/ping/MySQLComPingExecutorTest.java       | 51 +++++++++++++
 .../admin/quit/MySQLComQuitExecutorTest.java       | 38 +++++++++
 .../MySQLUnsupportedCommandExecutorTest.java       | 35 +++++++++
 .../PostgreSQLPortalContextRegistryTest.java       | 38 +++++++++
 16 files changed, 923 insertions(+)

diff --git 
a/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/variable/charset/FirebirdCharsetVariableProviderTest.java
 
b/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/variable/charset/FirebirdCharsetVariableProviderTest.java
new file mode 100644
index 00000000000..645a89538ab
--- /dev/null
+++ 
b/proxy/backend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/backend/firebird/handler/admin/executor/variable/charset/FirebirdCharsetVariableProviderTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.backend.firebird.handler.admin.executor.variable.charset;
+
+import 
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import 
org.apache.shardingsphere.database.exception.core.exception.data.InvalidParameterValueException;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.variable.charset.CharsetVariableProvider;
+import org.junit.jupiter.api.Test;
+
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class FirebirdCharsetVariableProviderTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "Firebird");
+    
+    private final CharsetVariableProvider provider = 
DatabaseTypedSPILoader.getService(CharsetVariableProvider.class, databaseType);
+    
+    @Test
+    void assertGetCharsetVariables() {
+        assertThat(provider.getCharsetVariables(), 
is(Collections.singleton("names")));
+    }
+    
+    @Test
+    void assertParseDefaultCharset() {
+        assertThat(provider.parseCharset(" default "), 
is(Charset.defaultCharset()));
+    }
+    
+    @Test
+    void assertParseKnownCharset() {
+        assertThat(provider.parseCharset("utf8"), is(StandardCharsets.UTF_8));
+    }
+    
+    @Test
+    void assertParseInvalidCharset() {
+        InvalidParameterValueException ex = 
assertThrows(InvalidParameterValueException.class, () -> 
provider.parseCharset("unknown_charset"));
+        assertThat(ex.getParameterName(), is("names"));
+        assertThat(ex.getParameterValue(), is("unknown_charset"));
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/select/ShowCurrentDatabaseExecutorTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/select/ShowCurrentDatabaseExecutorTest.java
new file mode 100644
index 00000000000..6ca6e27177e
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/select/ShowCurrentDatabaseExecutorTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.executor.select;
+
+import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.junit.jupiter.api.Test;
+
+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 ShowCurrentDatabaseExecutorTest {
+    
+    @Test
+    void assertExecute() throws SQLException {
+        ShowCurrentDatabaseExecutor executor = new 
ShowCurrentDatabaseExecutor();
+        ConnectionSession connectionSession = mock(ConnectionSession.class);
+        when(connectionSession.getUsedDatabaseName()).thenReturn("foo_db");
+        executor.execute(connectionSession, mock());
+        assertTrue(executor.getMergedResult().next());
+        assertThat(executor.getMergedResult().getValue(1, Object.class), 
is("foo_db"));
+        assertFalse(executor.getMergedResult().next());
+    }
+    
+    @Test
+    void assertGetQueryResultMetaData() throws SQLException {
+        ShowCurrentDatabaseExecutor executor = new 
ShowCurrentDatabaseExecutor();
+        QueryResultMetaData metaData = executor.getQueryResultMetaData();
+        assertThat(metaData.getColumnCount(), is(1));
+        assertThat(metaData.getColumnName(1), 
is(ShowCurrentDatabaseExecutor.FUNCTION_NAME));
+        assertThat(metaData.getColumnLabel(1), 
is(ShowCurrentDatabaseExecutor.FUNCTION_NAME));
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/sysvar/MySQLSystemVariableScopeTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/sysvar/MySQLSystemVariableScopeTest.java
new file mode 100644
index 00000000000..f2658b5bd37
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/sysvar/MySQLSystemVariableScopeTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.executor.sysvar;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLSystemVariableScopeTest {
+    
+    @Test
+    void assertValueFromKnownValue() {
+        assertThat(MySQLSystemVariableScope.valueFrom("session"), 
is(MySQLSystemVariableScope.SESSION));
+    }
+    
+    @Test
+    void assertValueFromUnknownValue() {
+        assertThat(MySQLSystemVariableScope.valueFrom("unknown"), 
is(MySQLSystemVariableScope.DEFAULT));
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/variable/session/MySQLReplayedSessionVariableProviderTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/variable/session/MySQLReplayedSessionVariableProviderTest.java
new file mode 100644
index 00000000000..ec76d8c3998
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/variable/session/MySQLReplayedSessionVariableProviderTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.executor.variable.session;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.variable.session.ReplayedSessionVariableProvider;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class MySQLReplayedSessionVariableProviderTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    private final ReplayedSessionVariableProvider provider = 
TypedSPILoader.getService(ReplayedSessionVariableProvider.class, databaseType);
+    
+    @Test
+    void assertIsNeedToReplay() {
+        assertTrue(provider.isNeedToReplay("@@tx_isolation"));
+        assertFalse(provider.isNeedToReplay("tx_isolation"));
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/MySQLShowAdminExecutorFactoryTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/MySQLShowAdminExecutorFactoryTest.java
new file mode 100644
index 00000000000..abc759c9a61
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/MySQLShowAdminExecutorFactoryTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.factory;
+
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowCreateDatabaseExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowDatabasesExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowFunctionStatusExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowProcedureStatusExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowProcessListExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.show.MySQLShowTablesExecutor;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.database.MySQLShowCreateDatabaseStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.database.MySQLShowDatabasesStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.function.MySQLShowFunctionStatusStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.procedure.MySQLShowProcedureStatusStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.process.MySQLShowProcessListStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowTablesStatement;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.Optional;
+import java.util.stream.Stream;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+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;
+
+class MySQLShowAdminExecutorFactoryTest {
+    
+    @ParameterizedTest(name = "{0}")
+    @MethodSource("statementProvider")
+    void assertCreateExecutor(final String caseName, final SQLStatement 
statement, final Class<? extends DatabaseAdminExecutor> expectedType) {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLShowAdminExecutorFactory.newInstance(statement);
+        assertTrue(actual.isPresent(), caseName);
+        assertThat(actual.get(), instanceOf(expectedType));
+    }
+    
+    @Test
+    void assertUnsupportedStatement() {
+        
assertFalse(MySQLShowAdminExecutorFactory.newInstance(mock(SQLStatement.class)).isPresent());
+    }
+    
+    private static Stream<Arguments> statementProvider() {
+        return Stream.of(
+                Arguments.of("show databases", 
mock(MySQLShowDatabasesStatement.class), MySQLShowDatabasesExecutor.class),
+                Arguments.of("show tables", 
mock(MySQLShowTablesStatement.class), MySQLShowTablesExecutor.class),
+                Arguments.of("show create database", 
mock(MySQLShowCreateDatabaseStatement.class), 
MySQLShowCreateDatabaseExecutor.class),
+                Arguments.of("show function status", 
mock(MySQLShowFunctionStatusStatement.class), 
MySQLShowFunctionStatusExecutor.class),
+                Arguments.of("show procedure status", 
mock(MySQLShowProcedureStatusStatement.class), 
MySQLShowProcedureStatusExecutor.class),
+                Arguments.of("show processlist", 
mock(MySQLShowProcessListStatement.class), MySQLShowProcessListExecutor.class));
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLInformationSchemaExecutorFactoryTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLInformationSchemaExecutorFactoryTest.java
new file mode 100644
index 00000000000..c099eb56f74
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLInformationSchemaExecutorFactoryTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.factory.schema;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseMetaDataExecutor;
+import 
org.apache.shardingsphere.proxy.backend.mysql.handler.admin.executor.select.SelectInformationSchemataExecutor;
+import 
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+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 MySQLInformationSchemaExecutorFactoryTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    @Test
+    void assertCreateSchemataExecutor() {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLInformationSchemaExecutorFactory.newInstance(mockSelectStatementContext("SCHEMATA"),
 "sql", Collections.emptyList());
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), 
instanceOf(SelectInformationSchemataExecutor.class));
+    }
+    
+    @Test
+    void assertCreateMetaDataExecutorForSystemTable() {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLInformationSchemaExecutorFactory.newInstance(mockSelectStatementContext("referential_constraints"),
 "sql", Collections.emptyList());
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), instanceOf(DatabaseMetaDataExecutor.class));
+    }
+    
+    @Test
+    void assertReturnEmptyForNonSystemTable() {
+        
assertFalse(MySQLInformationSchemaExecutorFactory.newInstance(mockSelectStatementContext("custom_table"),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsMissing() {
+        
assertFalse(MySQLInformationSchemaExecutorFactory.newInstance(mockSelectStatementContext(new
 SelectStatement(databaseType)), "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsNotSimpleTableSegment() {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(mock(TableSegment.class));
+        
assertFalse(MySQLInformationSchemaExecutorFactory.newInstance(mockSelectStatementContext(selectStatement),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final String 
tableName) {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue(tableName))));
+        return mockSelectStatementContext(selectStatement);
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final 
SelectStatement selectStatement) {
+        SelectStatementContext result = mock(SelectStatementContext.class);
+        when(result.getSqlStatement()).thenReturn(selectStatement);
+        return result;
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLMySQLSchemaExecutorFactoryTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLMySQLSchemaExecutorFactoryTest.java
new file mode 100644
index 00000000000..d8b516f9d27
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLMySQLSchemaExecutorFactoryTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.factory.schema;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import 
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseMetaDataExecutor;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.Optional;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.isA;
+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 MySQLMySQLSchemaExecutorFactoryTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    @Test
+    void assertCreateMetaDataExecutorForSystemTable() {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLMySQLSchemaExecutorFactory.newInstance(mockSelectStatementContext("db"), 
"sql", Collections.emptyList());
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), isA(DatabaseMetaDataExecutor.class));
+    }
+    
+    @Test
+    void assertReturnEmptyForNonSystemTable() {
+        
assertFalse(MySQLMySQLSchemaExecutorFactory.newInstance(mockSelectStatementContext("custom_table"),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsMissing() {
+        
assertFalse(MySQLMySQLSchemaExecutorFactory.newInstance(mockSelectStatementContext(new
 SelectStatement(databaseType)), "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsNotSimpleTableSegment() {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        
selectStatement.setFrom(mock(org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment.class));
+        
assertFalse(MySQLMySQLSchemaExecutorFactory.newInstance(mockSelectStatementContext(selectStatement),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final String 
tableName) {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue(tableName))));
+        return mockSelectStatementContext(selectStatement);
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final 
SelectStatement selectStatement) {
+        SelectStatementContext result = mock(SelectStatementContext.class);
+        when(result.getSqlStatement()).thenReturn(selectStatement);
+        return result;
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLPerformanceSchemaExecutorFactoryTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLPerformanceSchemaExecutorFactoryTest.java
new file mode 100644
index 00000000000..7b0dc801c0f
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLPerformanceSchemaExecutorFactoryTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.factory.schema;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import 
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseMetaDataExecutor;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.Optional;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.isA;
+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 MySQLPerformanceSchemaExecutorFactoryTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    @Test
+    void assertCreateMetaDataExecutorForSystemTable() {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLPerformanceSchemaExecutorFactory.newInstance(mockSelectStatementContext("variables_info"),
 "sql", Collections.emptyList());
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), isA(DatabaseMetaDataExecutor.class));
+    }
+    
+    @Test
+    void assertReturnEmptyForNonSystemTable() {
+        
assertFalse(MySQLPerformanceSchemaExecutorFactory.newInstance(mockSelectStatementContext("custom_table"),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsMissing() {
+        
assertFalse(MySQLPerformanceSchemaExecutorFactory.newInstance(mockSelectStatementContext(new
 SelectStatement(databaseType)), "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsNotSimpleTableSegment() {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        
selectStatement.setFrom(mock(org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment.class));
+        
assertFalse(MySQLPerformanceSchemaExecutorFactory.newInstance(mockSelectStatementContext(selectStatement),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final String 
tableName) {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue(tableName))));
+        return mockSelectStatementContext(selectStatement);
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final 
SelectStatement selectStatement) {
+        SelectStatementContext result = mock(SelectStatementContext.class);
+        when(result.getSqlStatement()).thenReturn(selectStatement);
+        return result;
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLSysSchemaExecutorFactoryTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLSysSchemaExecutorFactoryTest.java
new file mode 100644
index 00000000000..1759b94a378
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/factory/schema/MySQLSysSchemaExecutorFactoryTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.proxy.backend.mysql.handler.admin.factory.schema;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseMetaDataExecutor;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.Optional;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.isA;
+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 MySQLSysSchemaExecutorFactoryTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    @Test
+    void assertCreateMetaDataExecutorForSystemTable() {
+        Optional<DatabaseAdminExecutor> actual = 
MySQLSysSchemaExecutorFactory.newInstance(mockSelectStatementContext("session"),
 "sql", Collections.emptyList());
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), isA(DatabaseMetaDataExecutor.class));
+    }
+    
+    @Test
+    void assertReturnEmptyForNonSystemTable() {
+        
assertFalse(MySQLSysSchemaExecutorFactory.newInstance(mockSelectStatementContext("custom_table"),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsMissing() {
+        
assertFalse(MySQLSysSchemaExecutorFactory.newInstance(mockSelectStatementContext(new
 SelectStatement(databaseType)), "sql", Collections.emptyList()).isPresent());
+    }
+    
+    @Test
+    void assertReturnEmptyWhenFromIsNotSimpleTableSegment() {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(mock(TableSegment.class));
+        
assertFalse(MySQLSysSchemaExecutorFactory.newInstance(mockSelectStatementContext(selectStatement),
 "sql", Collections.emptyList()).isPresent());
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final String 
tableName) {
+        SelectStatement selectStatement = new SelectStatement(databaseType);
+        selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 
0, new IdentifierValue(tableName))));
+        return mockSelectStatementContext(selectStatement);
+    }
+    
+    private SelectStatementContext mockSelectStatementContext(final 
SelectStatement selectStatement) {
+        SelectStatementContext result = mock(SelectStatementContext.class);
+        when(result.getSqlStatement()).thenReturn(selectStatement);
+        return result;
+    }
+}
diff --git 
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/state/MySQLProxyStateSupportedSQLProviderTest.java
 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/state/MySQLProxyStateSupportedSQLProviderTest.java
new file mode 100644
index 00000000000..6c12de575d0
--- /dev/null
+++ 
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/state/MySQLProxyStateSupportedSQLProviderTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.proxy.backend.mysql.state;
+
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import 
org.apache.shardingsphere.proxy.backend.state.DialectProxyStateSupportedSQLProvider;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLFlushStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLUseStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.database.MySQLShowDatabasesStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.privilege.MySQLShowCreateUserStatement;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLProxyStateSupportedSQLProviderTest {
+    
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+    
+    private final DialectProxyStateSupportedSQLProvider provider = 
TypedSPILoader.getService(DialectProxyStateSupportedSQLProvider.class, 
databaseType);
+    
+    @Test
+    void assertGetUnsupportedSQLStatementTypesOnReadyState() {
+        assertThat(provider.getUnsupportedSQLStatementTypesOnReadyState(), 
hasItems(MySQLFlushStatement.class, MySQLShowCreateUserStatement.class));
+    }
+    
+    @Test
+    void assertGetSupportedSQLStatementTypesOnUnavailableState() {
+        assertThat(provider.getSupportedSQLStatementTypesOnUnavailableState(), 
hasItems(MySQLShowDatabasesStatement.class, MySQLUseStatement.class));
+    }
+}
diff --git 
a/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/factory/OpenGaussSelectAdminExecutorFactoryTest.java
 
b/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/factory/OpenGaussSelectAdminExecutorFactoryTest.java
new file mode 100644
index 00000000000..0ad1907bed5
--- /dev/null
+++ 
b/proxy/backend/dialect/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/factory/OpenGaussSelectAdminExecutorFactoryTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.proxy.backend.opengauss.handler.admin.factory;
+
+import 
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
+import 
org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminExecutor;
+import 
org.apache.shardingsphere.proxy.backend.postgresql.handler.admin.factory.PostgreSQLSelectAdminExecutorFactory;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+
+import java.util.Collections;
+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;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.mockStatic;
+import static org.mockito.Mockito.when;
+
+class OpenGaussSelectAdminExecutorFactoryTest {
+    
+    @Test
+    void assertNewInstanceWithReturnSystemTableExecutor() {
+        DatabaseAdminExecutor expected = mock(DatabaseAdminExecutor.class);
+        try (
+                MockedStatic<OpenGaussSystemTableQueryExecutorFactory> 
tableFactory = mockStatic(OpenGaussSystemTableQueryExecutorFactory.class);
+                MockedStatic<OpenGaussSystemFunctionQueryExecutorFactory> 
functionFactory = 
mockStatic(OpenGaussSystemFunctionQueryExecutorFactory.class)) {
+            tableFactory.when(() -> 
OpenGaussSystemTableQueryExecutorFactory.newInstance(any(), any(), 
any())).thenReturn(Optional.of(expected));
+            functionFactory.when(() -> 
OpenGaussSystemFunctionQueryExecutorFactory.newInstance(any())).thenReturn(Optional.empty());
+            Optional<DatabaseAdminExecutor> actual = 
OpenGaussSelectAdminExecutorFactory.newInstance(mockSelectStatementContext(), 
"sql", Collections.emptyList());
+            assertTrue(actual.isPresent());
+            assertThat(actual.get(), is(expected));
+        }
+    }
+    
+    @Test
+    void assertNewInstanceWithReturnSystemFunctionExecutor() {
+        DatabaseAdminExecutor expected = mock(DatabaseAdminExecutor.class);
+        try (
+                MockedStatic<OpenGaussSystemTableQueryExecutorFactory> 
tableFactory = mockStatic(OpenGaussSystemTableQueryExecutorFactory.class);
+                MockedStatic<OpenGaussSystemFunctionQueryExecutorFactory> 
functionFactory = 
mockStatic(OpenGaussSystemFunctionQueryExecutorFactory.class)) {
+            tableFactory.when(() -> 
OpenGaussSystemTableQueryExecutorFactory.newInstance(any(), any(), 
any())).thenReturn(Optional.empty());
+            functionFactory.when(() -> 
OpenGaussSystemFunctionQueryExecutorFactory.newInstance(any())).thenReturn(Optional.of(expected));
+            Optional<DatabaseAdminExecutor> actual = 
OpenGaussSelectAdminExecutorFactory.newInstance(mockSelectStatementContext(), 
"sql", Collections.emptyList());
+            assertTrue(actual.isPresent());
+            assertThat(actual.get(), is(expected));
+        }
+    }
+    
+    @Test
+    void assertNewInstanceWhenAllFactoriesReturnEmpty() {
+        try (
+                MockedStatic<OpenGaussSystemTableQueryExecutorFactory> 
tableFactory = mockStatic(OpenGaussSystemTableQueryExecutorFactory.class);
+                MockedStatic<OpenGaussSystemFunctionQueryExecutorFactory> 
functionFactory = mockStatic(OpenGaussSystemFunctionQueryExecutorFactory.class);
+                MockedStatic<PostgreSQLSelectAdminExecutorFactory> 
postgreFactory = mockStatic(PostgreSQLSelectAdminExecutorFactory.class)) {
+            tableFactory.when(() -> 
OpenGaussSystemTableQueryExecutorFactory.newInstance(any(), any(), 
any())).thenReturn(Optional.empty());
+            functionFactory.when(() -> 
OpenGaussSystemFunctionQueryExecutorFactory.newInstance(any())).thenReturn(Optional.empty());
+            postgreFactory.when(() -> 
PostgreSQLSelectAdminExecutorFactory.newInstance(any(), any(), 
any())).thenReturn(Optional.empty());
+            
assertFalse(OpenGaussSelectAdminExecutorFactory.newInstance(mockSelectStatementContext(),
 "sql", Collections.emptyList()).isPresent());
+        }
+    }
+    
+    private SelectStatementContext mockSelectStatementContext() {
+        SelectStatementContext result = mock(SelectStatementContext.class);
+        when(result.getSqlStatement()).thenReturn(mock(SelectStatement.class));
+        return result;
+    }
+}
diff --git 
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/executor/UserExecutorGroupTest.java
 
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/executor/UserExecutorGroupTest.java
new file mode 100644
index 00000000000..e714889287f
--- /dev/null
+++ 
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/executor/UserExecutorGroupTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.proxy.frontend.executor;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class UserExecutorGroupTest {
+    
+    @Test
+    void assertGetExecutorService() {
+        UserExecutorGroup first = UserExecutorGroup.getInstance();
+        UserExecutorGroup second = UserExecutorGroup.getInstance();
+        assertThat(first, is(second));
+        assertThat(first.getExecutorService(), 
is(second.getExecutorService()));
+    }
+}
diff --git 
a/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/ping/MySQLComPingExecutorTest.java
 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/ping/MySQLComPingExecutorTest.java
new file mode 100644
index 00000000000..180893e7884
--- /dev/null
+++ 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/ping/MySQLComPingExecutorTest.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.proxy.frontend.mysql.command.admin.ping;
+
+import 
org.apache.shardingsphere.database.protocol.mysql.constant.MySQLStatusFlag;
+import 
org.apache.shardingsphere.database.protocol.mysql.packet.generic.MySQLOKPacket;
+import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import 
org.apache.shardingsphere.proxy.backend.session.transaction.TransactionStatus;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+class MySQLComPingExecutorTest {
+    
+    @Test
+    void assertExecute() {
+        MySQLComPingExecutor executor = new 
MySQLComPingExecutor(mockConnectionSession());
+        Collection<DatabasePacket> actual = executor.execute();
+        assertThat(actual.size(), is(1));
+        DatabasePacket packet = actual.iterator().next();
+        assertThat(((MySQLOKPacket) packet).getStatusFlag(), 
is(MySQLStatusFlag.SERVER_STATUS_AUTOCOMMIT.getValue()));
+    }
+    
+    private static ConnectionSession mockConnectionSession() {
+        ConnectionSession result = mock(ConnectionSession.class);
+        when(result.isAutoCommit()).thenReturn(true);
+        when(result.getTransactionStatus()).thenReturn(new 
TransactionStatus());
+        return result;
+    }
+}
diff --git 
a/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/quit/MySQLComQuitExecutorTest.java
 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/quit/MySQLComQuitExecutorTest.java
new file mode 100644
index 00000000000..5be84b1468d
--- /dev/null
+++ 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/quit/MySQLComQuitExecutorTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.proxy.frontend.mysql.command.admin.quit;
+
+import 
org.apache.shardingsphere.database.protocol.mysql.packet.generic.MySQLOKPacket;
+import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collection;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class MySQLComQuitExecutorTest {
+    
+    @Test
+    void assertExecute() {
+        Collection<DatabasePacket> actual = new 
MySQLComQuitExecutor().execute();
+        assertThat(actual.size(), is(1));
+        DatabasePacket packet = actual.iterator().next();
+        assertThat(((MySQLOKPacket) packet).getStatusFlag(), is(0));
+    }
+}
diff --git 
a/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/generic/MySQLUnsupportedCommandExecutorTest.java
 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/generic/MySQLUnsupportedCommandExecutorTest.java
new file mode 100644
index 00000000000..22d4391c399
--- /dev/null
+++ 
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/generic/MySQLUnsupportedCommandExecutorTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.proxy.frontend.mysql.command.generic;
+
+import 
org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacketType;
+import 
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class MySQLUnsupportedCommandExecutorTest {
+    
+    @Test
+    void assertExecute() {
+        UnsupportedCommandException ex = 
assertThrows(UnsupportedCommandException.class, () -> new 
MySQLUnsupportedCommandExecutor(MySQLCommandPacketType.COM_QUERY).execute());
+        assertThat(ex.getMessage(), is("Unsupported command: COM_QUERY"));
+    }
+}
diff --git 
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLPortalContextRegistryTest.java
 
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLPortalContextRegistryTest.java
new file mode 100644
index 00000000000..003d89434ab
--- /dev/null
+++ 
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLPortalContextRegistryTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.proxy.frontend.postgresql.command;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+class PostgreSQLPortalContextRegistryTest {
+    
+    @Test
+    void assertGetAndRemove() {
+        PostgreSQLPortalContextRegistry registry = 
PostgreSQLPortalContextRegistry.getInstance();
+        PortalContext first = registry.get(1);
+        PortalContext second = registry.get(1);
+        assertSame(first, second);
+        assertThat(registry.remove(1), is(first));
+        assertNull(registry.remove(2));
+    }
+}

Reply via email to