You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/06/07 15:50:12 UTC
[shardingsphere] branch master updated: Remove useless check with
new ShardingRule (#10709)
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 d216c09 Remove useless check with new ShardingRule (#10709)
d216c09 is described below
commit d216c09f786890d256080ef9cbc1a3f9bc6c9750
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Jun 7 23:49:36 2021 +0800
Remove useless check with new ShardingRule (#10709)
* For code format
* Remove useless check with new ShardingRule
---
.../java/org/apache/shardingsphere/sharding/rule/ShardingRule.java | 2 --
.../org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java | 5 -----
.../infra/rule/builder/ShardingSphereRulesBuilder.java | 2 +-
3 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index fab1c73..e462de8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -97,7 +97,6 @@ public final class ShardingRule implements FeatureRule, SchemaRule, DataNodeCont
private final KeyGenerateAlgorithm defaultKeyGenerateAlgorithm;
public ShardingRule(final ShardingRuleConfiguration config, final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
- Preconditions.checkArgument(null != config, "Sharding rule configuration cannot be null.");
Preconditions.checkArgument(null != dataSourceMap && !dataSourceMap.isEmpty(), "Data sources cannot be empty.");
dataSourceNames = getDataSourceNames(config.getTables(), config.getAutoTables(), dataSourceMap.keySet());
config.getShardingAlgorithms().forEach((key, value) -> shardingAlgorithms.put(key, ShardingSphereAlgorithmFactory.createAlgorithm(value, ShardingAlgorithm.class)));
@@ -115,7 +114,6 @@ public final class ShardingRule implements FeatureRule, SchemaRule, DataNodeCont
}
public ShardingRule(final AlgorithmProvidedShardingRuleConfiguration config, final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
- Preconditions.checkArgument(null != config, "Sharding rule configuration cannot be null.");
Preconditions.checkArgument(null != dataSourceMap && !dataSourceMap.isEmpty(), "Data sources cannot be empty.");
dataSourceNames = getDataSourceNames(config.getTables(), config.getAutoTables(), dataSourceMap.keySet());
shardingAlgorithms.putAll(config.getShardingAlgorithms());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
index fa09aeb..cf0473d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
@@ -286,11 +286,6 @@ public final class ShardingRuleTest {
}
@Test(expected = IllegalArgumentException.class)
- public void assertConstructShardingRuleWithNullShardingRuleConfiguration() {
- new ShardingRule((ShardingRuleConfiguration) null, mock(DatabaseType.class), createDataSourceMap());
- }
-
- @Test(expected = IllegalArgumentException.class)
public void assertConstructShardingRuleWithNullDataSourceNames() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
ShardingTableRuleConfiguration shardingTableRuleConfig = createTableRuleConfiguration("LOGIC_TABLE", "pr_ds_${0..1}.table_${0..2}");
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
index fa5af12..b5a208a 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
@@ -75,7 +75,7 @@ public final class ShardingSphereRulesBuilder {
builders.put(entry.getValue().build(), entry.getKey());
}
}
-
+
@SuppressWarnings({"unchecked", "rawtypes"})
private static Collection<SchemaRuleBuilder> getMissedKernelSchemaRuleBuilders(final Collection<SchemaRuleBuilder> configuredBuilders) {
Collection<Class<SchemaRuleBuilder>> configuredBuilderClasses = configuredBuilders.stream().map(each -> (Class<SchemaRuleBuilder>) each.getClass()).collect(Collectors.toSet());