This is an automated email from the ASF dual-hosted git repository. yx9o 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 db38798b6ae Remove test only constructor for ShardingAutoTableRuleConfiguration (#19918) db38798b6ae is described below commit db38798b6aeea316cc14093f09c3aeea8efcc51f Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sat Aug 6 13:34:23 2022 +0800 Remove test only constructor for ShardingAutoTableRuleConfiguration (#19918) --- .../sharding/api/config/rule/ShardingAutoTableRuleConfiguration.java | 4 ---- .../YamlShardingRuleAlgorithmProviderConfigurationSwapperTest.java | 2 +- .../distsql/query/UnusedShardingAlgorithmsQueryResultSetTest.java | 2 +- .../distsql/query/UnusedShardingKeyGeneratorsQueryResultSetTest.java | 2 +- .../update/DropShardingBindingTableRuleStatementUpdaterTest.java | 2 +- .../update/DropShardingBroadcastTableRuleStatementUpdaterTest.java | 2 +- .../distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java | 2 +- .../distsql/update/DropShardingTableRuleStatementUpdaterTest.java | 2 +- .../backend/handler/distsql/rql/DatabaseRulesCountResultSetTest.java | 2 +- .../handler/distsql/rql/RulesUsedResourceQueryResultSetTest.java | 2 +- 10 files changed, 9 insertions(+), 13 deletions(-) diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/rule/ShardingAutoTableRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/rule/ShardingAutoTableRuleConfiguration.java index 5aaebb5cfbb..7889e548599 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/rule/ShardingAutoTableRuleConfiguration.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/rule/ShardingAutoTableRuleConfiguration.java @@ -47,10 +47,6 @@ public final class ShardingAutoTableRuleConfiguration { // TODO prevent user to config this. private String actualDataNodes; - public ShardingAutoTableRuleConfiguration(final String logicTable) { - this(logicTable, null); - } - public ShardingAutoTableRuleConfiguration(final String logicTable, final String actualDataSources) { Preconditions.checkArgument(!Strings.isNullOrEmpty(logicTable), "LogicTable is required."); this.logicTable = logicTable; diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleAlgorithmProviderConfigurationSwapperTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleAlgorithmProviderConfigurationSwapperTest.java index 1b27ee83fbf..0e563820b83 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleAlgorithmProviderConfigurationSwapperTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingRuleAlgorithmProviderConfigurationSwapperTest.java @@ -53,7 +53,7 @@ public final class YamlShardingRuleAlgorithmProviderConfigurationSwapperTest { private AlgorithmProvidedShardingRuleConfiguration createAlgorithmProvidedShardingRuleConfiguration() { AlgorithmProvidedShardingRuleConfiguration result = new AlgorithmProvidedShardingRuleConfiguration(); result.getTables().add(new ShardingTableRuleConfiguration("foo_db")); - result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("foo_db")); + result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("foo_db", null)); result.getBindingTableGroups().add("foo_bind_tb"); result.setBroadcastTables(Collections.singleton("foo_broad_cast_tb")); result.setDefaultDatabaseShardingStrategy(mock(ShardingStrategyConfiguration.class)); diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingAlgorithmsQueryResultSetTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingAlgorithmsQueryResultSetTest.java index 2580d0c638e..fe13e6c1327 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingAlgorithmsQueryResultSetTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingAlgorithmsQueryResultSetTest.java @@ -81,7 +81,7 @@ public final class UnusedShardingAlgorithmsQueryResultSetTest { } private ShardingAutoTableRuleConfiguration createShardingAutoTableRuleConfiguration() { - ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table"); + ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table", null); result.setShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "hash_mod")); return result; } diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingKeyGeneratorsQueryResultSetTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingKeyGeneratorsQueryResultSetTest.java index 6b228f96767..4b345bc5cb3 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingKeyGeneratorsQueryResultSetTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/UnusedShardingKeyGeneratorsQueryResultSetTest.java @@ -73,7 +73,7 @@ public final class UnusedShardingKeyGeneratorsQueryResultSetTest { } private ShardingAutoTableRuleConfiguration createShardingAutoTableRuleConfiguration() { - ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table"); + ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table", null); result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("order_id", "snowflake_key_generator")); 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/DropShardingBindingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java index 92f9dc06732..a8f5e3190b0 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java @@ -137,7 +137,7 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest { private ShardingRuleConfiguration createCurrentRuleConfiguration() { ShardingRuleConfiguration result = new ShardingRuleConfiguration(); result.getTables().add(new ShardingTableRuleConfiguration("t_order_item")); - result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order")); + result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order", null)); result.getBindingTableGroups().add("t_order,t_order_item"); 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/DropShardingBroadcastTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java index 1d57660c3d8..b04fcd982a2 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java @@ -107,7 +107,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdaterTest { private ShardingRuleConfiguration createCurrentRuleConfiguration() { ShardingRuleConfiguration result = new ShardingRuleConfiguration(); result.getTables().add(new ShardingTableRuleConfiguration("t_order_item")); - result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order")); + result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order", null)); result.getBroadcastTables().add("t_order"); 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/DropShardingKeyGeneratorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java index 41c397dc8d1..ca6a997ad6d 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java @@ -82,7 +82,7 @@ public final class DropShardingKeyGeneratorStatementUpdaterTest { } private ShardingAutoTableRuleConfiguration createShardingAutoTableRuleConfiguration() { - ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table"); + ShardingAutoTableRuleConfiguration result = new ShardingAutoTableRuleConfiguration("auto_table", null); result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("order_id", "uuid_key_generator")); 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/DropShardingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java index 59c4685f2a1..e7b0868e297 100644 --- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java +++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java @@ -113,7 +113,7 @@ public final class DropShardingTableRuleStatementUpdaterTest { ShardingTableRuleConfiguration tableRuleConfig = new ShardingTableRuleConfiguration("t_order_item"); tableRuleConfig.setDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "t_order_item_algorithm")); result.getTables().add(tableRuleConfig); - result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order")); + result.getAutoTables().add(new ShardingAutoTableRuleConfiguration("t_order", null)); result.setBindingTableGroups(Collections.singleton("t_order_item")); result.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("user_id", "default_table_strategy")); result.getShardingAlgorithms().put("unused_algorithm", null); diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/DatabaseRulesCountResultSetTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/DatabaseRulesCountResultSetTest.java index efd2be26e95..0b3ef229fb8 100644 --- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/DatabaseRulesCountResultSetTest.java +++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/DatabaseRulesCountResultSetTest.java @@ -124,7 +124,7 @@ public final class DatabaseRulesCountResultSetTest { ShardingRule result = mock(ShardingRule.class); ShardingRuleConfiguration config = mock(ShardingRuleConfiguration.class); when(config.getTables()).thenReturn(Collections.singletonList(new ShardingTableRuleConfiguration("sharding_table"))); - when(config.getAutoTables()).thenReturn(Collections.singletonList(new ShardingAutoTableRuleConfiguration("sharding_auto_table"))); + when(config.getAutoTables()).thenReturn(Collections.singletonList(new ShardingAutoTableRuleConfiguration("sharding_auto_table", null))); when(config.getBindingTableGroups()).thenReturn(Collections.singletonList("binding_table_1,binding_table_2")); when(config.getBroadcastTables()).thenReturn(Arrays.asList("broadcast_table_1", "broadcast_table_2")); when(result.getConfiguration()).thenReturn(config); diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/RulesUsedResourceQueryResultSetTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/RulesUsedResourceQueryResultSetTest.java index 9842565a574..0bae9acc699 100644 --- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/RulesUsedResourceQueryResultSetTest.java +++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/RulesUsedResourceQueryResultSetTest.java @@ -86,7 +86,7 @@ public final class RulesUsedResourceQueryResultSetTest { ShardingRule result = mock(ShardingRule.class); ShardingRuleConfiguration config = mock(ShardingRuleConfiguration.class); when(config.getTables()).thenReturn(Collections.singleton(new ShardingTableRuleConfiguration("sharding_table"))); - when(config.getAutoTables()).thenReturn(Collections.singleton(new ShardingAutoTableRuleConfiguration("sharding_auto_table"))); + when(config.getAutoTables()).thenReturn(Collections.singleton(new ShardingAutoTableRuleConfiguration("sharding_auto_table", null))); when(result.getConfiguration()).thenReturn(config); return result; }