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 de31cccab35 Refactor GlobalConfigurationManagerTest (#38366)
de31cccab35 is described below
commit de31cccab354c4befd88569e9c0e29f851aa506e
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Mar 7 12:10:27 2026 +0800
Refactor GlobalConfigurationManagerTest (#38366)
* Refactor CreateEncryptRuleExecutorTest
* Refactor CreateEncryptRuleExecutorTest
* Refactor GlobalConfigurationManagerTest
---
.../mode/metadata/manager/rule/GlobalConfigurationManagerTest.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
index afdcc8fbf5b..5a90adbcd4c 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/manager/rule/GlobalConfigurationManagerTest.java
@@ -43,7 +43,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -80,7 +79,7 @@ class GlobalConfigurationManagerTest {
when(closableRule.getConfiguration()).thenReturn(mock(RuleConfiguration.class,
withSettings().extraInterfaces(Serializable.class)));
ShardingSphereRule remainedRule = mock(ShardingSphereRule.class);
when(remainedRule.getConfiguration()).thenReturn(mock(RuleConfiguration.class,
withSettings().extraInterfaces(Cloneable.class)));
- ShardingSphereMetaData metaData = createMetaData(new RuleMetaData(new
LinkedList<>(Arrays.asList(closableRule, remainedRule))), new
TemporaryConfigurationProperties(new Properties()));
+ ShardingSphereMetaData metaData = createMetaData(new
RuleMetaData(Arrays.asList(closableRule, remainedRule)), new
TemporaryConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = mock(MetaDataContexts.class);
when(metaDataContexts.getMetaData()).thenReturn(metaData);
ShardingSphereRule builtRule = mock(ShardingSphereRule.class);
@@ -99,7 +98,7 @@ class GlobalConfigurationManagerTest {
RuleConfiguration newConfig = mock(RuleConfiguration.class,
withSettings().extraInterfaces(Serializable.class));
ShardingSphereRule nonClosableAssignableRule =
mock(ShardingSphereRule.class);
when(nonClosableAssignableRule.getConfiguration()).thenReturn(mock(RuleConfiguration.class,
withSettings().extraInterfaces(Serializable.class)));
- ShardingSphereMetaData metaData = createMetaData(new RuleMetaData(new
LinkedList<>(Collections.singleton(nonClosableAssignableRule))), new
TemporaryConfigurationProperties(new Properties()));
+ ShardingSphereMetaData metaData = createMetaData(new
RuleMetaData(Collections.singleton(nonClosableAssignableRule)), new
TemporaryConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = mock(MetaDataContexts.class,
RETURNS_DEEP_STUBS);
when(metaDataContexts.getMetaData()).thenReturn(metaData);
ShardingSphereRule builtRule = mock(ShardingSphereRule.class);
@@ -115,7 +114,7 @@ class GlobalConfigurationManagerTest {
ShardingSphereRule closableRule = mock(ShardingSphereRule.class,
withSettings().extraInterfaces(AutoCloseable.class));
when(closableRule.getConfiguration()).thenReturn(newConfig);
doThrow(Exception.class).when((AutoCloseable) closableRule).close();
- RuleMetaData globalRuleMetaData = new RuleMetaData(new
LinkedList<>(Collections.singleton(closableRule)));
+ RuleMetaData globalRuleMetaData = new
RuleMetaData(Collections.singleton(closableRule));
ShardingSphereMetaData metaData = createMetaData(globalRuleMetaData,
new TemporaryConfigurationProperties(new Properties()));
MetaDataContexts metaDataContexts = mock(MetaDataContexts.class,
RETURNS_DEEP_STUBS);
when(metaDataContexts.getMetaData()).thenReturn(metaData);