You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/02/23 04:50:15 UTC
[shardingsphere] branch master updated: Return values are named with result. (#15575)
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 fac1519 Return values are named with result. (#15575)
fac1519 is described below
commit fac1519bf4a100646be2c14e33ebd86fd2a7bd9c
Author: yx9o <ya...@163.com>
AuthorDate: Wed Feb 23 12:48:14 2022 +0800
Return values are named with result. (#15575)
---
.../ReadwriteSplittingRuleQueryResultSetTest.java | 14 +++++-----
.../distsql/rql/SchemaRulesCountResultSetTest.java | 30 +++++++++++-----------
.../distsql/rql/SingleTableQueryResultSetTest.java | 6 ++---
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingRuleQueryResultSetTest.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readw [...]
index 1eedd0c..62aac53 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingRuleQueryResultSetTest.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingRuleQueryResultSetTest.java
@@ -94,10 +94,10 @@ public final class ReadwriteSplittingRuleQueryResultSetTest {
}
private Properties getProperties(final String writeDataSource, final String readDataSources) {
- Properties props = new Properties();
- props.setProperty("write-data-source-name", writeDataSource);
- props.setProperty("read-data-source-names", readDataSources);
- return props;
+ Properties result = new Properties();
+ result.setProperty("write-data-source-name", writeDataSource);
+ result.setProperty("read-data-source-names", readDataSources);
+ return result;
}
@Test
@@ -117,7 +117,7 @@ public final class ReadwriteSplittingRuleQueryResultSetTest {
assertTrue(actual.contains("write_ds"));
assertTrue(actual.contains("read_ds_0,read_ds_1"));
}
-
+
private RuleConfiguration createRuleConfigurationWithAutoAwareDataSource() {
Properties props = new Properties();
props.setProperty("auto-aware-data-source-name", "rd_rs");
@@ -131,13 +131,13 @@ public final class ReadwriteSplittingRuleQueryResultSetTest {
result.put(ExportableConstants.EXPORTABLE_KEY_AUTO_AWARE_DATA_SOURCE, exportAutoAwareDataSourceMap());
return result;
}
-
+
private Map<String, Map<String, String>> exportAutoAwareDataSourceMap() {
Map<String, Map<String, String>> result = new HashMap<>(1, 1);
result.put("readwrite_ds", getAutoAwareDataSources());
return result;
}
-
+
private Map<String, String> getAutoAwareDataSources() {
Map<String, String> result = new HashMap<>(2, 1);
result.put(ExportableConstants.PRIMARY_DATA_SOURCE_NAME, "write_ds");
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SchemaRulesCountResultSetTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SchemaRulesCountResultSetTest.java
index fc737b1..0a53f66 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SchemaRulesCountResultSetTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SchemaRulesCountResultSetTest.java
@@ -73,30 +73,30 @@ public final class SchemaRulesCountResultSetTest {
}
private SingleTableRule mockSingleTableRule() {
- SingleTableRule singleTableRule = mock(SingleTableRule.class);
- when(singleTableRule.export(ExportableConstants.EXPORTABLE_KEY_SINGLE_TABLES)).thenReturn(java.util.Optional.of(Arrays.asList("single_table_1", "single_table_2")));
- return singleTableRule;
+ SingleTableRule result = mock(SingleTableRule.class);
+ when(result.export(ExportableConstants.EXPORTABLE_KEY_SINGLE_TABLES)).thenReturn(java.util.Optional.of(Arrays.asList("single_table_1", "single_table_2")));
+ return result;
}
private RuleConfiguration mockShardingTableRule() {
- ShardingRuleConfiguration shardingTableRule = mock(ShardingRuleConfiguration.class);
- when(shardingTableRule.getTables()).thenReturn(Collections.singletonList(new ShardingTableRuleConfiguration("sharding_table")));
- when(shardingTableRule.getAutoTables()).thenReturn(Collections.singletonList(new ShardingAutoTableRuleConfiguration("sharding_auto_table")));
- when(shardingTableRule.getBindingTableGroups()).thenReturn(Collections.singletonList("binding_table_1,binding_table_2"));
- when(shardingTableRule.getBroadcastTables()).thenReturn(Arrays.asList("broadcast_table_1", "broadcast_table_2"));
- return shardingTableRule;
+ ShardingRuleConfiguration result = mock(ShardingRuleConfiguration.class);
+ when(result.getTables()).thenReturn(Collections.singletonList(new ShardingTableRuleConfiguration("sharding_table")));
+ when(result.getAutoTables()).thenReturn(Collections.singletonList(new ShardingAutoTableRuleConfiguration("sharding_auto_table")));
+ when(result.getBindingTableGroups()).thenReturn(Collections.singletonList("binding_table_1,binding_table_2"));
+ when(result.getBroadcastTables()).thenReturn(Arrays.asList("broadcast_table_1", "broadcast_table_2"));
+ return result;
}
private RuleConfiguration mockReadwriteSplittingRule() {
- ReadwriteSplittingRuleConfiguration configuration = mock(ReadwriteSplittingRuleConfiguration.class);
- when(configuration.getDataSources()).thenReturn(Collections.singletonList(new ReadwriteSplittingDataSourceRuleConfiguration("readwrite_splitting", "", new Properties(), "")));
- return configuration;
+ ReadwriteSplittingRuleConfiguration result = mock(ReadwriteSplittingRuleConfiguration.class);
+ when(result.getDataSources()).thenReturn(Collections.singletonList(new ReadwriteSplittingDataSourceRuleConfiguration("readwrite_splitting", "", new Properties(), "")));
+ return result;
}
private RuleConfiguration mockEncryptRule() {
- EncryptRuleConfiguration configuration = mock(EncryptRuleConfiguration.class);
- when(configuration.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList(), false)));
- return configuration;
+ EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
+ when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList(), false)));
+ return result;
}
@Test
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SingleTableQueryResultSetTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SingleTableQueryResultSetTest.java
index a0cfb79..77aabd1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SingleTableQueryResultSetTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/SingleTableQueryResultSetTest.java
@@ -128,9 +128,9 @@ public final class SingleTableQueryResultSetTest {
}
private SingleTableRule mockSingleTableRule(final Map<String, Collection<DataNode>> singleTableDataNodeMap) {
- SingleTableRule singleTableRule = mock(SingleTableRule.class);
- when(singleTableRule.getSingleTableDataNodes()).thenReturn(singleTableDataNodeMap);
- return singleTableRule;
+ SingleTableRule result = mock(SingleTableRule.class);
+ when(result.getSingleTableDataNodes()).thenReturn(singleTableDataNodeMap);
+ return result;
}
private void addShardingSphereRule(final ShardingSphereRule... rules) {