You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by to...@apache.org on 2022/01/28 02:36:10 UTC
[shardingsphere] branch master updated: Assert Readwrite-Splitting rule configuration in YamlProxyConfigurati… (#15116)
This is an automated email from the ASF dual-hosted git repository.
totalo 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 7bcbd4a Assert Readwrite-Splitting rule configuration in YamlProxyConfigurati… (#15116)
7bcbd4a is described below
commit 7bcbd4ae3bc271d8971df5d8ab1cc64c9f337b01
Author: liguoping <xd...@163.com>
AuthorDate: Fri Jan 28 10:35:18 2022 +0800
Assert Readwrite-Splitting rule configuration in YamlProxyConfigurati… (#15116)
* Assert Readwrite-Splitting rule configuration in YamlProxyConfigurationSwapperTest
* remove unnecessary instanceof assert
---
.../yaml/swapper/YamlProxyConfigurationSwapperTest.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
index f64489b..b150810 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.config.yaml.swapper;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.schema.impl.DataSourceGeneratedSchemaConfiguration;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
@@ -28,6 +29,7 @@ import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
import org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader;
import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
+import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
import org.junit.Test;
import java.io.IOException;
@@ -77,7 +79,18 @@ public final class YamlProxyConfigurationSwapperTest {
}
private void assertReadwriteSplittingRuleConfiguration(final ReadwriteSplittingRuleConfiguration actual) {
- // TODO complete assert
+ assertThat(actual.getDataSources().size(), is(1));
+ ReadwriteSplittingDataSourceRuleConfiguration dataSource = actual.getDataSources().iterator().next();
+ assertThat(dataSource.getName(), is("readwrite_ds"));
+ assertThat(dataSource.getType(), is("Static"));
+ assertThat(dataSource.getProps().size(), is(2));
+ assertThat(dataSource.getProps().getProperty("read-data-source-names"), is("foo_db"));
+ assertThat(dataSource.getProps().getProperty("write-data-source-name"), is("foo_db"));
+ assertThat(actual.getLoadBalancers().size(), is(1));
+ ShardingSphereAlgorithmConfiguration loadBalancer = actual.getLoadBalancers().get("round_robin");
+ assertThat(loadBalancer.getProps().size(), is(1));
+ assertThat(loadBalancer.getProps().getProperty("foo"), is("foo_value"));
+ assertThat(loadBalancer.getType(), is("ROUND_ROBIN"));
}
private void assertAuthority(final ProxyConfiguration proxyConfig) {