This is an automated email from the ASF dual-hosted git repository.

wuweijie 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 48748d9  Revise #10770 (#10777)
48748d9 is described below

commit 48748d9b53c3192e9eaceb8d2b0f7fc0f8d9b856
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jun 11 23:55:59 2021 +0800

    Revise #10770 (#10777)
---
 ...rithmProvidedEncryptRuleConfigurationCheckerTest.java | 12 +++++-------
 .../checker/EncryptRuleConfigurationCheckerTest.java     | 12 +++++-------
 ...edReadwriteSplittingRuleConfigurationCheckerTest.java | 16 +++++++---------
 ...ithmProvidedShardingRuleConfigurationCheckerTest.java | 15 ++++++++-------
 .../checker/ShardingRuleConfigurationCheckerTest.java    | 16 ++++++++--------
 5 files changed, 33 insertions(+), 38 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationCheckerTest.java
index 126d0c1..3bc8c5e 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationCheckerTest.java
@@ -32,30 +32,28 @@ import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-/**
- * Algorithm provided encrypt rule configuration checker test.
- */
 public final class AlgorithmProvidedEncryptRuleConfigurationCheckerTest {
+    
     static {
         ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
     }
-
+    
     @Test
     public void assertCheckPass() {
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedEncryptRuleConfiguration.class);
         EncryptAlgorithm encryptAlgorithm = mock(EncryptAlgorithm.class);
         
when(ruleConfig.getEncryptors()).thenReturn(Collections.singletonMap("type1", 
encryptAlgorithm));
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedEncryptRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
     }
