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 a3026e2 Return values are named with result. (#14839)
a3026e2 is described below
commit a3026e25abb5b08f1a3ef36a7fb53dfa5302cf9c
Author: yx9o <[email protected]>
AuthorDate: Wed Jan 19 10:00:23 2022 +0800
Return values are named with result. (#14839)
---
...efaultShardingStrategyStatementUpdaterTest.java | 16 +++++++--------
...AlterShardingTableRuleStatementUpdaterTest.java | 22 ++++++++++----------
...efaultShardingStrategyStatementUpdaterTest.java | 16 +++++++--------
...reateShardingTableRuleStatementUpdaterTest.java | 24 +++++++++++-----------
4 files changed, 39 insertions(+), 39 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
index 733735f..bca50b3 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
@@ -94,7 +94,7 @@ public final class
AlterDefaultShardingStrategyStatementUpdaterTest {
assertThat(defaultTableShardingStrategy.getShardingAlgorithmName(),
is("order_id_algorithm"));
assertThat(defaultTableShardingStrategy.getShardingColumn(),
is("order_id"));
}
-
+
@Test
public void assertAlterDefaultDatabaseShardingStrategy() throws
DistSQLException {
AlgorithmSegment databaseAlgorithmSegment =
getAutoCreativeAlgorithmSegment("inline", newProperties("algorithm-expression",
"ds_${user_id% 2}"));
@@ -108,14 +108,14 @@ public final class
AlterDefaultShardingStrategyStatementUpdaterTest {
assertThat(defaultDatabaseShardingStrategy.getShardingAlgorithmName(),
is("default_database_inline"));
assertThat(defaultDatabaseShardingStrategy.getShardingColumn(),
is("user_id"));
}
-
- private AlgorithmSegment getAutoCreativeAlgorithmSegment(final String
name, final Properties properties) {
- return new AlgorithmSegment(name, properties);
+
+ private AlgorithmSegment getAutoCreativeAlgorithmSegment(final String
name, final Properties props) {
+ return new AlgorithmSegment(name, props);
}
-
+
private static Properties newProperties(final String key, final String
value) {
- Properties properties = new Properties();
- properties.put(key, value);
- return properties;
+ Properties result = new Properties();
+ result.put(key, value);
+ return result;
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
index 57cb44f..421da0d 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
@@ -157,7 +157,7 @@ public final class
AlterShardingTableRuleStatementUpdaterTest {
result.setKeyGenerateSegment(new KeyGenerateSegment("product_id", new
AlgorithmSegment("SNOWFLAKE_TEST", newProperties("work", "123"))));
return result;
}
-
+
private AlgorithmSegment getAutoCreativeAlgorithmSegment(final String
name, final Properties properties) {
return new AlgorithmSegment(name, properties);
}
@@ -172,16 +172,16 @@ public final class
AlterShardingTableRuleStatementUpdaterTest {
}
private ShardingTableRuleConfiguration createTableRuleConfiguration() {
- ShardingTableRuleConfiguration tableRuleConfiguration = new
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order${0..1}");
- tableRuleConfiguration.setTableShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_algorithm"));
- return tableRuleConfiguration;
+ ShardingTableRuleConfiguration result = new
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order${0..1}");
+ result.setTableShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_algorithm"));
+ return result;
}
private ShardingAutoTableRuleConfiguration
createAutoTableRuleConfiguration() {
- ShardingAutoTableRuleConfiguration autoTableRuleConfiguration = new
ShardingAutoTableRuleConfiguration("t_order_item", "ds_0");
- autoTableRuleConfiguration.setShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_MOD_TEST"));
- autoTableRuleConfiguration.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("product_id", "product_id_snowflake_test"));
- return autoTableRuleConfiguration;
+ ShardingAutoTableRuleConfiguration result = new
ShardingAutoTableRuleConfiguration("t_order_item", "ds_0");
+ result.setShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_MOD_TEST"));
+ result.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("product_id", "product_id_snowflake_test"));
+ return result;
}
private static Collection<ShardingSphereRule> createShardingSphereRule() {
@@ -189,9 +189,9 @@ public final class
AlterShardingTableRuleStatementUpdaterTest {
}
private static Properties newProperties(final String key, final String
value) {
- Properties properties = new Properties();
- properties.put(key, value);
- return properties;
+ Properties result = new Properties();
+ result.put(key, value);
+ return result;
}
private static Map<String, DataSource> createDataSource() {
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
index 87a76a2..a3feb62 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
@@ -94,7 +94,7 @@ public final class
CreateDefaultShardingStrategyStatementUpdaterTest {
assertThat(defaultTableShardingStrategy.getShardingAlgorithmName(),
is("order_id_algorithm"));
assertThat(defaultTableShardingStrategy.getShardingColumn(),
is("order_id"));
}
-
+
@Test
public void assertCreateDefaultDatabaseShardingStrategy() throws
DistSQLException {
AlgorithmSegment databaseAlgorithmSegment =
getAutoCreativeAlgorithmSegment("inline", newProperties("algorithm-expression",
"ds_${user_id% 2}"));
@@ -107,14 +107,14 @@ public final class
CreateDefaultShardingStrategyStatementUpdaterTest {
assertThat(defaultDatabaseShardingStrategy.getShardingAlgorithmName(),
is("default_database_inline"));
assertThat(defaultDatabaseShardingStrategy.getShardingColumn(),
is("user_id"));
}
-
- private AlgorithmSegment getAutoCreativeAlgorithmSegment(final String
name, final Properties properties) {
- return new AlgorithmSegment(name, properties);
+
+ private AlgorithmSegment getAutoCreativeAlgorithmSegment(final String
name, final Properties props) {
+ return new AlgorithmSegment(name, props);
}
-
+
private static Properties newProperties(final String key, final String
value) {
- Properties properties = new Properties();
- properties.put(key, value);
- return properties;
+ Properties result = new Properties();
+ result.put(key, value);
+ return result;
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
index 84e6145..2bba1b6 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
@@ -161,16 +161,16 @@ public final class
CreateShardingTableRuleStatementUpdaterTest {
}
private ShardingTableRuleConfiguration createTableRuleConfiguration() {
- ShardingTableRuleConfiguration tableRuleConfiguration = new
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..1}");
- tableRuleConfiguration.setTableShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_algorithm"));
- return tableRuleConfiguration;
+ ShardingTableRuleConfiguration result = new
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..1}");
+ result.setTableShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_algorithm"));
+ return result;
}
private ShardingAutoTableRuleConfiguration
createAutoTableRuleConfiguration() {
- ShardingAutoTableRuleConfiguration autoTableRuleConfiguration = new
ShardingAutoTableRuleConfiguration("t_order_item", "ds_0");
- autoTableRuleConfiguration.setShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_MOD_TEST"));
- autoTableRuleConfiguration.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("product_id", "product_id_snowflake_test"));
- return autoTableRuleConfiguration;
+ ShardingAutoTableRuleConfiguration result = new
ShardingAutoTableRuleConfiguration("t_order_item", "ds_0");
+ result.setShardingStrategy(new
StandardShardingStrategyConfiguration("order_id", "t_order_MOD_TEST"));
+ result.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("product_id", "product_id_snowflake_test"));
+ return result;
}
private static Collection<ShardingSphereRule> createShardingSphereRule() {
@@ -180,13 +180,13 @@ public final class
CreateShardingTableRuleStatementUpdaterTest {
}
private static Properties newProperties(final String key, final String
value) {
- Properties properties = new Properties();
- properties.put(key, value);
- return properties;
+ Properties result = new Properties();
+ result.put(key, value);
+ return result;
}
private static Map<String, DataSource> createDataSource() {
- Map<String, DataSource> result = new HashMap<>();
+ Map<String, DataSource> result = new HashMap<>(2, 1);
result.put("ds_0", mock(DataSource.class));
result.put("ds_1", mock(DataSource.class));
return result;
@@ -201,7 +201,7 @@ public final class
CreateShardingTableRuleStatementUpdaterTest {
@Override
public Map<String, Collection<String>> getDataSourceMapper() {
- Map<String, Collection<String>> result = new HashMap<>();
+ Map<String, Collection<String>> result = new HashMap<>(1, 1);
result.put("logic_ds", null);
return result;
}