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 387a7e1da79 Decouple MySQL dependencies on proxy-backend-core module 
(#35210)
387a7e1da79 is described below

commit 387a7e1da796138cdc55d7fced64de567282c412
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Thu Apr 17 14:29:09 2025 +0800

    Decouple MySQL dependencies on proxy-backend-core module (#35210)
    
    * Decouple MySQL dependencies on SetDistVariableExecutorTest
    
    * Decouple MySQL dependencies on 
SetDistVariableUpdatableRALBackendHandlerTest
    
    * Decouple MySQL dependencies on ConnectionSessionTest
---
 .../ral/updatable/variable/SetDistVariableExecutorTest.java    | 10 +++++-----
 .../SetDistVariableUpdatableRALBackendHandlerTest.java         |  3 +--
 .../proxy/backend/session/ConnectionSessionTest.java           |  3 +--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutorTest.java
index de53240133d..4b5310d765e 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutorTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutorTest.java
@@ -21,7 +21,6 @@ import 
org.apache.shardingsphere.distsql.statement.ral.updatable.SetDistVariable
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import 
org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationPropertyKey;
-import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
 import 
org.apache.shardingsphere.infra.exception.kernel.syntax.InvalidVariableValueException;
 import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
 import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
@@ -35,6 +34,7 @@ import 
org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistFacade;
 import 
org.apache.shardingsphere.mode.metadata.persist.config.global.PropertiesPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.test.fixture.database.MockedDatabaseType;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
 import org.junit.jupiter.api.Test;
@@ -43,9 +43,9 @@ import org.slf4j.event.Level;
 
 import java.sql.SQLException;
 
+import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
@@ -79,12 +79,12 @@ class SetDistVariableExecutorTest {
     
     @Test
     void assertExecuteWithTypedSPI() throws SQLException {
-        SetDistVariableStatement statement = new 
SetDistVariableStatement("proxy_frontend_database_protocol_type", "MySQL");
+        SetDistVariableStatement statement = new 
SetDistVariableStatement("proxy_frontend_database_protocol_type", "Fixture");
         ContextManager contextManager = mockContextManager();
         executor.executeUpdate(statement, contextManager);
         Object actualValue = 
contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("proxy-frontend-database-protocol-type");
-        assertThat(actualValue.toString(), is("MySQL"));
-        assertInstanceOf(MySQLDatabaseType.class, 
contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.PROXY_FRONTEND_DATABASE_PROTOCOL_TYPE));
+        assertThat(actualValue.toString(), is("FIXTURE"));
+        
assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.PROXY_FRONTEND_DATABASE_PROTOCOL_TYPE),
 instanceOf(MockedDatabaseType.class));
     }
     
     @Test
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableUpdatableRALBackendHandlerTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableUpdatableRALBackendHandlerTest.java
index 1c8a84aaa22..3aeb23e3522 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableUpdatableRALBackendHandlerTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableUpdatableRALBackendHandlerTest.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.va
 
 import io.netty.util.DefaultAttributeMap;
 import 
org.apache.shardingsphere.distsql.statement.ral.updatable.SetDistVariableStatement;
-import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
 import 
org.apache.shardingsphere.infra.exception.kernel.syntax.UnsupportedVariableException;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.DistSQLUpdateBackendHandler;
@@ -44,7 +43,7 @@ class SetDistVariableUpdatableRALBackendHandlerTest {
     @BeforeEach
     void setUp() {
         when(ProxyContext.getInstance()).thenReturn(mock(ProxyContext.class, 
RETURNS_DEEP_STUBS));
-        connectionSession = new 
ConnectionSession(mock(MySQLDatabaseType.class), new DefaultAttributeMap());
+        connectionSession = new ConnectionSession(mock(), new 
DefaultAttributeMap());
     }
     
     @Test
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
index 9ae58ecc1b7..7815dbadf27 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.proxy.backend.session;
 
-import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.session.query.QueryContext;
@@ -60,7 +59,7 @@ class ConnectionSessionTest {
     
     @BeforeEach
     void setup() {
-        connectionSession = new 
ConnectionSession(mock(MySQLDatabaseType.class), null);
+        connectionSession = new ConnectionSession(mock(), null);
         connectionSession.setGrantee(mock(Grantee.class));
         
when(databaseConnectionManager.getConnectionSession()).thenReturn(connectionSession);
     }

Reply via email to