You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/06 11:14:53 UTC

[GitHub] [shardingsphere] harvies opened a new pull request #6672: Test for issues 6561

harvies opened a new pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672


   Fixes #6561 .
   
   Changes proposed in this pull request:
   -
   -
   -
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#discussion_r467452341



##########
File path: shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
##########
@@ -0,0 +1,302 @@
+/*
+ * 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.proxy.config.yaml.swapper;
+
+import org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.config.HeartbeatConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlHeartbeatConfiguration;
+import org.apache.shardingsphere.infra.auth.Authentication;
+import org.apache.shardingsphere.infra.auth.ProxyUser;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlProxyUserConfiguration;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.kernel.context.schema.DataSourceParameter;
+import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
+import org.apache.shardingsphere.metrics.configuration.yaml.YamlMetricsConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationConfiguration;
+import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ArrayList;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class YamlProxyConfigurationSwapperTest {
+
+    @Test
+    public void assertSwap() {
+        YamlProxyConfiguration yamlProxyConfiguration = getYamlProxyConfiguration();
+        ProxyConfiguration proxyConfiguration = new YamlProxyConfigurationSwapper().swap(yamlProxyConfiguration);
+        assertAuthentication(proxyConfiguration);
+        assertClusterConfiguration(proxyConfiguration);
+        assertMetricsConfiguration(proxyConfiguration);
+        assertProxyConfigurationProps(proxyConfiguration);
+        assertSchemaDataSources(proxyConfiguration);
+        assertSchemaRules(proxyConfiguration);
+    }
+
+    private void assertSchemaDataSources(ProxyConfiguration proxyConfiguration) {
+        Map<String, Map<String, DataSourceParameter>> schemaDataSources = proxyConfiguration.getSchemaDataSources();
+        assertNotNull(schemaDataSources);
+        assertThat(1, is(schemaDataSources.size()));
+        assertTrue(schemaDataSources.containsKey("yamlProxyRule1"));
+        Map<String, DataSourceParameter> dataSourceParameterMap = schemaDataSources.get("yamlProxyRule1");
+        DataSourceParameter dataSourceParameter = dataSourceParameterMap.get("ds1");
+        assertNotNull(dataSourceParameter);
+        assertThat("url1", is(dataSourceParameter.getUrl()));
+        assertThat("username1", is(dataSourceParameter.getUsername()));
+        assertThat("password1", is(dataSourceParameter.getPassword()));
+        assertThat(1L, is(dataSourceParameter.getConnectionTimeoutMilliseconds()));
+        assertThat(2L, is(dataSourceParameter.getIdleTimeoutMilliseconds()));
+        assertThat(3L, is(dataSourceParameter.getMaxLifetimeMilliseconds()));
+        assertThat(4, is(dataSourceParameter.getMaxPoolSize()));
+        assertThat(5, is(dataSourceParameter.getMinPoolSize()));
+        assertThat(6L, is(dataSourceParameter.getMaintenanceIntervalMilliseconds()));

Review comment:
       The sequence of assertion's actual value and expected value are wrong.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#discussion_r467464495



##########
File path: shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
##########
@@ -0,0 +1,302 @@
+/*
+ * 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.proxy.config.yaml.swapper;
+
+import org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.config.HeartbeatConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlHeartbeatConfiguration;
+import org.apache.shardingsphere.infra.auth.Authentication;
+import org.apache.shardingsphere.infra.auth.ProxyUser;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlProxyUserConfiguration;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.kernel.context.schema.DataSourceParameter;
+import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
+import org.apache.shardingsphere.metrics.configuration.yaml.YamlMetricsConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationConfiguration;
+import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ArrayList;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class YamlProxyConfigurationSwapperTest {
+
+    @Test
+    public void assertSwap() {
+        YamlProxyConfiguration yamlProxyConfiguration = getYamlProxyConfiguration();
+        ProxyConfiguration proxyConfiguration = new YamlProxyConfigurationSwapper().swap(yamlProxyConfiguration);
+        assertAuthentication(proxyConfiguration);
+        assertClusterConfiguration(proxyConfiguration);
+        assertMetricsConfiguration(proxyConfiguration);
+        assertProxyConfigurationProps(proxyConfiguration);
+        assertSchemaDataSources(proxyConfiguration);
+        assertSchemaRules(proxyConfiguration);
+    }
+
+    private void assertSchemaDataSources(ProxyConfiguration proxyConfiguration) {
+        Map<String, Map<String, DataSourceParameter>> schemaDataSources = proxyConfiguration.getSchemaDataSources();
+        assertNotNull(schemaDataSources);
+        assertThat(schemaDataSources.size(), is(1));
+        assertTrue(schemaDataSources.containsKey("yamlProxyRule1"));
+        Map<String, DataSourceParameter> dataSourceParameterMap = schemaDataSources.get("yamlProxyRule1");
+        DataSourceParameter dataSourceParameter = dataSourceParameterMap.get("ds1");
+        assertNotNull(dataSourceParameter);
+        assertThat(dataSourceParameter.getUrl(), is("url1"));
+        assertThat(dataSourceParameter.getUsername(), is("username1"));
+        assertThat(dataSourceParameter.getPassword(), is("password1"));
+        assertThat(dataSourceParameter.getConnectionTimeoutMilliseconds(), is(1L));
+        assertThat(dataSourceParameter.getIdleTimeoutMilliseconds(), is(2L));
+        assertThat(dataSourceParameter.getMaxLifetimeMilliseconds(), is(3L));
+        assertThat(dataSourceParameter.getMaxPoolSize(), is(4));
+        assertThat(dataSourceParameter.getMinPoolSize(), is(5));
+        assertThat(dataSourceParameter.getMaintenanceIntervalMilliseconds(), is(6L));
+        assertTrue(dataSourceParameter.isReadOnly());
+    }
+
+    private void assertSchemaRules(ProxyConfiguration proxyConfiguration) {
+        Map<String, Collection<RuleConfiguration>> schemaRules = proxyConfiguration.getSchemaRules();
+        assertNotNull(schemaRules);
+        assertThat(schemaRules.size(), is(1));
+        Collection<RuleConfiguration> ruleConfigurationCollection = schemaRules.get("yamlProxyRule1");
+        assertNotNull(ruleConfigurationCollection);
+        assertThat(ruleConfigurationCollection.size(), is(1));
+        RuleConfiguration ruleConfiguration = ruleConfigurationCollection.iterator().next();
+        assertNotNull(ruleConfiguration);
+        assertTrue(ruleConfiguration instanceof MasterSlaveRuleConfiguration);
+    }
+
+    private void assertProxyConfigurationProps(ProxyConfiguration proxyConfiguration) {
+        Properties proxyConfigurationProps = proxyConfiguration.getProps();
+        assertNotNull(proxyConfigurationProps);
+        assertThat(proxyConfigurationProps.size(), is(1));
+        assertThat(proxyConfigurationProps.getProperty("key4"), is("value4"));
+    }
+
+    private void assertMetricsConfiguration(ProxyConfiguration proxyConfiguration) {
+        MetricsConfiguration metricsConfiguration = proxyConfiguration.getMetrics();
+        assertNotNull(metricsConfiguration);
+        assertThat(metricsConfiguration.getMetricsName(), is("name1"));
+        assertThat(metricsConfiguration.getHost(), is("host1"));
+        assertThat(metricsConfiguration.getPort(), is(111));
+        assertThat(metricsConfiguration.getAsync(), is(true));
+        assertThat(metricsConfiguration.getEnable(), is(true));
+        assertThat(4, is(metricsConfiguration.getThreadCount()));

Review comment:
       The actual value and expected value's sequence is wrong




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] harvies commented on a change in pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
harvies commented on a change in pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#discussion_r466818567



##########
File path: shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
##########
@@ -0,0 +1,256 @@
+/*
+ * 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.proxy.config.yaml.swapper;
+
+import org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.config.HeartbeatConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlHeartbeatConfiguration;
+import org.apache.shardingsphere.infra.auth.Authentication;
+import org.apache.shardingsphere.infra.auth.ProxyUser;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlProxyUserConfiguration;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.kernel.context.schema.DataSourceParameter;
+import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
+import org.apache.shardingsphere.metrics.configuration.yaml.YamlMetricsConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationConfiguration;
+import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.*;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class YamlProxyConfigurationSwapperTest {
+
+    @Test
+    public void assertSwap() {
+
+        YamlProxyConfiguration yamlProxyConfiguration = mock(YamlProxyConfiguration.class);
+
+        //serverConfiguration
+        YamlProxyServerConfiguration yamlProxyServerConfiguration = mock(YamlProxyServerConfiguration.class);
+        when(yamlProxyConfiguration.getServerConfiguration()).thenReturn(yamlProxyServerConfiguration);
+
+        //prepare for authentication
+        YamlAuthenticationConfiguration yamlAuthenticationConfiguration = mock(YamlAuthenticationConfiguration.class);
+        Map<String, YamlProxyUserConfiguration> yamlProxyUserConfigurationMap = new HashMap<>();
+        YamlProxyUserConfiguration yamlProxyUserConfiguration = mock(YamlProxyUserConfiguration.class);
+        when(yamlProxyUserConfiguration.getPassword()).thenReturn("pass");
+        when(yamlProxyUserConfiguration.getAuthorizedSchemas()).thenReturn("db1");
+        yamlProxyUserConfigurationMap.put("user1", yamlProxyUserConfiguration);
+        when(yamlAuthenticationConfiguration.getUsers()).thenReturn(yamlProxyUserConfigurationMap);
+        when(yamlProxyServerConfiguration.getAuthentication()).thenReturn(yamlAuthenticationConfiguration);
+
+
+        //prepare for orchestration
+        YamlOrchestrationConfiguration yamlOrchestrationConfiguration = mock(YamlOrchestrationConfiguration.class);
+        when(yamlProxyServerConfiguration.getOrchestration()).thenReturn(yamlOrchestrationConfiguration);
+        when(yamlOrchestrationConfiguration.getNamespace()).thenReturn("test1");
+
+        //registryCenter
+        YamlOrchestrationCenterConfiguration registryCenterConfiguration = mock(YamlOrchestrationCenterConfiguration.class);
+        when(yamlOrchestrationConfiguration.getRegistryCenter()).thenReturn(registryCenterConfiguration);
+        when(registryCenterConfiguration.getType()).thenReturn("typeOne");
+        when(registryCenterConfiguration.getServerLists()).thenReturn("serverLists1");
+        Properties registryCenterProperties = new Properties();
+        registryCenterProperties.put("key1", "value1");
+        when(registryCenterConfiguration.getProps()).thenReturn(registryCenterProperties);
+        when(yamlOrchestrationConfiguration.getRegistryCenter()).thenReturn(registryCenterConfiguration);
+
+        //additionalConfigCenter
+        YamlOrchestrationCenterConfiguration additionalConfigCenterConfiguration = mock(YamlOrchestrationCenterConfiguration.class);
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+        when(additionalConfigCenterConfiguration.getType()).thenReturn("typeTwo");
+        when(additionalConfigCenterConfiguration.getServerLists()).thenReturn("serverLists2");
+        Properties additionalConfigCenterProperties = new Properties();
+        additionalConfigCenterProperties.put("key2", "value2");
+        when(additionalConfigCenterConfiguration.getProps()).thenReturn(additionalConfigCenterProperties);
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+        when(yamlOrchestrationConfiguration.isOverwrite()).thenReturn(true);
+
+
+        //prepare for cluster
+        YamlClusterConfiguration yamlClusterConfiguration = mock(YamlClusterConfiguration.class);
+        YamlHeartbeatConfiguration yamlHeartbeatConfiguration = mock(YamlHeartbeatConfiguration.class);
+        when(yamlClusterConfiguration.getHeartbeat()).thenReturn(yamlHeartbeatConfiguration);
+        when(yamlHeartbeatConfiguration.getSql()).thenReturn("select 1;");
+        when(yamlHeartbeatConfiguration.getInterval()).thenReturn(1);
+        when(yamlHeartbeatConfiguration.isRetryEnable()).thenReturn(true);
+        when(yamlHeartbeatConfiguration.getRetryMaximum()).thenReturn(3);
+        when(yamlHeartbeatConfiguration.getRetryInterval()).thenReturn(2);
+        when(yamlHeartbeatConfiguration.getThreadCount()).thenReturn(4);
+        when(yamlProxyServerConfiguration.getCluster()).thenReturn(yamlClusterConfiguration);
+
+        //prepare for metrics
+        YamlMetricsConfiguration yamlMetricsConfiguration = mock(YamlMetricsConfiguration.class);
+        when(yamlProxyServerConfiguration.getMetrics()).thenReturn(yamlMetricsConfiguration);
+        when(yamlMetricsConfiguration.getName()).thenReturn("name1");
+        when(yamlMetricsConfiguration.getHost()).thenReturn("host1");
+        when(yamlMetricsConfiguration.getPort()).thenReturn(111);
+        when(yamlMetricsConfiguration.getAsync()).thenReturn(true);
+        when(yamlMetricsConfiguration.getEnable()).thenReturn(true);
+        when(yamlMetricsConfiguration.getThreadCount()).thenReturn(4);
+        Properties yamlMetricsProperties = new Properties();
+        yamlMetricsProperties.put("key3", "value3");
+        when(yamlMetricsConfiguration.getProps()).thenReturn(yamlMetricsProperties);
+
+        //prepare for props
+        Properties properties = new Properties();
+        properties.put("key4", "value4");
+        when(yamlProxyServerConfiguration.getProps()).thenReturn(properties);
+
+
+        //ruleConfigurations
+        Map<String, YamlProxyRuleConfiguration> yamlProxyRuleConfigurationMap = new HashMap<>();
+        when(yamlProxyConfiguration.getRuleConfigurations()).thenReturn(yamlProxyRuleConfigurationMap);
+
+        //prepare  for ruleConfigurations
+        YamlProxyRuleConfiguration yamlProxyRuleConfiguration = mock(YamlProxyRuleConfiguration.class);
+        yamlProxyRuleConfigurationMap.put("yamlProxyRule1", yamlProxyRuleConfiguration);
+
+        //schemaName
+        when(yamlProxyRuleConfiguration.getSchemaName()).thenReturn("ruleConfigSchema1");
+
+        //dataSourceCommon
+        Map<String, Object> dataSourceCommon = new HashMap<>();
+        when(yamlProxyRuleConfiguration.getDataSourceCommon()).thenReturn(dataSourceCommon);
+
+        //dataSource
+        YamlDataSourceParameter yamlDataSourceParameter = mock(YamlDataSourceParameter.class);
+        when(yamlProxyRuleConfiguration.getDataSource()).thenReturn(yamlDataSourceParameter);
+        when(yamlDataSourceParameter.getUrl()).thenReturn("url1");
+        when(yamlDataSourceParameter.getUsername()).thenReturn("username1");
+        when(yamlDataSourceParameter.getPassword()).thenReturn("password1");
+        when(yamlDataSourceParameter.getConnectionTimeoutMilliseconds()).thenReturn(1L);
+        when(yamlDataSourceParameter.getIdleTimeoutMilliseconds()).thenReturn(2L);
+        when(yamlDataSourceParameter.getMaxLifetimeMilliseconds()).thenReturn(3L);
+        when(yamlDataSourceParameter.getMaxPoolSize()).thenReturn(4);
+        when(yamlDataSourceParameter.getMinPoolSize()).thenReturn(5);
+        when(yamlDataSourceParameter.getMaintenanceIntervalMilliseconds()).thenReturn(6L);
+        when(yamlDataSourceParameter.isReadOnly()).thenReturn(true);
+
+        //dataSources
+        Map<String, YamlDataSourceParameter> dataSources = new HashMap<>();
+        dataSources.put("ds1", yamlDataSourceParameter);
+        when(yamlProxyRuleConfiguration.getDataSources()).thenReturn(dataSources);
+
+        //rules
+        Collection<YamlRuleConfiguration> rules = new ArrayList<>();
+        YamlRuleConfiguration testRuleConfiguration = new YamlMasterSlaveRuleConfiguration();
+        rules.add(testRuleConfiguration);
+        when(yamlProxyRuleConfiguration.getRules()).thenReturn(rules);
+
+        //swap
+        ProxyConfiguration proxyConfiguration = new YamlProxyConfigurationSwapper().swap(yamlProxyConfiguration);
+
+        //test for authentication
+        Authentication authentication = proxyConfiguration.getAuthentication();
+        Assert.assertNotNull(authentication);
+        Map<String, ProxyUser> proxyUserMap = authentication.getUsers();
+        Assert.assertEquals(1, proxyUserMap.size());
+        ProxyUser proxyUser = proxyUserMap.get("user1");
+        Assert.assertNotNull(proxyUser);
+        Assert.assertEquals("pass", proxyUser.getPassword());
+        Collection<String> authorizedSchemas = proxyUser.getAuthorizedSchemas();
+        Assert.assertNotNull(authentication);
+        Assert.assertEquals(1, authorizedSchemas.size());
+        Assert.assertTrue(authorizedSchemas.contains("db1"));
+
+
+        //test for orchestration
+
+
+        //test for cluster
+        ClusterConfiguration clusterConfiguration = proxyConfiguration.getCluster();
+        Assert.assertNotNull(clusterConfiguration);
+        HeartbeatConfiguration heartbeatConfiguration = clusterConfiguration.getHeartbeat();
+        Assert.assertNotNull(heartbeatConfiguration);
+        Assert.assertEquals("select 1;", heartbeatConfiguration.getSql());
+        Assert.assertEquals(1, heartbeatConfiguration.getInterval());
+        Assert.assertTrue(heartbeatConfiguration.isRetryEnable());
+        Assert.assertEquals(3, heartbeatConfiguration.getRetryMaximum());
+        Assert.assertEquals(2, heartbeatConfiguration.getRetryInterval());
+        Assert.assertEquals(4, heartbeatConfiguration.getThreadCount());
+
+        //test for metrics
+        MetricsConfiguration metricsConfiguration = proxyConfiguration.getMetrics();
+        Assert.assertNotNull(metricsConfiguration);
+        Assert.assertEquals("name1", metricsConfiguration.getMetricsName());
+        Assert.assertEquals("host1", metricsConfiguration.getHost());
+        Assert.assertEquals(111, metricsConfiguration.getPort());
+        Assert.assertEquals(true, metricsConfiguration.getAsync());
+        Assert.assertEquals(true, metricsConfiguration.getEnable());
+        Assert.assertEquals(4, metricsConfiguration.getThreadCount());
+        Properties metricsProperties = metricsConfiguration.getProps();
+        Assert.assertNotNull(metricsProperties);
+        Assert.assertEquals(1, metricsProperties.size());
+        Assert.assertEquals("value3", metricsProperties.getProperty("key3"));
+
+        //test for props
+        Properties proxyConfigurationProps = proxyConfiguration.getProps();
+        Assert.assertNotNull(proxyConfigurationProps);
+        Assert.assertEquals(1, proxyConfigurationProps.size());
+        Assert.assertEquals("value4", proxyConfigurationProps.getProperty("key4"));
+
+
+        Map<String, Map<String, DataSourceParameter>> schemaDataSources = proxyConfiguration.getSchemaDataSources();
+        Assert.assertNotNull(schemaDataSources);
+        Assert.assertEquals(1, schemaDataSources.size());
+        Assert.assertTrue(schemaDataSources.containsKey("yamlProxyRule1"));
+        Map<String, DataSourceParameter> dataSourceParameterMap = schemaDataSources.get("yamlProxyRule1");
+        Assert.assertTrue(dataSourceParameterMap.containsKey("ds1"));
+
+        DataSourceParameter dataSourceParameter = dataSourceParameterMap.get("ds1");
+        Assert.assertNotNull(dataSourceParameter);
+        Assert.assertEquals("url1", dataSourceParameter.getUrl());
+        Assert.assertEquals("username1", dataSourceParameter.getUsername());
+        Assert.assertEquals("password1", dataSourceParameter.getPassword());
+        Assert.assertEquals(1, dataSourceParameter.getConnectionTimeoutMilliseconds());
+        Assert.assertEquals(2, dataSourceParameter.getIdleTimeoutMilliseconds());
+        Assert.assertEquals(3, dataSourceParameter.getMaxLifetimeMilliseconds());
+        Assert.assertEquals(4, dataSourceParameter.getMaxPoolSize());
+        Assert.assertEquals(5, dataSourceParameter.getMinPoolSize());
+        Assert.assertEquals(6, dataSourceParameter.getMaintenanceIntervalMilliseconds());
+        Assert.assertTrue(dataSourceParameter.isReadOnly());
+
+        Map<String, Collection<RuleConfiguration>> schemaRules = proxyConfiguration.getSchemaRules();
+        Assert.assertNotNull(schemaRules);
+        Assert.assertEquals(1, schemaRules.size());
+        Collection<RuleConfiguration> ruleConfigurationCollection = schemaRules.get("yamlProxyRule1");
+        Assert.assertNotNull(ruleConfigurationCollection);
+        Assert.assertEquals(1, ruleConfigurationCollection.size());
+        RuleConfiguration ruleConfiguration = ruleConfigurationCollection.iterator().next();
+        Assert.assertNotNull(ruleConfiguration);
+        Assert.assertTrue(ruleConfiguration instanceof MasterSlaveRuleConfiguration);
+    }
+
+}

Review comment:
       Just formatted with checkstyle.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu merged pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] harvies commented on pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
harvies commented on pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#issuecomment-670846612


   > Some suggesstions:
   > 
   > 1. Please remove all commit and blank lines, use private method instead of it.
   > 2. Please use assertThat instead of assertEquals
   > 3. Please do not use Assert.xxx, use put Assert to static import
   
   ![image](https://user-images.githubusercontent.com/16585330/89706323-1e4eef00-d997-11ea-8930-6a3128f82d52.png)
   I resubmitted but encountered other errors. Can you help me fix it?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] taojintianxia commented on a change in pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
taojintianxia commented on a change in pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#discussion_r466772239



##########
File path: shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
##########
@@ -0,0 +1,256 @@
+/*
+ * 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.proxy.config.yaml.swapper;
+
+import org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.config.HeartbeatConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlClusterConfiguration;
+import org.apache.shardingsphere.cluster.configuration.yaml.YamlHeartbeatConfiguration;
+import org.apache.shardingsphere.infra.auth.Authentication;
+import org.apache.shardingsphere.infra.auth.ProxyUser;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
+import org.apache.shardingsphere.infra.auth.yaml.config.YamlProxyUserConfiguration;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
+import org.apache.shardingsphere.kernel.context.schema.DataSourceParameter;
+import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
+import org.apache.shardingsphere.metrics.configuration.yaml.YamlMetricsConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlOrchestrationConfiguration;
+import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
+import org.apache.shardingsphere.proxy.config.yaml.YamlProxyServerConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.*;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class YamlProxyConfigurationSwapperTest {
+
+    @Test
+    public void assertSwap() {
+
+        YamlProxyConfiguration yamlProxyConfiguration = mock(YamlProxyConfiguration.class);
+
+        //serverConfiguration
+        YamlProxyServerConfiguration yamlProxyServerConfiguration = mock(YamlProxyServerConfiguration.class);
+        when(yamlProxyConfiguration.getServerConfiguration()).thenReturn(yamlProxyServerConfiguration);
+
+        //prepare for authentication
+        YamlAuthenticationConfiguration yamlAuthenticationConfiguration = mock(YamlAuthenticationConfiguration.class);
+        Map<String, YamlProxyUserConfiguration> yamlProxyUserConfigurationMap = new HashMap<>();
+        YamlProxyUserConfiguration yamlProxyUserConfiguration = mock(YamlProxyUserConfiguration.class);
+        when(yamlProxyUserConfiguration.getPassword()).thenReturn("pass");
+        when(yamlProxyUserConfiguration.getAuthorizedSchemas()).thenReturn("db1");
+        yamlProxyUserConfigurationMap.put("user1", yamlProxyUserConfiguration);
+        when(yamlAuthenticationConfiguration.getUsers()).thenReturn(yamlProxyUserConfigurationMap);
+        when(yamlProxyServerConfiguration.getAuthentication()).thenReturn(yamlAuthenticationConfiguration);
+
+
+        //prepare for orchestration
+        YamlOrchestrationConfiguration yamlOrchestrationConfiguration = mock(YamlOrchestrationConfiguration.class);
+        when(yamlProxyServerConfiguration.getOrchestration()).thenReturn(yamlOrchestrationConfiguration);
+        when(yamlOrchestrationConfiguration.getNamespace()).thenReturn("test1");
+
+        //registryCenter
+        YamlOrchestrationCenterConfiguration registryCenterConfiguration = mock(YamlOrchestrationCenterConfiguration.class);
+        when(yamlOrchestrationConfiguration.getRegistryCenter()).thenReturn(registryCenterConfiguration);
+        when(registryCenterConfiguration.getType()).thenReturn("typeOne");
+        when(registryCenterConfiguration.getServerLists()).thenReturn("serverLists1");
+        Properties registryCenterProperties = new Properties();
+        registryCenterProperties.put("key1", "value1");
+        when(registryCenterConfiguration.getProps()).thenReturn(registryCenterProperties);
+        when(yamlOrchestrationConfiguration.getRegistryCenter()).thenReturn(registryCenterConfiguration);
+
+        //additionalConfigCenter
+        YamlOrchestrationCenterConfiguration additionalConfigCenterConfiguration = mock(YamlOrchestrationCenterConfiguration.class);
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+        when(additionalConfigCenterConfiguration.getType()).thenReturn("typeTwo");
+        when(additionalConfigCenterConfiguration.getServerLists()).thenReturn("serverLists2");
+        Properties additionalConfigCenterProperties = new Properties();
+        additionalConfigCenterProperties.put("key2", "value2");
+        when(additionalConfigCenterConfiguration.getProps()).thenReturn(additionalConfigCenterProperties);
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+
+        when(yamlOrchestrationConfiguration.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfiguration);
+        when(yamlOrchestrationConfiguration.isOverwrite()).thenReturn(true);
+
+
+        //prepare for cluster
+        YamlClusterConfiguration yamlClusterConfiguration = mock(YamlClusterConfiguration.class);
+        YamlHeartbeatConfiguration yamlHeartbeatConfiguration = mock(YamlHeartbeatConfiguration.class);
+        when(yamlClusterConfiguration.getHeartbeat()).thenReturn(yamlHeartbeatConfiguration);
+        when(yamlHeartbeatConfiguration.getSql()).thenReturn("select 1;");
+        when(yamlHeartbeatConfiguration.getInterval()).thenReturn(1);
+        when(yamlHeartbeatConfiguration.isRetryEnable()).thenReturn(true);
+        when(yamlHeartbeatConfiguration.getRetryMaximum()).thenReturn(3);
+        when(yamlHeartbeatConfiguration.getRetryInterval()).thenReturn(2);
+        when(yamlHeartbeatConfiguration.getThreadCount()).thenReturn(4);
+        when(yamlProxyServerConfiguration.getCluster()).thenReturn(yamlClusterConfiguration);
+
+        //prepare for metrics
+        YamlMetricsConfiguration yamlMetricsConfiguration = mock(YamlMetricsConfiguration.class);
+        when(yamlProxyServerConfiguration.getMetrics()).thenReturn(yamlMetricsConfiguration);
+        when(yamlMetricsConfiguration.getName()).thenReturn("name1");
+        when(yamlMetricsConfiguration.getHost()).thenReturn("host1");
+        when(yamlMetricsConfiguration.getPort()).thenReturn(111);
+        when(yamlMetricsConfiguration.getAsync()).thenReturn(true);
+        when(yamlMetricsConfiguration.getEnable()).thenReturn(true);
+        when(yamlMetricsConfiguration.getThreadCount()).thenReturn(4);
+        Properties yamlMetricsProperties = new Properties();
+        yamlMetricsProperties.put("key3", "value3");
+        when(yamlMetricsConfiguration.getProps()).thenReturn(yamlMetricsProperties);
+
+        //prepare for props
+        Properties properties = new Properties();
+        properties.put("key4", "value4");
+        when(yamlProxyServerConfiguration.getProps()).thenReturn(properties);
+
+
+        //ruleConfigurations
+        Map<String, YamlProxyRuleConfiguration> yamlProxyRuleConfigurationMap = new HashMap<>();
+        when(yamlProxyConfiguration.getRuleConfigurations()).thenReturn(yamlProxyRuleConfigurationMap);
+
+        //prepare  for ruleConfigurations
+        YamlProxyRuleConfiguration yamlProxyRuleConfiguration = mock(YamlProxyRuleConfiguration.class);
+        yamlProxyRuleConfigurationMap.put("yamlProxyRule1", yamlProxyRuleConfiguration);
+
+        //schemaName
+        when(yamlProxyRuleConfiguration.getSchemaName()).thenReturn("ruleConfigSchema1");
+
+        //dataSourceCommon
+        Map<String, Object> dataSourceCommon = new HashMap<>();
+        when(yamlProxyRuleConfiguration.getDataSourceCommon()).thenReturn(dataSourceCommon);
+
+        //dataSource
+        YamlDataSourceParameter yamlDataSourceParameter = mock(YamlDataSourceParameter.class);
+        when(yamlProxyRuleConfiguration.getDataSource()).thenReturn(yamlDataSourceParameter);
+        when(yamlDataSourceParameter.getUrl()).thenReturn("url1");
+        when(yamlDataSourceParameter.getUsername()).thenReturn("username1");
+        when(yamlDataSourceParameter.getPassword()).thenReturn("password1");
+        when(yamlDataSourceParameter.getConnectionTimeoutMilliseconds()).thenReturn(1L);
+        when(yamlDataSourceParameter.getIdleTimeoutMilliseconds()).thenReturn(2L);
+        when(yamlDataSourceParameter.getMaxLifetimeMilliseconds()).thenReturn(3L);
+        when(yamlDataSourceParameter.getMaxPoolSize()).thenReturn(4);
+        when(yamlDataSourceParameter.getMinPoolSize()).thenReturn(5);
+        when(yamlDataSourceParameter.getMaintenanceIntervalMilliseconds()).thenReturn(6L);
+        when(yamlDataSourceParameter.isReadOnly()).thenReturn(true);
+
+        //dataSources
+        Map<String, YamlDataSourceParameter> dataSources = new HashMap<>();
+        dataSources.put("ds1", yamlDataSourceParameter);
+        when(yamlProxyRuleConfiguration.getDataSources()).thenReturn(dataSources);
+
+        //rules
+        Collection<YamlRuleConfiguration> rules = new ArrayList<>();
+        YamlRuleConfiguration testRuleConfiguration = new YamlMasterSlaveRuleConfiguration();
+        rules.add(testRuleConfiguration);
+        when(yamlProxyRuleConfiguration.getRules()).thenReturn(rules);
+
+        //swap
+        ProxyConfiguration proxyConfiguration = new YamlProxyConfigurationSwapper().swap(yamlProxyConfiguration);
+
+        //test for authentication
+        Authentication authentication = proxyConfiguration.getAuthentication();
+        Assert.assertNotNull(authentication);
+        Map<String, ProxyUser> proxyUserMap = authentication.getUsers();
+        Assert.assertEquals(1, proxyUserMap.size());
+        ProxyUser proxyUser = proxyUserMap.get("user1");
+        Assert.assertNotNull(proxyUser);
+        Assert.assertEquals("pass", proxyUser.getPassword());
+        Collection<String> authorizedSchemas = proxyUser.getAuthorizedSchemas();
+        Assert.assertNotNull(authentication);
+        Assert.assertEquals(1, authorizedSchemas.size());
+        Assert.assertTrue(authorizedSchemas.contains("db1"));
+
+
+        //test for orchestration
+
+
+        //test for cluster
+        ClusterConfiguration clusterConfiguration = proxyConfiguration.getCluster();
+        Assert.assertNotNull(clusterConfiguration);
+        HeartbeatConfiguration heartbeatConfiguration = clusterConfiguration.getHeartbeat();
+        Assert.assertNotNull(heartbeatConfiguration);
+        Assert.assertEquals("select 1;", heartbeatConfiguration.getSql());
+        Assert.assertEquals(1, heartbeatConfiguration.getInterval());
+        Assert.assertTrue(heartbeatConfiguration.isRetryEnable());
+        Assert.assertEquals(3, heartbeatConfiguration.getRetryMaximum());
+        Assert.assertEquals(2, heartbeatConfiguration.getRetryInterval());
+        Assert.assertEquals(4, heartbeatConfiguration.getThreadCount());
+
+        //test for metrics
+        MetricsConfiguration metricsConfiguration = proxyConfiguration.getMetrics();
+        Assert.assertNotNull(metricsConfiguration);
+        Assert.assertEquals("name1", metricsConfiguration.getMetricsName());
+        Assert.assertEquals("host1", metricsConfiguration.getHost());
+        Assert.assertEquals(111, metricsConfiguration.getPort());
+        Assert.assertEquals(true, metricsConfiguration.getAsync());
+        Assert.assertEquals(true, metricsConfiguration.getEnable());
+        Assert.assertEquals(4, metricsConfiguration.getThreadCount());
+        Properties metricsProperties = metricsConfiguration.getProps();
+        Assert.assertNotNull(metricsProperties);
+        Assert.assertEquals(1, metricsProperties.size());
+        Assert.assertEquals("value3", metricsProperties.getProperty("key3"));
+
+        //test for props
+        Properties proxyConfigurationProps = proxyConfiguration.getProps();
+        Assert.assertNotNull(proxyConfigurationProps);
+        Assert.assertEquals(1, proxyConfigurationProps.size());
+        Assert.assertEquals("value4", proxyConfigurationProps.getProperty("key4"));
+
+
+        Map<String, Map<String, DataSourceParameter>> schemaDataSources = proxyConfiguration.getSchemaDataSources();
+        Assert.assertNotNull(schemaDataSources);
+        Assert.assertEquals(1, schemaDataSources.size());
+        Assert.assertTrue(schemaDataSources.containsKey("yamlProxyRule1"));
+        Map<String, DataSourceParameter> dataSourceParameterMap = schemaDataSources.get("yamlProxyRule1");
+        Assert.assertTrue(dataSourceParameterMap.containsKey("ds1"));
+
+        DataSourceParameter dataSourceParameter = dataSourceParameterMap.get("ds1");
+        Assert.assertNotNull(dataSourceParameter);
+        Assert.assertEquals("url1", dataSourceParameter.getUrl());
+        Assert.assertEquals("username1", dataSourceParameter.getUsername());
+        Assert.assertEquals("password1", dataSourceParameter.getPassword());
+        Assert.assertEquals(1, dataSourceParameter.getConnectionTimeoutMilliseconds());
+        Assert.assertEquals(2, dataSourceParameter.getIdleTimeoutMilliseconds());
+        Assert.assertEquals(3, dataSourceParameter.getMaxLifetimeMilliseconds());
+        Assert.assertEquals(4, dataSourceParameter.getMaxPoolSize());
+        Assert.assertEquals(5, dataSourceParameter.getMinPoolSize());
+        Assert.assertEquals(6, dataSourceParameter.getMaintenanceIntervalMilliseconds());
+        Assert.assertTrue(dataSourceParameter.isReadOnly());
+
+        Map<String, Collection<RuleConfiguration>> schemaRules = proxyConfiguration.getSchemaRules();
+        Assert.assertNotNull(schemaRules);
+        Assert.assertEquals(1, schemaRules.size());
+        Collection<RuleConfiguration> ruleConfigurationCollection = schemaRules.get("yamlProxyRule1");
+        Assert.assertNotNull(ruleConfigurationCollection);
+        Assert.assertEquals(1, ruleConfigurationCollection.size());
+        RuleConfiguration ruleConfiguration = ruleConfigurationCollection.iterator().next();
+        Assert.assertNotNull(ruleConfiguration);
+        Assert.assertTrue(ruleConfiguration instanceof MasterSlaveRuleConfiguration);
+    }
+
+}

Review comment:
       should add a new empty line at the end of the code for checkstyle




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls commented on pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#issuecomment-675308441


   ## Pull Request Test Coverage Report for [Build 13539](https://coveralls.io/builds/32607977)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.1%**) to **55.789%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32607977/badge)](https://coveralls.io/builds/32607977) |
   | :-- | --: |
   | Change from base [Build 13537](https://coveralls.io/builds/32606949): |  0.1% |
   | Covered Lines: | 12582 |
   | Relevant Lines: | 22553 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] harvies commented on pull request #6672: Test for issues 6561

Posted by GitBox <gi...@apache.org>.
harvies commented on pull request #6672:
URL: https://github.com/apache/shardingsphere/pull/6672#issuecomment-670937548


   ![image](https://user-images.githubusercontent.com/16585330/89713260-2e7fc200-d9c9-11ea-9e68-52667323624d.png)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org