Skip to content

Commit

Permalink
fix issue for yaml cannot convert
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 15, 2018
1 parent 8e23d15 commit 512f7f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@

import io.shardingsphere.core.yaml.masterslave.YamlMasterSlaveRuleConfiguration;
import io.shardingsphere.core.yaml.sharding.YamlShardingRuleConfiguration;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* schema sharding rule.
*
* @author panjuan
*/
@RequiredArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public final class ProxySchemaRule {

private final YamlShardingRuleConfiguration shardingRule;

private final YamlMasterSlaveRuleConfiguration masterSlaveRule;
private YamlShardingRuleConfiguration shardingRule;

private YamlMasterSlaveRuleConfiguration masterSlaveRule;
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,12 @@ public Properties loadMasterSlaveProperties() {
*/
public Map<String, ProxySchemaRule> loadProxyConfiguration() {
try {
Map<String, ProxySchemaRule> schemaShardingRuleMap = ProxyConfigurationConverter
.proxyRuleConfigFromYaml(regCenter.getDirectly(configNode.getFullPath(ConfigurationNode.PROXY_RULE_NODE_PATH)));
Preconditions.checkState(null != schemaShardingRuleMap && !schemaShardingRuleMap.isEmpty(), "No available schema sharding rule configuration to load.");
for (Entry<String, ProxySchemaRule> entry : schemaShardingRuleMap.entrySet()) {
Preconditions.checkState(null != entry.getValue().getShardingRule() || null != entry.getValue().getMasterSlaveRule(),
"Sharding rule or Master slave rule can not be both null.");
Map<String, ProxySchemaRule> result = ProxyConfigurationConverter.proxyRuleConfigFromYaml(regCenter.getDirectly(configNode.getFullPath(ConfigurationNode.PROXY_RULE_NODE_PATH)));
Preconditions.checkState(null != result && !result.isEmpty(), "No available schema sharding rule configuration to load.");
for (Entry<String, ProxySchemaRule> entry : result.entrySet()) {
Preconditions.checkState(null != entry.getValue().getShardingRule() || null != entry.getValue().getMasterSlaveRule(), "Sharding rule or Master slave rule can not be both null.");
}
return schemaShardingRuleMap;
return result;
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
Expand Down
1 change: 0 additions & 1 deletion sharding-proxy/src/main/resources/conf/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#orchestration:
# name: orchestration_ds
# type: SHARDING
# overwrite: true
# zookeeper:
# namespace: orchestration
Expand Down

0 comments on commit 512f7f1

Please sign in to comment.