未验证 提交 b064a4c8 编写于 作者: H Haoran Meng 提交者: GitHub

Remove '\n' when judging schema (#5664)

* fixes test errors of SchemaChangedListener

* Remove '\n' when judging schema
上级 9584f8ca
......@@ -188,7 +188,7 @@ public final class ConfigCenter {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !SHARDING\n");
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !SHARDING");
}
/**
......@@ -197,7 +197,7 @@ public final class ConfigCenter {
* @return is encrypt rule or not
*/
public boolean isEncryptRule(final String shardingSchemaName) {
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !ENCRYPT\n");
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !ENCRYPT");
}
/**
......@@ -206,7 +206,7 @@ public final class ConfigCenter {
* @return is shadow rule or not
*/
public boolean isShadowRule(final String shardingSchemaName) {
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !SHADOW\n");
return repository.get(node.getRulePath(shardingSchemaName)).contains("- !SHADOW");
}
/**
......
......@@ -128,11 +128,11 @@ public final class SchemaChangedListener extends PostShardingCenterRepositoryEve
}
private boolean isShardingRule(final DataChangedEvent event) {
return event.getValue().contains("tables:\n") || event.getValue().contains("tables:\r\n");
return event.getValue().contains("- !SHARDING");
}
private boolean isEncryptRule(final DataChangedEvent event) {
return event.getValue().contains("encryptors:\n");
return event.getValue().contains("- !ENCRYPT");
}
private RuleConfigurationsChangedEvent createRuleConfigurationsChangedEvent(final String shardingSchemaName, final String ruleValue) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册