-
+    
     @Test(expected = IllegalStateException.class)
     public void assertCheckNoPass() {
         AlgorithmProvidedEncryptRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedEncryptRuleConfiguration.class);
         when(ruleConfig.getEncryptors()).thenReturn(Collections.emptyMap());
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedEncryptRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationCheckerTest.java
index cdbc6f4..6aed59d 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationCheckerTest.java
@@ -32,30 +32,28 @@ import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-/**
- * Encrypt rule configuration checker test.
- */
 public final class EncryptRuleConfigurationCheckerTest {
+    
     static {
         ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
     }
-
+    
     @Test
     public void assertCheckPass() {
         EncryptRuleConfiguration ruleConfig = 
mock(EncryptRuleConfiguration.class);
         ShardingSphereAlgorithmConfiguration algorithmConfiguration = 
mock(ShardingSphereAlgorithmConfiguration.class);
         
when(ruleConfig.getEncryptors()).thenReturn(Collections.singletonMap("type1", 
algorithmConfiguration));
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, instanceOf(EncryptRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
     }
-
+    
     @Test(expected = IllegalStateException.class)
     public void assertCheckNoPass() {
         EncryptRuleConfiguration ruleConfig = 
mock(EncryptRuleConfiguration.class);
         when(ruleConfig.getEncryptors()).thenReturn(Collections.emptyMap());
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, instanceOf(EncryptRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationCheckerTest.java
index c8bc8b3..2d308a9 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationCheckerTest.java
@@ -32,34 +32,32 @@ import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-/**
- * Algorithm provided readwrite-splitting ruleConfiguration checker testcase.
- */
 public final class 
AlgorithmProvidedReadwriteSplittingRuleConfigurationCheckerTest {
+    
     static {
         ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
     }
-
+    
     @Test
     public void assertCheckPass() {
         AlgorithmProvidedReadwriteSplittingRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedReadwriteSplittingRuleConfiguration.class);
         ReadwriteSplittingDataSourceRuleConfiguration ds0 = 
mock(ReadwriteSplittingDataSourceRuleConfiguration.class);
         when(ds0.getAutoAwareDataSourceName()).thenReturn("ds0");
-        
when(ruleConfig.getDataSources()).thenReturn(Collections.singletonList(ds0));
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        
when(ruleConfig.getDataSources()).thenReturn(Collections.singleton(ds0));
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
     }
-
+    
     @Test(expected = IllegalStateException.class)
     public void assertCheckNoPass() {
         AlgorithmProvidedReadwriteSplittingRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedReadwriteSplittingRuleConfiguration.class);
         ReadwriteSplittingDataSourceRuleConfiguration ds0 = 
mock(ReadwriteSplittingDataSourceRuleConfiguration.class);
         when(ds0.getAutoAwareDataSourceName()).thenReturn("");
         when(ds0.getWriteDataSourceName()).thenReturn("");
-        
when(ruleConfig.getDataSources()).thenReturn(Collections.singletonList(ds0));
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        
when(ruleConfig.getDataSources()).thenReturn(Collections.singleton(ds0));
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
index e82d12e..ab14b7a 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
@@ -34,33 +34,34 @@ import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class AlgorithmProvidedShardingRuleConfigurationCheckerTest {
+public final class AlgorithmProvidedShardingRuleConfigurationCheckerTest {
+    
     static {
         ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
     }
-
+    
     @Test
     public void assertCheckPass() {
         ShardingStrategyConfiguration strategyConfiguration = 
mock(ShardingStrategyConfiguration.class);
         ShardingTableRuleConfiguration ruleConfiguration = 
mock(ShardingTableRuleConfiguration.class);
         ShardingAutoTableRuleConfiguration autoTableRuleConfiguration = 
mock(ShardingAutoTableRuleConfiguration.class);
         AlgorithmProvidedShardingRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedShardingRuleConfiguration.class);
-        
when(ruleConfig.getTables()).thenReturn(Collections.singletonList(ruleConfiguration));
-        
when(ruleConfig.getAutoTables()).thenReturn(Collections.singletonList(autoTableRuleConfiguration));
+        
when(ruleConfig.getTables()).thenReturn(Collections.singleton(ruleConfiguration));
+        
when(ruleConfig.getAutoTables()).thenReturn(Collections.singleton(autoTableRuleConfiguration));
         
when(ruleConfig.getDefaultTableShardingStrategy()).thenReturn(strategyConfiguration);
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedShardingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
     }
-
+    
     @Test(expected = IllegalStateException.class)
     public void assertCheckNoPass() {
         AlgorithmProvidedShardingRuleConfiguration ruleConfig = 
mock(AlgorithmProvidedShardingRuleConfiguration.class);
         when(ruleConfig.getTables()).thenReturn(Collections.emptyList());
         when(ruleConfig.getAutoTables()).thenReturn(Collections.emptyList());
         when(ruleConfig.getDefaultTableShardingStrategy()).thenReturn(null);
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(AlgorithmProvidedShardingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationCheckerTest.java
index 71781bf..51d16d7 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationCheckerTest.java
@@ -34,34 +34,34 @@ import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class ShardingRuleConfigurationCheckerTest {
-
+public final class ShardingRuleConfigurationCheckerTest {
+    
     static {
         ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
     }
-
+    
     @Test
     public void assertCheckPass() {
         ShardingStrategyConfiguration strategyConfiguration = 
mock(ShardingStrategyConfiguration.class);
         ShardingTableRuleConfiguration ruleConfiguration = 
mock(ShardingTableRuleConfiguration.class);
         ShardingAutoTableRuleConfiguration autoTableRuleConfiguration = 
mock(ShardingAutoTableRuleConfiguration.class);
         ShardingRuleConfiguration ruleConfig = 
mock(ShardingRuleConfiguration.class);
-        
when(ruleConfig.getTables()).thenReturn(Collections.singletonList(ruleConfiguration));
-        
when(ruleConfig.getAutoTables()).thenReturn(Collections.singletonList(autoTableRuleConfiguration));
+        
when(ruleConfig.getTables()).thenReturn(Collections.singleton(ruleConfiguration));
+        
when(ruleConfig.getAutoTables()).thenReturn(Collections.singleton(autoTableRuleConfiguration));
         
when(ruleConfig.getDefaultTableShardingStrategy()).thenReturn(strategyConfiguration);
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(ShardingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);
     }
-
+    
     @Test(expected = IllegalStateException.class)
     public void assertCheckNoPass() {
         ShardingRuleConfiguration ruleConfig = 
mock(ShardingRuleConfiguration.class);
         when(ruleConfig.getTables()).thenReturn(Collections.emptyList());
         when(ruleConfig.getAutoTables()).thenReturn(Collections.emptyList());
         when(ruleConfig.getDefaultTableShardingStrategy()).thenReturn(null);
-        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
+        RuleConfigurationChecker checker = 
OrderedSPIRegistry.getRegisteredServices(Collections.singleton(ruleConfig), 
RuleConfigurationChecker.class).get(ruleConfig);
         assertNotNull(checker);
         assertThat(checker, 
instanceOf(ShardingRuleConfigurationChecker.class));
         checker.check("test", ruleConfig);

Reply via email to