diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingConfigurationRepositoryTupleSwapperEngineIT.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingConfigurationRepositoryTupleSwapperEngineIT.java index 262b6fc6ed61b..62540f9163ff2 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingConfigurationRepositoryTupleSwapperEngineIT.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingConfigurationRepositoryTupleSwapperEngineIT.java @@ -31,7 +31,7 @@ class ShardingConfigurationRepositoryTupleSwapperEngineIT extends RepositoryTupleSwapperEngineIT { ShardingConfigurationRepositoryTupleSwapperEngineIT() { - super("yaml/sharding-rule.yaml"); + super("yaml/sharding-rule-for-tuple.yaml"); } @Override diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingRuleConfigurationYamlUnmarshalIT.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingRuleConfigurationYamlUnmarshalIT.java index cd044384588c6..f24cf6d5d4173 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingRuleConfigurationYamlUnmarshalIT.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/it/ShardingRuleConfigurationYamlUnmarshalIT.java @@ -68,6 +68,7 @@ private static ShardingRuleConfiguration getExpectedRuleConfiguration() { ShardingTableRuleConfiguration orderItemTableRuleConfig = new ShardingTableRuleConfiguration("t_order_item", "ds_${0..1}.t_order_item_${0..1}"); orderItemTableRuleConfig.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "core_standard_fixture")); result.getTables().add(orderItemTableRuleConfig); + result.getBindingTableGroups().add(new ShardingTableReferenceRuleConfiguration(null, "t_order, t_order_item")); result.getBindingTableGroups().add(new ShardingTableReferenceRuleConfiguration("foo", "t_order, t_order_item")); result.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "database_inline")); result.setDefaultTableShardingStrategy(new NoneShardingStrategyConfiguration()); diff --git a/features/sharding/core/src/test/resources/yaml/sharding-rule-for-tuple.yaml b/features/sharding/core/src/test/resources/yaml/sharding-rule-for-tuple.yaml new file mode 100644 index 0000000000000..77e669e608e71 --- /dev/null +++ b/features/sharding/core/src/test/resources/yaml/sharding-rule-for-tuple.yaml @@ -0,0 +1,101 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +rules: +- !SHARDING + tables: + t_user: + actualDataNodes: ds_${0..1}.t_user_${0..15} + databaseStrategy: + complex: + shardingColumns: region_id, user_id + shardingAlgorithmName: core_complex_fixture + tableStrategy: + complex: + shardingColumns: region_id, user_id + shardingAlgorithmName: core_complex_fixture + t_stock: + actualDataNodes: ds_${0..1}.t_stock{0..8} + databaseStrategy: + hint: + shardingAlgorithmName: core_hint_fixture + tableStrategy: + hint: + shardingAlgorithmName: core_hint_fixture + t_order: + actualDataNodes: ds_${0..1}.t_order_${0..1} + tableStrategy: + standard: + shardingColumn: order_id + shardingAlgorithmName: table_inline + keyGenerateStrategy: + column: order_id + keyGeneratorName: snowflake + t_order_item: + actualDataNodes: ds_${0..1}.t_order_item_${0..1} + tableStrategy: + standard: + shardingColumn: order_id + shardingAlgorithmName: core_standard_fixture + bindingTables: + - t_order, t_order_item + - foo:t_order, t_order_item + defaultDatabaseStrategy: + standard: + shardingColumn: order_id + shardingAlgorithmName: database_inline + defaultTableStrategy: + none: + defaultShardingColumn: order_id + defaultKeyGenerateStrategy: + column: id + keyGeneratorName: snowflake + defaultAuditStrategy: + auditorNames: + - sharding_key_required_auditor + allowHintDisable: true + + shardingAlgorithms: + core_standard_fixture: + type: CORE.STANDARD.FIXTURE + core_complex_fixture: + type: CORE.COMPLEX.FIXTURE + core_hint_fixture: + type: CORE.HINT.FIXTURE + database_inline: + type: INLINE + props: + algorithm-expression: ds_${order_id % 2} + table_inline: + type: INLINE + props: + algorithm-expression: t_order_${order_id % 2} + + keyGenerators: + snowflake: + type: SNOWFLAKE + + auditors: + sharding_key_required_auditor: + type: DML_SHARDING_CONDITIONS + + shardingCache: + allowedMaxSqlLength: 512 + routeCache: + softValues: true + initialCapacity: 65536 + maximumSize: 262144 diff --git a/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml b/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml index a7a325eaf9f5b..0f2944e40281f 100644 --- a/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml +++ b/features/sharding/core/src/test/resources/yaml/sharding-rule.yaml @@ -52,7 +52,7 @@ rules: shardingColumn: order_id shardingAlgorithmName: core_standard_fixture bindingTables: - - foo:t_order, t_order_item + - foo:t_order, t_order_item defaultDatabaseStrategy: standard: shardingColumn: order_id