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 c9dfb0e5c33 Code format for DatabaseRuleConfigurationManagerTest
(#38263)
c9dfb0e5c33 is described below
commit c9dfb0e5c333a1948e3ce7fa1ee42ff975bd0877
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Feb 28 12:21:28 2026 +0800
Code format for DatabaseRuleConfigurationManagerTest (#38263)
---
.../manager/rule/DatabaseRuleConfigurationManagerTest.java | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleConfigurationManagerTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleConfigurationManagerTest.java
index bc8636610d1..60ad6453d25 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleConfigurationManagerTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleConfigurationManagerTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.mode.metadata.manager.rule;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import
org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker;
import
org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
-import org.apache.shardingsphere.infra.instance.ComputeNodeInstanceContext;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
import org.apache.shardingsphere.infra.rule.PartialRuleUpdateSupported;
@@ -30,7 +29,6 @@ import
org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.factory.MetaDataContextsFactory;
-import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistFacade;
import
org.apache.shardingsphere.test.infra.framework.extension.mock.AutoMockExtension;
import
org.apache.shardingsphere.test.infra.framework.extension.mock.StaticMockSettings;
import org.junit.jupiter.api.Test;
@@ -83,7 +81,7 @@ class DatabaseRuleConfigurationManagerTest {
MockedConstruction<MetaDataContextsFactory> ignored =
mockConstruction(MetaDataContextsFactory.class,
(mock, context) ->
when(mock.createByAlterRule(eq(DATABASE_NAME), eq(false),
any(Collection.class),
eq(metaDataContexts))).thenReturn(mock(MetaDataContexts.class)))) {
when(DatabaseRulesBuilder.build(eq(DATABASE_NAME), any(), any(),
eq(ruleConfig), any(), any())).thenReturn(rebuiltRule);
- new DatabaseRuleConfigurationManager(metaDataContexts,
mock(ComputeNodeInstanceContext.class),
mock(MetaDataPersistFacade.class)).refresh(DATABASE_NAME, ruleConfig);
+ new DatabaseRuleConfigurationManager(metaDataContexts, mock(),
mock()).refresh(DATABASE_NAME, ruleConfig);
verify((PartialRuleUpdateSupported)
closableRule).updateConfiguration(ruleConfig);
verify(metaDataContexts).update(any(MetaDataContexts.class));
assertDoesNotThrow(() -> verify((AutoCloseable)
closableRule).close());
@@ -198,8 +196,7 @@ class DatabaseRuleConfigurationManagerTest {
try (
MockedConstruction<MetaDataContextsFactory> ignored =
mockConstruction(MetaDataContextsFactory.class,
(mock, context) ->
when(mock.createByAlterRule(eq(DATABASE_NAME), eq(false),
any(Collection.class), eq(metaDataContexts))).thenThrow(new
SQLException("failed")))) {
- assertThrows(SQLException.class,
- () -> new
DatabaseRuleConfigurationManager(metaDataContexts, mock(),
mock()).refresh(DATABASE_NAME, ruleConfig));
+ assertThrows(SQLException.class, () -> new
DatabaseRuleConfigurationManager(metaDataContexts, mock(),
mock()).refresh(DATABASE_NAME, ruleConfig));
}
}
@@ -219,8 +216,7 @@ class DatabaseRuleConfigurationManagerTest {
try (
MockedConstruction<MetaDataContextsFactory> ignored =
mockConstruction(MetaDataContextsFactory.class,
(mock, context) ->
when(mock.createByAlterRule(eq(DATABASE_NAME), eq(false),
any(Collection.class),
eq(metaDataContexts))).thenReturn(mock(MetaDataContexts.class)))) {
- assertThrows(Exception.class,
- () -> new
DatabaseRuleConfigurationManager(metaDataContexts, mock(),
mock()).refresh(DATABASE_NAME, ruleConfig));
+ assertThrows(Exception.class, () -> new
DatabaseRuleConfigurationManager(metaDataContexts, mock(),
mock()).refresh(DATABASE_NAME, ruleConfig));
}
}