未验证 提交 fe5bce52 编写于 作者: L Liang Zhang 提交者: GitHub

Pluggable of YAML swapper (#5604)

* init version of pluggable YAML swapper

* move shadow yaml to shadow-common

* move master-slave yaml to master-slave-common

* fix yaml

* refactor sharding yaml package

* move YamlRootRuleConfigurations to common module
上级 be262f10
......@@ -19,6 +19,7 @@ package org.apache.shardingsphere.encrypt.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRuleConfiguration;
import java.util.LinkedHashMap;
......@@ -29,9 +30,14 @@ import java.util.Map;
*/
@Getter
@Setter
public class YamlEncryptRuleConfiguration implements YamlRuleConfiguration {
public final class YamlEncryptRuleConfiguration implements YamlRuleConfiguration {
private Map<String, YamlEncryptorRuleConfiguration> encryptors = new LinkedHashMap<>();
private Map<String, YamlEncryptTableRuleConfiguration> tables = new LinkedHashMap<>();
@Override
public Class<EncryptRuleConfiguration> getRuleConfigurationType() {
return EncryptRuleConfiguration.class;
}
}
......@@ -20,12 +20,12 @@ package org.apache.shardingsphere.encrypt.yaml.swapper;
import com.google.common.collect.Maps;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlRuleConfigurationSwapper;
/**
* Encrypt rule configuration yaml swapper.
*/
public final class EncryptRuleConfigurationYamlSwapper implements YamlSwapper<YamlEncryptRuleConfiguration, EncryptRuleConfiguration> {
public final class EncryptRuleConfigurationYamlSwapper implements YamlRuleConfigurationSwapper<YamlEncryptRuleConfiguration, EncryptRuleConfiguration> {
private final EncryptorRuleConfigurationYamlSwapper encryptorRuleConfigurationYamlSwapper = new EncryptorRuleConfigurationYamlSwapper();
......@@ -44,4 +44,14 @@ public final class EncryptRuleConfigurationYamlSwapper implements YamlSwapper<Ya
return new EncryptRuleConfiguration(Maps.transformValues(yamlConfiguration.getEncryptors(), encryptorRuleConfigurationYamlSwapper::swap),
Maps.transformValues(yamlConfiguration.getTables(), encryptTableRuleConfigurationYamlSwapper::swap));
}
@Override
public int getOrder() {
return 20;
}
@Override
public Class<EncryptRuleConfiguration> getTypeClass() {
return EncryptRuleConfiguration.class;
}
}
#
# 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.
#
org.apache.shardingsphere.encrypt.yaml.swapper.EncryptRuleConfigurationYamlSwapper
......@@ -18,8 +18,8 @@
package org.apache.shardingsphere.encrypt.rewrite.parameterized;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.sql.parser.SQLParserEngine;
import org.apache.shardingsphere.sql.parser.SQLParserEngineFactory;
import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData;
......
......@@ -46,7 +46,7 @@ dataSources:
maxPoolSize: 50
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -33,7 +33,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ds_ms
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -33,7 +33,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ds_ms
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -33,7 +33,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ds_ms
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
column: shadow
shadowMappings:
ds: ds_0
......@@ -33,7 +33,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ds_ms
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order
......
......@@ -48,7 +48,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......@@ -84,7 +84,7 @@ rules:
shardingAlgorithm:
type: STANDARD_TEST_DB
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ds_0:
masterDataSourceName: ds_master_0
......
......@@ -48,7 +48,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......@@ -90,7 +90,7 @@ rules:
props:
algorithm.expression: ds_${user_id % 2}
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ds_0:
masterDataSourceName: ds_master_0
......
......@@ -23,7 +23,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds.t_order_${0..1}
......
......@@ -23,7 +23,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds.t_order_${0..1}
......
......@@ -26,7 +26,7 @@ dataSources:
password: postgres
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -30,7 +30,7 @@ dataSources:
autoCommit: false
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -55,7 +55,7 @@ dataSources:
maxPoolSize: 50
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ms_ds
......
......@@ -46,7 +46,7 @@ dataSources:
maxPoolSize: 50
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -32,7 +32,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ms_ds:
name: ds_ms
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.masterslave;
package org.apache.shardingsphere.masterslave.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,10 +15,11 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.masterslave;
package org.apache.shardingsphere.masterslave.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRuleConfiguration;
import java.util.LinkedHashMap;
......@@ -32,4 +33,9 @@ import java.util.Map;
public final class YamlMasterSlaveRuleConfiguration implements YamlRuleConfiguration {
private Map<String, YamlMasterSlaveDataSourceConfiguration> dataSources = new LinkedHashMap<>();
@Override
public Class<MasterSlaveRuleConfiguration> getRuleConfigurationType() {
return MasterSlaveRuleConfiguration.class;
}
}
......@@ -15,15 +15,15 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.swapper;
package org.apache.shardingsphere.masterslave.core.yaml.swapper;
import com.google.common.base.Strings;
import org.apache.shardingsphere.masterslave.api.config.LoadBalanceStrategyConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlRuleConfigurationSwapper;
import java.util.Collection;
import java.util.LinkedHashMap;
......@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
/**
* Master-slave rule configuration YAML swapper.
*/
public final class MasterSlaveRuleConfigurationYamlSwapper implements YamlSwapper<YamlMasterSlaveRuleConfiguration, MasterSlaveRuleConfiguration> {
public final class MasterSlaveRuleConfigurationYamlSwapper implements YamlRuleConfigurationSwapper<YamlMasterSlaveRuleConfiguration, MasterSlaveRuleConfiguration> {
@Override
public YamlMasterSlaveRuleConfiguration swap(final MasterSlaveRuleConfiguration data) {
......@@ -70,4 +70,14 @@ public final class MasterSlaveRuleConfigurationYamlSwapper implements YamlSwappe
private LoadBalanceStrategyConfiguration getLoadBalanceStrategyConfiguration(final YamlMasterSlaveDataSourceConfiguration yamlGroup) {
return Strings.isNullOrEmpty(yamlGroup.getLoadBalanceAlgorithmType()) ? null : new LoadBalanceStrategyConfiguration(yamlGroup.getLoadBalanceAlgorithmType(), yamlGroup.getProps());
}
@Override
public int getOrder() {
return 10;
}
@Override
public Class<MasterSlaveRuleConfiguration> getTypeClass() {
return MasterSlaveRuleConfiguration.class;
}
}
#
# 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.
#
org.apache.shardingsphere.masterslave.core.yaml.swapper.MasterSlaveRuleConfigurationYamlSwapper
......@@ -15,13 +15,13 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.swapper;
package org.apache.shardingsphere.masterslave.core.yaml.swapper;
import org.apache.shardingsphere.masterslave.api.config.LoadBalanceStrategyConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveDataSourceConfiguration;
import org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration;
import org.junit.Test;
import java.util.Arrays;
......
......@@ -15,10 +15,11 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.shadow;
package org.apache.shardingsphere.shadow.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRuleConfiguration;
import java.util.Map;
......@@ -28,9 +29,14 @@ import java.util.Map;
*/
@Getter
@Setter
public class YamlShadowRuleConfiguration implements YamlRuleConfiguration {
public final class YamlShadowRuleConfiguration implements YamlRuleConfiguration {
private String column;
private Map<String, String> shadowMappings;
@Override
public Class<ShadowRuleConfiguration> getRuleConfigurationType() {
return ShadowRuleConfiguration.class;
}
}
......@@ -15,16 +15,16 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.swapper;
package org.apache.shardingsphere.shadow.core.yaml.swapper;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlRuleConfigurationSwapper;
/**
* Shadow rule configuration yaml swapper.
*/
public final class ShadowRuleConfigurationYamlSwapper implements YamlSwapper<YamlShadowRuleConfiguration, ShadowRuleConfiguration> {
public final class ShadowRuleConfigurationYamlSwapper implements YamlRuleConfigurationSwapper<YamlShadowRuleConfiguration, ShadowRuleConfiguration> {
@Override
public YamlShadowRuleConfiguration swap(final ShadowRuleConfiguration data) {
......@@ -38,4 +38,14 @@ public final class ShadowRuleConfigurationYamlSwapper implements YamlSwapper<Yam
public ShadowRuleConfiguration swap(final YamlShadowRuleConfiguration yamlConfiguration) {
return new ShadowRuleConfiguration(yamlConfiguration.getColumn(), yamlConfiguration.getShadowMappings());
}
@Override
public int getOrder() {
return -5;
}
@Override
public Class<ShadowRuleConfiguration> getTypeClass() {
return ShadowRuleConfiguration.class;
}
}
#
# 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.
#
org.apache.shardingsphere.shadow.core.yaml.swapper.ShadowRuleConfigurationYamlSwapper
......@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.underlying.common.yaml.representer.processor.NoneTupleProcessor;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.auth.Authentication;
import org.apache.shardingsphere.underlying.common.auth.yaml.swapper.AuthenticationYamlSwapper;
import org.apache.shardingsphere.underlying.common.config.RuleConfiguration;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding;
package org.apache.shardingsphere.sharding.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,10 +15,11 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding;
package org.apache.shardingsphere.sharding.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRuleConfiguration;
import java.util.ArrayList;
......@@ -44,4 +45,9 @@ public final class YamlShardingRuleConfiguration implements YamlRuleConfiguratio
private YamlShardingStrategyConfiguration defaultTableStrategy;
private YamlKeyGeneratorConfiguration defaultKeyGenerator;
@Override
public Class<ShardingRuleConfiguration> getRuleConfigurationType() {
return ShardingRuleConfiguration.class;
}
}
......@@ -15,14 +15,14 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding;
package org.apache.shardingsphere.sharding.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlStandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlStandardShardingStrategyConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlConfiguration;
/**
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding;
package org.apache.shardingsphere.sharding.core.yaml.config;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlConfiguration;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
/**
* None sharding strategy configuration for YAML.
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
import lombok.Getter;
import lombok.Setter;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy;
package org.apache.shardingsphere.sharding.core.yaml.config.strategy;
import lombok.Getter;
import lombok.Setter;
......
......@@ -17,8 +17,8 @@
package org.apache.shardingsphere.sharding.core.yaml.constructor;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.constructor.construct.YamlNoneShardingStrategyConfigurationConstruct;
import org.apache.shardingsphere.underlying.common.yaml.constructor.AbstractTypeConstructor;
......
......@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.core.yaml.constructor.construct;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.yaml.snakeyaml.constructor.Construct;
import org.yaml.snakeyaml.nodes.Node;
......
......@@ -19,7 +19,7 @@ package org.apache.shardingsphere.sharding.core.yaml.swapper;
import com.google.common.base.Strings;
import org.apache.shardingsphere.sharding.api.config.KeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.sharding.spi.keygen.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.type.TypedSPIRegistry;
......
......@@ -19,16 +19,16 @@ package org.apache.shardingsphere.sharding.core.yaml.swapper;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.TableRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlTableRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlTableRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlRuleConfigurationSwapper;
import java.util.Map.Entry;
/**
* Sharding rule configuration YAML swapper.
*/
public final class ShardingRuleConfigurationYamlSwapper implements YamlSwapper<YamlShardingRuleConfiguration, ShardingRuleConfiguration> {
public final class ShardingRuleConfigurationYamlSwapper implements YamlRuleConfigurationSwapper<YamlShardingRuleConfiguration, ShardingRuleConfiguration> {
private final TableRuleConfigurationYamlSwapper tableRuleConfigurationYamlSwapper = new TableRuleConfigurationYamlSwapper();
......@@ -77,4 +77,14 @@ public final class ShardingRuleConfigurationYamlSwapper implements YamlSwapper<Y
}
return result;
}
@Override
public int getOrder() {
return 0;
}
@Override
public Class<ShardingRuleConfiguration> getTypeClass() {
return ShardingRuleConfiguration.class;
}
}
......@@ -26,12 +26,12 @@ import org.apache.shardingsphere.sharding.api.config.strategy.StandardShardingSt
import org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlStandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlStandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.sharding.spi.algorithm.ShardingAlgorithm;
import org.apache.shardingsphere.sharding.spi.type.TypedSPIRegistry;
......
......@@ -19,7 +19,7 @@ package org.apache.shardingsphere.sharding.core.yaml.swapper;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.sharding.api.config.TableRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlTableRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlTableRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
/**
......
/*
* 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.
*/
package org.apache.shardingsphere.sharding.core.yaml.swapper.root;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.swapper.EncryptRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.swapper.MasterSlaveRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.sharding.core.yaml.swapper.ShadowRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.sharding.core.yaml.swapper.ShardingRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.underlying.common.config.RuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import java.util.Collection;
import java.util.LinkedList;
/**
* Rule root configurations YAML swapper.
*/
public final class RuleRootConfigurationsYamlSwapper implements YamlSwapper<YamlRootRuleConfigurations, Collection<RuleConfiguration>> {
private final ShardingRuleConfigurationYamlSwapper shardingRuleConfigurationYamlSwapper = new ShardingRuleConfigurationYamlSwapper();
private final MasterSlaveRuleConfigurationYamlSwapper masterSlaveRuleConfigurationYamlSwapper = new MasterSlaveRuleConfigurationYamlSwapper();
private final EncryptRuleConfigurationYamlSwapper encryptRuleConfigurationYamlSwapper = new EncryptRuleConfigurationYamlSwapper();
private final ShadowRuleConfigurationYamlSwapper shadowRuleConfigurationYamlSwapper = new ShadowRuleConfigurationYamlSwapper();
@Override
public YamlRootRuleConfigurations swap(final Collection<RuleConfiguration> data) {
YamlRootRuleConfigurations result = new YamlRootRuleConfigurations();
for (RuleConfiguration each : data) {
if (each instanceof ShardingRuleConfiguration) {
result.getRules().add(shardingRuleConfigurationYamlSwapper.swap((ShardingRuleConfiguration) each));
} else if (each instanceof MasterSlaveRuleConfiguration) {
result.getRules().add(masterSlaveRuleConfigurationYamlSwapper.swap((MasterSlaveRuleConfiguration) each));
} else if (each instanceof EncryptRuleConfiguration) {
result.getRules().add(encryptRuleConfigurationYamlSwapper.swap((EncryptRuleConfiguration) each));
} else if (each instanceof ShadowRuleConfiguration) {
result.getRules().add(shadowRuleConfigurationYamlSwapper.swap((ShadowRuleConfiguration) each));
}
}
return result;
}
@Override
public Collection<RuleConfiguration> swap(final YamlRootRuleConfigurations configurations) {
Collection<RuleConfiguration> result = new LinkedList<>();
for (YamlRuleConfiguration each : configurations.getRules()) {
if (each instanceof YamlShardingRuleConfiguration) {
result.add(shardingRuleConfigurationYamlSwapper.swap((YamlShardingRuleConfiguration) each));
}
if (each instanceof YamlMasterSlaveRuleConfiguration) {
result.add(masterSlaveRuleConfigurationYamlSwapper.swap((YamlMasterSlaveRuleConfiguration) each));
}
if (each instanceof YamlEncryptRuleConfiguration) {
result.add(encryptRuleConfigurationYamlSwapper.swap((YamlEncryptRuleConfiguration) each));
}
if (each instanceof YamlShadowRuleConfiguration) {
result.add(shadowRuleConfigurationYamlSwapper.swap((YamlShadowRuleConfiguration) each));
}
}
return result;
}
}
#
# 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.
#
org.apache.shardingsphere.sharding.core.yaml.swapper.ShardingRuleConfigurationYamlSwapper
......@@ -71,7 +71,7 @@ public final class ConfigurationLoggerTest {
@Test
public void assertLogShardingRuleConfiguration() {
String yaml = "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n"
+ " tables:\n"
+ " user:\n"
+ " actualDataNodes: ds_${0}.user_${0..1}\n"
......@@ -93,7 +93,7 @@ public final class ConfigurationLoggerTest {
@Test
public void assertLogMasterSlaveRuleConfiguration() {
String yaml = "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration\n"
+ " dataSources:\n"
+ " ms_ds:\n"
+ " masterDataSourceName: master_ds\n"
......@@ -163,7 +163,7 @@ public final class ConfigurationLoggerTest {
@Test
public void assertLogRuleConfigurationWithShardingRuleConfiguration() {
String yaml = "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n"
+ " tables:\n"
+ " user:\n"
+ " actualDataNodes: ds_${0}.user_${0..1}\n"
......@@ -177,7 +177,7 @@ public final class ConfigurationLoggerTest {
@Test
public void assertLogRuleConfigurationWithMasterSlaveRuleConfiguration() {
String yaml = "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration\n"
+ " dataSources:\n"
+ " ms_ds:\n"
+ " masterDataSourceName: master_ds\n"
......
......@@ -17,9 +17,9 @@
package org.apache.shardingsphere.sharding.core.yaml.engine;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine;
import org.junit.Test;
......
......@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.core.yaml.swapper;
import org.apache.shardingsphere.sharding.api.config.KeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.spi.keygen.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.type.TypedSPIRegistry;
import org.junit.Test;
......
......@@ -21,10 +21,10 @@ import org.apache.shardingsphere.sharding.api.config.KeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.TableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.ShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlTableRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlTableRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.junit.Before;
import org.junit.Test;
......
......@@ -27,12 +27,12 @@ import org.apache.shardingsphere.sharding.api.sharding.standard.StandardSharding
import org.apache.shardingsphere.sharding.core.fixture.ComplexKeysShardingAlgorithmFixture;
import org.apache.shardingsphere.sharding.core.fixture.HintShardingAlgorithmFixture;
import org.apache.shardingsphere.sharding.core.fixture.StandardShardingAlgorithmFixture;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlStandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlComplexShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlHintShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlShardingAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlStandardShardingStrategyConfiguration;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
......
......@@ -21,9 +21,9 @@ import org.apache.shardingsphere.sharding.api.config.KeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.api.config.TableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.ShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.StandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlTableRuleConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlKeyGeneratorConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlTableRuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.swapper.YamlSwapper;
import org.junit.Before;
import org.junit.Test;
......
......@@ -33,7 +33,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
master-slave-ds:
masterDataSourceName: master_ds
......
......@@ -48,7 +48,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
column: is_shadow
shadowMappings:
master_ds: shadow_master_ds
......
......@@ -53,7 +53,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_user:
actualDataNodes: ds_${0..1}.t_user_${0..15}
......@@ -112,7 +112,7 @@ rules:
defaultTableStrategy:
none:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ds_0:
masterDataSourceName: master_ds_0
......
......@@ -18,9 +18,9 @@
package org.apache.shardingsphere.sharding.rewrite.parameterized;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.sql.parser.SQLParserEngine;
import org.apache.shardingsphere.sql.parser.SQLParserEngineFactory;
import org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaData;
......
......@@ -18,9 +18,9 @@
package org.apache.shardingsphere.sharding.rewrite.parameterized;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.sql.parser.SQLParserEngine;
import org.apache.shardingsphere.sql.parser.SQLParserEngineFactory;
import org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaData;
......
......@@ -23,7 +23,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_account:
actualDataNodes: db.t_account_${0..1}
......
......@@ -23,7 +23,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_account:
actualDataNodes: db.t_account_${0..1}
......
......@@ -23,7 +23,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_account:
actualDataNodes: db.t_account_${0..1}
......
......@@ -54,7 +54,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
#- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
# dataSources:
# ms_ds:
# name: ms_ds
......@@ -98,7 +98,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
#- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
# dataSources:
# ms_ds:
# name: ms_ds
......
......@@ -47,7 +47,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
#- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
# column: shadow
# shadowMappings:
# ds: shadow_ds
......@@ -80,7 +80,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
#- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
# column: shadow
# shadowMappings:
# ds: shadow_ds
......@@ -46,7 +46,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
#- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
# tables:
# t_order:
# actualDataNodes: ds_${0..1}.t_order_${0..1}
......@@ -111,7 +111,7 @@
# maxPoolSize: 50
#
#rules:
#- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
#- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
# tables:
# t_order:
# actualDataNodes: ds_${0..1}.t_order_${0..1}
......
......@@ -19,9 +19,9 @@ package org.apache.shardingsphere.shardingjdbc.api.yaml;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.shardingjdbc.api.ShardingSphereDataSourceFactory;
import org.apache.shardingsphere.underlying.common.database.DefaultSchema;
import org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine;
......
......@@ -19,8 +19,8 @@ package org.apache.shardingsphere.shardingjdbc.common.base;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.shardingjdbc.api.ShardingSphereDataSourceFactory;
import org.apache.shardingsphere.shardingjdbc.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.shardingjdbc.jdbc.core.connection.ShardingSphereConnection;
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
test_ds:
name: test_ds
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
column: shadow
shadowMappings:
jdbc_0: jdbc_1
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: jdbc_${0..1}.t_order_${0..1}
......
......@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.orchestration.center.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.center.yaml.config.YamlCenterRepositoryConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingSphereDataSource;
import org.apache.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingSphereDataSource;
import org.apache.shardingsphere.shardingjdbc.orchestration.internal.util.YamlCenterRepositoryConfigurationSwapperUtil;
......
......@@ -20,7 +20,7 @@ package org.apache.shardingsphere.shardingjdbc.orchestration.internal.yaml;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.orchestration.center.yaml.config.YamlCenterRepositoryConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import java.util.Map;
......
......@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shardingjdbc.orchestration.internal.yaml.constructor;
import org.apache.shardingsphere.sharding.core.yaml.config.sharding.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.strategy.YamlNoneShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.constructor.construct.YamlNoneShardingStrategyConfigurationConstruct;
import org.apache.shardingsphere.shardingjdbc.orchestration.internal.yaml.YamlOrchestrationRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.constructor.AbstractTypeConstructor;
......
......@@ -36,7 +36,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms:
name: db_ms
......
......@@ -36,7 +36,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms:
name: db_ms
......
......@@ -30,7 +30,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db${0..1}.t_config
......
......@@ -30,7 +30,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db${0..1}.t_config
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db${0..1}.t_config
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db${0..1}.t_config
......
......@@ -42,7 +42,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db_ms_${0..1}.t_config
......@@ -87,7 +87,7 @@ rules:
shardingAlgorithm:
type: COMPLEX_TEST
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms_0:
masterDataSourceName: db0_master
......
......@@ -42,7 +42,7 @@ dataSources:
maxTotal: 100
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db_ms_${0..1}.t_config
......@@ -87,7 +87,7 @@ rules:
shardingAlgorithm:
type: COMPLEX_TEST
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms_0:
masterDataSourceName: db0_master
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db_ms_${0..1}.t_config
......@@ -61,7 +61,7 @@ rules:
shardingAlgorithm:
type: COMPLEX_TEST
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms_0:
masterDataSourceName: db0_master
......
......@@ -16,7 +16,7 @@
#
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
config:
actualDataNodes: db_ms_${0..1}.t_config
......@@ -61,7 +61,7 @@ rules:
shardingAlgorithm:
type: COMPLEX_TEST
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
db_ms_0:
masterDataSourceName: db0_master
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
name: ms_ds
masterDataSourceName: ds_m
slaveDataSourceNames:
......
......@@ -35,7 +35,7 @@ rules:
props:
aes.key.value: 123456
- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration
- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration
column: shadows
dataSource: !!org.apache.commons.dbcp2.BasicDataSource
driverClassName: org.h2.Driver
......
......@@ -28,7 +28,7 @@ dataSources:
password:
rules:
- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration
- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration
tables:
t_order:
actualDataNodes: ds_ms.t_order_${0..1}
......@@ -77,7 +77,7 @@ rules:
defaultTableStrategy:
none:
- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration
- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration
dataSources:
ds_ms:
masterDataSourceName: ds_m
......
......@@ -29,11 +29,11 @@ import org.apache.shardingsphere.orchestration.core.configuration.YamlDataSource
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.underlying.common.auth.Authentication;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.auth.yaml.config.YamlAuthenticationConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.underlying.common.auth.yaml.swapper.AuthenticationYamlSwapper;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.config.DataSourceConfiguration;
import org.apache.shardingsphere.underlying.common.config.RuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine;
......@@ -187,7 +187,7 @@ public final class ConfigCenter {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n");
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n");
}
/**
......@@ -205,7 +205,7 @@ public final class ConfigCenter {
* @return is shadow rule or not
*/
public boolean isShadowRule(final String shardingSchemaName) {
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration\n");
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration\n");
}
/**
......
......@@ -38,9 +38,9 @@ import org.apache.shardingsphere.orchestration.core.configcenter.ConfigCenter;
import org.apache.shardingsphere.orchestration.core.configcenter.ConfigCenterNode;
import org.apache.shardingsphere.orchestration.core.configuration.DataSourceConfigurationYamlSwapper;
import org.apache.shardingsphere.orchestration.core.configuration.YamlDataSourceConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.config.RuleConfiguration;
import org.apache.shardingsphere.underlying.common.yaml.engine.YamlEngine;
......
......@@ -26,11 +26,11 @@ import org.apache.shardingsphere.orchestration.core.configuration.YamlDataSource
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.underlying.common.auth.Authentication;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.auth.yaml.config.YamlAuthenticationConfiguration;
import org.apache.shardingsphere.sharding.core.yaml.constructor.YamlRootRuleConfigurationsConstructor;
import org.apache.shardingsphere.underlying.common.auth.yaml.swapper.AuthenticationYamlSwapper;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.config.DataSourceConfiguration;
import org.apache.shardingsphere.underlying.common.config.RuleConfiguration;
import org.apache.shardingsphere.underlying.common.config.properties.ConfigurationPropertyKey;
......@@ -92,7 +92,7 @@ public final class ConfigCenterTest {
private static final String SHARDING_RULE_YAML = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n"
+ " tables:\n"
+ " t_order:\n"
+ " actualDataNodes: ds_${0..1}.t_order_${0..1}\n"
......@@ -107,7 +107,7 @@ public final class ConfigCenterTest {
private static final String MASTER_SLAVE_RULE_YAML = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration\n"
+ " dataSources:\n"
+ " ms_ds:\n"
+ " masterDataSourceName: master_ds\n"
......@@ -133,7 +133,7 @@ public final class ConfigCenterTest {
private static final String SHADOW_RULE_YAML = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.shadow.YamlShadowRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.shadow.core.yaml.config.YamlShadowRuleConfiguration\n"
+ " column: shadow\n"
+ " shadowMappings:\n"
+ " ds: shadow_ds\n";
......@@ -151,7 +151,7 @@ public final class ConfigCenterTest {
private static final String SHARDING_RULE_YAML_DEFAULT_TABLE_STRATEGY_NONE = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n"
+ " defaultTableStrategy:\n"
+ " none: ''\n";
......
......@@ -62,7 +62,7 @@ public final class SchemaChangedListenerTest {
private static final String SHARDING_RULE_YAML = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.sharding.YamlShardingRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.YamlShardingRuleConfiguration\n"
+ " tables:\n"
+ " t_order:\n"
+ " logicTable: t_order\n"
......@@ -77,7 +77,7 @@ public final class SchemaChangedListenerTest {
private static final String MASTER_SLAVE_RULE_YAML = ""
+ "rules:\n"
+ "- !!org.apache.shardingsphere.sharding.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration\n"
+ "- !!org.apache.shardingsphere.masterslave.core.yaml.config.YamlMasterSlaveRuleConfiguration\n"
+ " dataSources:\n"
+ " ms_ds:\n"
+ " masterDataSourceName: master_ds\n"
......
......@@ -29,8 +29,8 @@ import org.apache.shardingsphere.orchestration.center.yaml.config.YamlOrchestrat
import org.apache.shardingsphere.orchestration.center.yaml.swapper.OrchestrationConfigurationYamlSwapper;
import org.apache.shardingsphere.orchestration.core.facade.ShardingOrchestrationFacade;
import org.apache.shardingsphere.sharding.core.log.ConfigurationLogger;
import org.apache.shardingsphere.sharding.core.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.sharding.core.yaml.swapper.root.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.underlying.common.yaml.config.YamlRootRuleConfigurations;
import org.apache.shardingsphere.underlying.common.yaml.swapper.RuleRootConfigurationsYamlSwapper;
import org.apache.shardingsphere.shardingproxy.backend.schema.ShardingSphereSchemas;
import org.apache.shardingsphere.shardingproxy.config.ShardingConfiguration;
import org.apache.shardingsphere.shardingproxy.config.ShardingConfigurationLoader;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册