This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 685b1abc6da Remove the useless no args constructor for
ShardingSphereMetaData (#37793)
685b1abc6da is described below
commit 685b1abc6da6811090ebb44263d2e70ea3251aab
Author: Haoran Meng <[email protected]>
AuthorDate: Wed Jan 21 09:56:04 2026 +0800
Remove the useless no args constructor for ShardingSphereMetaData (#37793)
* Remove the useless no args constructor for ShardingSphereMetaData
* Fix spotless issue
---
.../metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java | 7 ++++++-
.../metrics/prometheus/PrometheusPluginLifecycleServiceTest.java | 8 +++++++-
.../shardingsphere/infra/metadata/ShardingSphereMetaData.java | 6 ------
.../infra/metadata/ShardingSphereMetaDataTest.java | 6 ++++--
.../mode/metadata/manager/statistics/StatisticsManagerTest.java | 3 ++-
.../proxy/backend/context/BackendExecutorContextTest.java | 9 ++++++++-
.../handler/distsql/DistSQLQueryProxyBackendHandlerTest.java | 7 ++++++-
.../ral/updatable/variable/SetDistVariableExecutorTest.java | 9 ++++++++-
.../proxy/frontend/command/CommandExecutorTaskTest.java | 7 ++++++-
.../firebird/command/FirebirdCommandExecuteEngineTest.java | 8 +++++++-
.../execute/FirebirdExecuteStatementCommandExecutorTest.java | 7 ++++++-
.../query/binary/execute/MySQLComStmtExecuteExecutorTest.java | 7 ++++++-
.../postgresql/command/PostgreSQLCommandExecuteEngineTest.java | 9 ++++++++-
13 files changed, 74 insertions(+), 19 deletions(-)
diff --git
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
index 35161bf2ebe..eacd3653cc3 100644
---
a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
+++
b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
@@ -22,7 +22,10 @@ import
org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeM
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
import
org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
import
org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.infra.state.instance.InstanceStateContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -36,6 +39,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import java.util.Collections;
import java.util.Optional;
+import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -71,7 +75,8 @@ class ProxyStateExporterTest {
}
private ContextManager mockContextManager() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = new MetaDataContexts(metaData, new
ShardingSphereStatistics());
ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
index 1ed3b198f13..40ba2784cf4 100644
---
a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
+++
b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
@@ -20,10 +20,13 @@ package
org.apache.shardingsphere.agent.plugin.metrics.prometheus;
import io.prometheus.client.CollectorRegistry;
import org.apache.shardingsphere.agent.api.PluginConfiguration;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
@@ -44,6 +47,8 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
+import java.util.Collections;
+import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.Mockito.mock;
@@ -91,7 +96,8 @@ class PrometheusPluginLifecycleServiceTest {
}
private ContextManager mockContextManager() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = new MetaDataContexts(metaData, new
ShardingSphereStatistics());
ComputeNodeInstanceContext computeNodeInstanceContext = new
ComputeNodeInstanceContext(
new ComputeNodeInstance(mock(InstanceMetaData.class)), new
ModeConfiguration("Standalone", null), new EventBusContext());
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
index d387a0179ee..22e48f830c6 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
@@ -35,11 +35,9 @@ import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
import
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
import java.util.Optional;
-import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@@ -60,10 +58,6 @@ public final class ShardingSphereMetaData implements
AutoCloseable {
private final TemporaryConfigurationProperties temporaryProps;
- public ShardingSphereMetaData() {
- this(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()), new
RuleMetaData(Collections.emptyList()), new ConfigurationProperties(new
Properties()));
- }
-
public ShardingSphereMetaData(final Collection<ShardingSphereDatabase>
databases, final ResourceMetaData globalResourceMetaData,
final RuleMetaData globalRuleMetaData, final
ConfigurationProperties props) {
this.databases = new
ConcurrentHashMap<>(databases.stream().collect(Collectors.toMap(each -> new
ShardingSphereIdentifier(each.getName()), each -> each)));
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
index 17736ff6869..24cb868c6ae 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
@@ -112,7 +112,8 @@ class ShardingSphereMetaDataTest {
@SuppressWarnings("resource")
@Test
void assertNotContainsDatabase() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
assertFalse(metaData.containsDatabase("foo_db"));
}
@@ -130,7 +131,8 @@ class ShardingSphereMetaDataTest {
@SuppressWarnings("resource")
@Test
void assertPutDatabase() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
ShardingSphereDatabase database = mockDatabase(mock(), new
MockedDataSource(), mock(ShardingSphereRule.class));
metaData.putDatabase(database);
assertThat(metaData.getDatabase("foo_db"), is(database));
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/statistics/StatisticsManagerTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/statistics/StatisticsManagerTest.java
index e6941155d76..c150f9f62dc 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/statistics/StatisticsManagerTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/statistics/StatisticsManagerTest.java
@@ -225,7 +225,8 @@ class StatisticsManagerTest {
@Test
void assertAlterRowStatisticsWhenMetaDataMissing() {
ShardingSphereStatistics statistics = createStatisticsWithTable();
- MetaDataContexts metaDataContexts = new MetaDataContexts(new
ShardingSphereMetaData(), statistics);
+ MetaDataContexts metaDataContexts = new MetaDataContexts(new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties())), statistics);
YamlRowStatistics yamlRowStatistics = new YamlRowStatistics();
yamlRowStatistics.setUniqueKey("uk_1");
yamlRowStatistics.setRows(Collections.singletonList("1"));
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
index 08037e60ab1..d088a309165 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
@@ -17,7 +17,10 @@
package org.apache.shardingsphere.proxy.backend.context;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
@@ -26,6 +29,9 @@ import
org.apache.shardingsphere.test.infra.framework.extension.mock.StaticMockS
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import java.util.Collections;
+import java.util.Properties;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -44,7 +50,8 @@ class BackendExecutorContextTest {
}
private ContextManager mockContextManager() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = new MetaDataContexts(metaData, new
ShardingSphereStatistics());
ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLQueryProxyBackendHandlerTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLQueryProxyBackendHandlerTest.java
index 8f06edc80fa..f6d4f28981b 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLQueryProxyBackendHandlerTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLQueryProxyBackendHandlerTest.java
@@ -26,10 +26,13 @@ import
org.apache.shardingsphere.distsql.statement.type.ral.queryable.QueryableR
import
org.apache.shardingsphere.distsql.statement.type.ral.queryable.export.ExportDatabaseConfigurationStatement;
import
org.apache.shardingsphere.distsql.statement.type.ral.queryable.show.ShowTableMetaDataStatement;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereIndex;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
@@ -53,6 +56,7 @@ import org.mockito.MockedStatic;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
+import java.util.Properties;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
@@ -78,7 +82,8 @@ class DistSQLQueryProxyBackendHandlerTest {
@Test
void assertExecuteWithUnknownDatabase() {
- ShardingSphereMetaData metaData = new ShardingSphereMetaData();
+ ShardingSphereMetaData metaData = new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = new MetaDataContexts(metaData, new
ShardingSphereStatistics());
ConnectionSession connectionSession = mock(ConnectionSession.class,
RETURNS_DEEP_STUBS);
when(connectionSession.getUsedDatabaseName()).thenReturn("unknown");
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 e511ab669f0..00875272eb7 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,6 +21,7 @@ import
org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.distsql.handler.engine.update.DistSQLUpdateExecutor;
import
org.apache.shardingsphere.distsql.statement.type.ral.updatable.SetDistVariableStatement;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import
org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationPropertyKey;
import
org.apache.shardingsphere.infra.exception.kernel.syntax.InvalidVariableValueException;
@@ -30,6 +31,8 @@ import
org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.instance.workerid.WorkerIdGenerator;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
@@ -39,6 +42,9 @@ import
org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistFacade;
import
org.apache.shardingsphere.mode.metadata.persist.config.global.PropertiesPersistService;
import org.junit.jupiter.api.Test;
+import java.util.Collections;
+import java.util.Properties;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -104,6 +110,7 @@ class SetDistVariableExecutorTest {
ComputeNodeInstanceContext computeNodeInstanceContext = new
ComputeNodeInstanceContext(
new ComputeNodeInstance(mock(InstanceMetaData.class)), new
ModeConfiguration("Standalone", null), new EventBusContext());
computeNodeInstanceContext.init(mock(WorkerIdGenerator.class));
- return new ContextManager(new MetaDataContexts(new
ShardingSphereMetaData(), new ShardingSphereStatistics()),
computeNodeInstanceContext, mock(), mock());
+ return new ContextManager(new MetaDataContexts(new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties())), new ShardingSphereStatistics()),
computeNodeInstanceContext, mock(), mock());
}
}
diff --git
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
index 4628860596d..81b3dba1158 100644
---
a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
+++
b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTaskTest.java
@@ -24,7 +24,10 @@ import
org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
import
org.apache.shardingsphere.database.protocol.packet.command.CommandPacket;
import
org.apache.shardingsphere.database.protocol.packet.command.CommandPacketType;
import org.apache.shardingsphere.database.protocol.payload.PacketPayload;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import
org.apache.shardingsphere.proxy.backend.connector.ProxyDatabaseConnectionManager;
@@ -46,6 +49,7 @@ import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Optional;
+import java.util.Properties;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
@@ -96,7 +100,8 @@ class CommandExecutorTaskTest {
when(connectionSession.getDatabaseConnectionManager()).thenReturn(databaseConnectionManager);
when(handlerContext.channel().attr(CommonConstants.CHARSET_ATTRIBUTE_KEY).get()).thenReturn(StandardCharsets.UTF_8);
MetaDataContexts metaDataContexts = mock(MetaDataContexts.class);
- when(metaDataContexts.getMetaData()).thenReturn(new
ShardingSphereMetaData());
+ when(metaDataContexts.getMetaData()).thenReturn(new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties())));
ContextManager contextManager = mock(ContextManager.class);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
diff --git
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/FirebirdCommandExecuteEngineTest.java
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/FirebirdCommandExecuteEngineTest.java
index 245c2797a91..d53fc4e71cf 100644
---
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/FirebirdCommandExecuteEngineTest.java
+++
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/FirebirdCommandExecuteEngineTest.java
@@ -29,7 +29,10 @@ import
org.apache.shardingsphere.database.protocol.firebird.packet.command.Fireb
import
org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
import
org.apache.shardingsphere.database.protocol.packet.command.CommandPacket;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
@@ -53,6 +56,8 @@ import org.mockito.quality.Strictness;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -161,7 +166,8 @@ class FirebirdCommandExecuteEngineTest {
when(queryCommandExecutor.next()).thenReturn(true, false);
when(queryCommandExecutor.getQueryRowPacket()).thenReturn(rowPacket);
MetaDataContexts metaDataContexts =
- new MetaDataContexts(new ShardingSphereMetaData(), new
ShardingSphereStatistics());
+ new MetaDataContexts(new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties())), new ShardingSphereStatistics());
when(mockContextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
when(ProxyContext.getInstance().getContextManager()).thenReturn(mockContextManager);
engine.writeQueryData(context, databaseConnectionManager,
queryCommandExecutor, 0);
diff --git
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/execute/FirebirdExecuteStatementCommandExecutorTest.java
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/execute/FirebirdExecuteStatementCommandExecutorTest.java
index 361b82d4ea1..258ed423165 100644
---
a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/execute/FirebirdExecuteStatementCommandExecutorTest.java
+++
b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/execute/FirebirdExecuteStatementCommandExecutorTest.java
@@ -24,8 +24,11 @@ import
org.apache.shardingsphere.database.protocol.firebird.packet.generic.Fireb
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
import
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.dml.UpdateStatementContext;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.hint.HintValueContext;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
import org.apache.shardingsphere.infra.session.query.QueryContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
@@ -59,6 +62,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -109,7 +113,8 @@ class FirebirdExecuteStatementCommandExecutorTest {
ServerPreparedStatementRegistry registry = new
ServerPreparedStatementRegistry();
when(connectionSession.getServerPreparedStatementRegistry()).thenReturn(registry);
when(connectionSession.getConnectionContext()).thenReturn(connectionContext);
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(new
ShardingSphereMetaData());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(new
ShardingSphereMetaData(Collections.emptyList(),
+ new ResourceMetaData(Collections.emptyMap()), new
RuleMetaData(Collections.emptyList()), new ConfigurationProperties(new
Properties())));
when(selectContext.getSqlStatement()).thenReturn(new
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement(DATABASE_TYPE));
registry.addPreparedStatement(1, new
FirebirdServerPreparedStatement("SELECT * FROM tbl", selectContext, new
HintValueContext()));
when(updateContext.getSqlStatement()).thenReturn(new
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.UpdateStatement(DATABASE_TYPE));
diff --git
a/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
index 96c2c626871..378d4468205 100644
---
a/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
+++
b/proxy/frontend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
@@ -33,8 +33,11 @@ import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementCont
import
org.apache.shardingsphere.infra.binder.context.statement.type.CommonSQLStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.dml.SelectStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.dml.UpdateStatementContext;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.hint.HintValueContext;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
import org.apache.shardingsphere.infra.session.query.QueryContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
@@ -74,6 +77,7 @@ import java.sql.Types;
import java.util.Collections;
import java.util.Iterator;
import java.util.Optional;
+import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -121,7 +125,8 @@ class MySQLComStmtExecuteExecutorTest {
new MySQLServerPreparedStatement("COMMIT", new
CommonSQLStatementContext(new CommitStatement(databaseType)), new
HintValueContext(), Collections.emptyList()));
ConnectionContext connectionContext = mockConnectionContext();
when(connectionSession.getConnectionContext()).thenReturn(connectionContext);
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(new
ShardingSphereMetaData());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(new
ShardingSphereMetaData(Collections.emptyList(),
+ new ResourceMetaData(Collections.emptyMap()), new
RuleMetaData(Collections.emptyList()), new ConfigurationProperties(new
Properties())));
}
private SQLStatementContext prepareSelectStatementContext() {
diff --git
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
index 19f7e65f9da..754764e0dbf 100644
---
a/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
+++
b/proxy/frontend/dialect/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/PostgreSQLCommandExecuteEngineTest.java
@@ -23,8 +23,11 @@ import
org.apache.shardingsphere.database.protocol.postgresql.packet.PostgreSQLP
import
org.apache.shardingsphere.database.protocol.postgresql.packet.generic.PostgreSQLCommandCompletePacket;
import
org.apache.shardingsphere.database.protocol.postgresql.packet.generic.PostgreSQLReadyForQueryPacket;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
@@ -45,6 +48,8 @@ import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Properties;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
@@ -123,7 +128,9 @@ class PostgreSQLCommandExecuteEngineTest {
ComputeNodeInstanceContext computeNodeInstanceContext =
mock(ComputeNodeInstanceContext.class);
when(computeNodeInstanceContext.getModeConfiguration()).thenReturn(mock(ModeConfiguration.class));
ContextManager contextManager = new ContextManager(
- new MetaDataContexts(new ShardingSphereMetaData(), new
ShardingSphereStatistics()), computeNodeInstanceContext, mock(), mock());
+ new MetaDataContexts(new
ShardingSphereMetaData(Collections.emptyList(), new
ResourceMetaData(Collections.emptyMap()),
+ new RuleMetaData(Collections.emptyList()), new
ConfigurationProperties(new Properties())), new ShardingSphereStatistics()),
+ computeNodeInstanceContext, mock(), mock());
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
commandExecuteEngine.writeQueryData(channelHandlerContext,
databaseConnectionManager, queryCommandExecutor, 0);
verify(connectionResourceLock).doAwait(channelHandlerContext);