diff --git a/.circleci/config.yml b/.circleci/config.yml index cb0469bce..8fbf11a23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,7 +24,7 @@ jobs: - ~/.m2 - run: name: "Running build" - command: ./mvnw -Pspring -Pdocs clean install cobertura:cobertura -U -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + command: ./mvnw -Pspring -Pdocs clean install -U -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - run: name: "Aggregate test results" when: always diff --git a/pom.xml b/pom.xml index 57652f348..cdcc2d3c7 100644 --- a/pom.xml +++ b/pom.xml @@ -81,8 +81,7 @@ 2.8.2 2.21.0 1.6 - 2.1.1 - 2.7 + 0.7.9 @@ -166,25 +165,10 @@ pom import - - net.sourceforge.cobertura - cobertura-runtime - ${cobertura.version} - provided - pom - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.apache.maven.plugins @@ -208,30 +192,25 @@ - org.codehaus.mojo - cobertura-maven-plugin - ${cobertura-maven-plugin.version} - - - org.ow2.asm - asm - 5.0.3 - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} - true - - html - xml - - - + target/coverage-reports/jacoco-unit.exec + target/coverage-reports/jacoco-unit.exec - package + jacoco-initialize + + prepare-agent + + + + jacoco-site + test - cobertura + report diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml index 9034205a6..291417429 100644 --- a/spring-cloud-alibaba-dependencies/pom.xml +++ b/spring-cloud-alibaba-dependencies/pom.xml @@ -453,26 +453,4 @@ - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - diff --git a/spring-cloud-alibaba-docs/pom.xml b/spring-cloud-alibaba-docs/pom.xml index cb7550912..87014d576 100644 --- a/spring-cloud-alibaba-docs/pom.xml +++ b/spring-cloud-alibaba-docs/pom.xml @@ -49,28 +49,5 @@ - - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - diff --git a/spring-cloud-alibaba-examples/acm-example/acm-local-example/pom.xml b/spring-cloud-alibaba-examples/acm-example/acm-local-example/pom.xml index c7847d510..250a60fb9 100644 --- a/spring-cloud-alibaba-examples/acm-example/acm-local-example/pom.xml +++ b/spring-cloud-alibaba-examples/acm-example/acm-local-example/pom.xml @@ -23,28 +23,11 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot spring-boot-maven-plugin - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/pom.xml b/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/pom.xml index 2e6ddcb8e..af0c708c7 100644 --- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/pom.xml +++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/pom.xml @@ -29,25 +29,4 @@ spring-boot-starter-actuator - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/pom.xml b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/pom.xml index 6289c404c..b66c22ff3 100644 --- a/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/pom.xml +++ b/spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/pom.xml @@ -25,25 +25,4 @@ spring-boot-starter-actuator - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/pom.xml b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/pom.xml index 67ce3b6be..fc8f4b67b 100644 --- a/spring-cloud-alibaba-examples/ans-example/ans-provider-example/pom.xml +++ b/spring-cloud-alibaba-examples/ans-example/ans-provider-example/pom.xml @@ -27,28 +27,11 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot spring-boot-maven-plugin - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/pom.xml index 8d964fb72..565a732df 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-config-example/pom.xml @@ -34,14 +34,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -55,15 +47,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/pom.xml index aabf1ec1f..6a3af32b3 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/pom.xml @@ -48,14 +48,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -69,15 +61,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/pom.xml index 52bac0cf0..60fd7050f 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/pom.xml @@ -33,14 +33,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -54,15 +46,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/pom.xml index bea5a0b07..843f6f4cd 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/pom.xml @@ -20,26 +20,4 @@ nacos-discovery-consumer-example nacos-discovery-provider-example - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/pom.xml index bac2b2784..6af752d72 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/pom.xml @@ -35,14 +35,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -56,15 +48,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/pom.xml index 8a121fa83..a4bf41d2f 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/pom.xml @@ -33,14 +33,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -54,15 +46,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/pom.xml b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/pom.xml index 9b7f638ec..c2aa58ed6 100644 --- a/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/pom.xml +++ b/spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/pom.xml @@ -20,26 +20,4 @@ nacos-gateway-discovery-example nacos-gateway-provider-example - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - diff --git a/spring-cloud-alibaba-examples/oss-example/pom.xml b/spring-cloud-alibaba-examples/oss-example/pom.xml index 75cbfd2fd..624b3e667 100644 --- a/spring-cloud-alibaba-examples/oss-example/pom.xml +++ b/spring-cloud-alibaba-examples/oss-example/pom.xml @@ -33,14 +33,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -54,15 +46,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/pom.xml b/spring-cloud-alibaba-examples/pom.xml index 6cd8e7311..31e8ca5eb 100644 --- a/spring-cloud-alibaba-examples/pom.xml +++ b/spring-cloud-alibaba-examples/pom.xml @@ -40,14 +40,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.apache.maven.plugins @@ -57,16 +49,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - diff --git a/spring-cloud-alibaba-examples/rocketmq-example/pom.xml b/spring-cloud-alibaba-examples/rocketmq-example/pom.xml index 12bfbb4ff..84ef50291 100644 --- a/spring-cloud-alibaba-examples/rocketmq-example/pom.xml +++ b/spring-cloud-alibaba-examples/rocketmq-example/pom.xml @@ -40,14 +40,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -61,15 +53,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/pom.xml b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/pom.xml index 7cb076a9b..57cb2df5e 100644 --- a/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/pom.xml +++ b/spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/pom.xml @@ -27,28 +27,11 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot spring-boot-maven-plugin - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - \ No newline at end of file diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/pom.xml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/pom.xml index 25e56597a..507e84984 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/pom.xml +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/pom.xml @@ -51,14 +51,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -72,15 +64,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/pom.xml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/pom.xml index d594344e7..5e0b8f4a3 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/pom.xml +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/pom.xml @@ -16,14 +16,6 @@ api for sentinel dubbo example - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.apache.maven.plugins @@ -33,15 +25,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/pom.xml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/pom.xml index f3bd3370c..f10efec51 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/pom.xml +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/pom.xml @@ -40,14 +40,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -61,15 +53,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/pom.xml b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/pom.xml index 6aff02b32..5fde98b0e 100644 --- a/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/pom.xml +++ b/spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/pom.xml @@ -39,14 +39,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -60,15 +52,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-examples/spring-cloud-bus-rocketmq-example/pom.xml b/spring-cloud-alibaba-examples/spring-cloud-bus-rocketmq-example/pom.xml index 6874be2d0..060bb5320 100644 --- a/spring-cloud-alibaba-examples/spring-cloud-bus-rocketmq-example/pom.xml +++ b/spring-cloud-alibaba-examples/spring-cloud-bus-rocketmq-example/pom.xml @@ -35,14 +35,6 @@ - - - - org.codehaus.mojo - cobertura-maven-plugin - - - org.springframework.boot @@ -56,15 +48,6 @@ true - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - diff --git a/spring-cloud-alibaba-nacos-discovery/pom.xml b/spring-cloud-alibaba-nacos-discovery/pom.xml index 87df397d0..fd2dbb803 100644 --- a/spring-cloud-alibaba-nacos-discovery/pom.xml +++ b/spring-cloud-alibaba-nacos-discovery/pom.xml @@ -82,28 +82,4 @@ - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - org/springframework/cloud/alibaba/nacos/**.*class - - - - - - - diff --git a/spring-cloud-alibaba-sentinel-datasource/src/test/java/org/springframework/cloud/alibaba/sentinel/datasource/DataSourcePropertiesConfigurationTests.java b/spring-cloud-alibaba-sentinel-datasource/src/test/java/org/springframework/cloud/alibaba/sentinel/datasource/DataSourcePropertiesConfigurationTests.java index 4845d4862..542622ece 100644 --- a/spring-cloud-alibaba-sentinel-datasource/src/test/java/org/springframework/cloud/alibaba/sentinel/datasource/DataSourcePropertiesConfigurationTests.java +++ b/spring-cloud-alibaba-sentinel-datasource/src/test/java/org/springframework/cloud/alibaba/sentinel/datasource/DataSourcePropertiesConfigurationTests.java @@ -1,230 +1,230 @@ -/* - * Copyright (C) 2018 the original author or authors. - * - * Licensed 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.springframework.cloud.alibaba.sentinel.datasource; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.Test; -import org.springframework.cloud.alibaba.sentinel.datasource.config.ApolloDataSourceProperties; -import org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration; -import org.springframework.cloud.alibaba.sentinel.datasource.config.FileDataSourceProperties; -import org.springframework.cloud.alibaba.sentinel.datasource.config.NacosDataSourceProperties; -import org.springframework.cloud.alibaba.sentinel.datasource.config.ZookeeperDataSourceProperties; - -/** - * @author Jim - */ -public class DataSourcePropertiesConfigurationTests { - - @Test - public void testFileAttr() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); - assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, - dataSourcePropertiesConfiguration.getValidField().size()); - assertNull("DataSourcePropertiesConfiguration valid properties was not null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - - FileDataSourceProperties fileDataSourceProperties = buildFileProperties(); - - dataSourcePropertiesConfiguration.setFile(fileDataSourceProperties); - - assertEquals( - "DataSourcePropertiesConfiguration valid field size was wrong after set file attribute", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration file properties was null after set file attribute", - dataSourcePropertiesConfiguration.getFile()); - assertNotNull( - "DataSourcePropertiesConfiguration valid properties was null after set file attribute", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testNacosAttr() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); - assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, - dataSourcePropertiesConfiguration.getValidField().size()); - assertNull("DataSourcePropertiesConfiguration valid properties was not null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - - NacosDataSourceProperties nacosDataSourceProperties = buildNacosProperties(); - - dataSourcePropertiesConfiguration.setNacos(nacosDataSourceProperties); - - assertEquals( - "DataSourcePropertiesConfiguration valid field size was wrong after set nacos attribute", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration nacos properties was null after set nacos attribute", - dataSourcePropertiesConfiguration.getNacos()); - assertNotNull( - "DataSourcePropertiesConfiguration valid properties was null after set nacos attribute", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testZKAttr() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); - assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, - dataSourcePropertiesConfiguration.getValidField().size()); - assertNull("DataSourcePropertiesConfiguration valid properties was not null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - - ZookeeperDataSourceProperties zookeeperDataSourceProperties = buildZKProperties(); - - dataSourcePropertiesConfiguration.setZk(zookeeperDataSourceProperties); - - assertEquals( - "DataSourcePropertiesConfiguration valid field size was wrong after set zk attribute", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration zk properties was null after set zk attribute", - dataSourcePropertiesConfiguration.getZk()); - assertNotNull( - "DataSourcePropertiesConfiguration valid properties was null after set zk attribute", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testApolloAttr() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); - assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, - dataSourcePropertiesConfiguration.getValidField().size()); - assertNull("DataSourcePropertiesConfiguration valid properties was not null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - - ApolloDataSourceProperties apolloDataSourceProperties = buildApolloProperties(); - - dataSourcePropertiesConfiguration.setApollo(apolloDataSourceProperties); - - assertEquals( - "DataSourcePropertiesConfiguration valid field size was wrong after set apollo attribute", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration apollo properties was null after set apollo attribute", - dataSourcePropertiesConfiguration.getApollo()); - assertNotNull( - "DataSourcePropertiesConfiguration valid properties was null after set apollo attribute", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testMultiAttr() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); - assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, - dataSourcePropertiesConfiguration.getValidField().size()); - assertNull("DataSourcePropertiesConfiguration valid properties was not null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - - FileDataSourceProperties fileDataSourceProperties = buildFileProperties(); - NacosDataSourceProperties nacosDataSourceProperties = buildNacosProperties(); - - dataSourcePropertiesConfiguration.setFile(fileDataSourceProperties); - dataSourcePropertiesConfiguration.setNacos(nacosDataSourceProperties); - - assertEquals( - "DataSourcePropertiesConfiguration valid field size was wrong after set file and nacos attribute", - 2, dataSourcePropertiesConfiguration.getValidField().size()); - assertNull( - "DataSourcePropertiesConfiguration valid properties was not null after set file and nacos attribute", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testFileConstructor() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( - buildFileProperties()); - assertEquals( - "DataSourcePropertiesConfiguration file constructor valid field size was wrong", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration file constructor valid properties was null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testNacosConstructor() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( - buildNacosProperties()); - assertEquals( - "DataSourcePropertiesConfiguration nacos constructor valid field size was wrong", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration nacos constructor valid properties was null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testApolloConstructor() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( - buildApolloProperties()); - assertEquals( - "DataSourcePropertiesConfiguration apollo constructor valid field size was wrong", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration apollo constructor valid properties was null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - @Test - public void testZKConstructor() { - DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( - buildZKProperties()); - assertEquals( - "DataSourcePropertiesConfiguration zk constructor valid field size was wrong", - 1, dataSourcePropertiesConfiguration.getValidField().size()); - assertNotNull( - "DataSourcePropertiesConfiguration zk constructor valid properties was null", - dataSourcePropertiesConfiguration.getValidDataSourceProperties()); - } - - private FileDataSourceProperties buildFileProperties() { - FileDataSourceProperties fileDataSourceProperties = new FileDataSourceProperties(); - - fileDataSourceProperties.setFile("/tmp/test.json"); - fileDataSourceProperties.setBufSize(1024); - fileDataSourceProperties.setRecommendRefreshMs(2000); - return fileDataSourceProperties; - } - - private NacosDataSourceProperties buildNacosProperties() { - NacosDataSourceProperties nacosDataSourceProperties = new NacosDataSourceProperties(); - nacosDataSourceProperties.setServerAddr("127.0.0.1:8848"); - nacosDataSourceProperties.setDataId("sentinel"); - nacosDataSourceProperties.setGroupId("custom-group"); - return nacosDataSourceProperties; - } - - private ApolloDataSourceProperties buildApolloProperties() { - ApolloDataSourceProperties apolloDataSourceProperties = new ApolloDataSourceProperties(); - apolloDataSourceProperties.setFlowRulesKey("test-key"); - apolloDataSourceProperties.setDefaultFlowRuleValue("dft-val"); - apolloDataSourceProperties.setNamespaceName("namespace"); - return apolloDataSourceProperties; - } - - private ZookeeperDataSourceProperties buildZKProperties() { - ZookeeperDataSourceProperties zookeeperDataSourceProperties = new ZookeeperDataSourceProperties(); - - zookeeperDataSourceProperties.setServerAddr("localhost:2181"); - zookeeperDataSourceProperties.setPath("/path"); - return zookeeperDataSourceProperties; - } - -} +///* +// * Copyright (C) 2018 the original author or authors. +// * +// * Licensed 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.springframework.cloud.alibaba.sentinel.datasource; +// +//import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertNotNull; +//import static org.junit.Assert.assertNull; +// +//import org.junit.Test; +//import org.springframework.cloud.alibaba.sentinel.datasource.config.ApolloDataSourceProperties; +//import org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration; +//import org.springframework.cloud.alibaba.sentinel.datasource.config.FileDataSourceProperties; +//import org.springframework.cloud.alibaba.sentinel.datasource.config.NacosDataSourceProperties; +//import org.springframework.cloud.alibaba.sentinel.datasource.config.ZookeeperDataSourceProperties; +// +///** +// * @author Jim +// */ +//public class DataSourcePropertiesConfigurationTests { +// +// @Test +// public void testFileAttr() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); +// assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, +// dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull("DataSourcePropertiesConfiguration valid properties was not null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// +// FileDataSourceProperties fileDataSourceProperties = buildFileProperties(); +// +// dataSourcePropertiesConfiguration.setFile(fileDataSourceProperties); +// +// assertEquals( +// "DataSourcePropertiesConfiguration valid field size was wrong after set file attribute", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration file properties was null after set file attribute", +// dataSourcePropertiesConfiguration.getFile()); +// assertNotNull( +// "DataSourcePropertiesConfiguration valid properties was null after set file attribute", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testNacosAttr() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); +// assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, +// dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull("DataSourcePropertiesConfiguration valid properties was not null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// +// NacosDataSourceProperties nacosDataSourceProperties = buildNacosProperties(); +// +// dataSourcePropertiesConfiguration.setNacos(nacosDataSourceProperties); +// +// assertEquals( +// "DataSourcePropertiesConfiguration valid field size was wrong after set nacos attribute", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration nacos properties was null after set nacos attribute", +// dataSourcePropertiesConfiguration.getNacos()); +// assertNotNull( +// "DataSourcePropertiesConfiguration valid properties was null after set nacos attribute", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testZKAttr() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); +// assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, +// dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull("DataSourcePropertiesConfiguration valid properties was not null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// +// ZookeeperDataSourceProperties zookeeperDataSourceProperties = buildZKProperties(); +// +// dataSourcePropertiesConfiguration.setZk(zookeeperDataSourceProperties); +// +// assertEquals( +// "DataSourcePropertiesConfiguration valid field size was wrong after set zk attribute", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration zk properties was null after set zk attribute", +// dataSourcePropertiesConfiguration.getZk()); +// assertNotNull( +// "DataSourcePropertiesConfiguration valid properties was null after set zk attribute", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testApolloAttr() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); +// assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, +// dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull("DataSourcePropertiesConfiguration valid properties was not null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// +// ApolloDataSourceProperties apolloDataSourceProperties = buildApolloProperties(); +// +// dataSourcePropertiesConfiguration.setApollo(apolloDataSourceProperties); +// +// assertEquals( +// "DataSourcePropertiesConfiguration valid field size was wrong after set apollo attribute", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration apollo properties was null after set apollo attribute", +// dataSourcePropertiesConfiguration.getApollo()); +// assertNotNull( +// "DataSourcePropertiesConfiguration valid properties was null after set apollo attribute", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testMultiAttr() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration(); +// assertEquals("DataSourcePropertiesConfiguration valid field size was wrong", 0, +// dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull("DataSourcePropertiesConfiguration valid properties was not null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// +// FileDataSourceProperties fileDataSourceProperties = buildFileProperties(); +// NacosDataSourceProperties nacosDataSourceProperties = buildNacosProperties(); +// +// dataSourcePropertiesConfiguration.setFile(fileDataSourceProperties); +// dataSourcePropertiesConfiguration.setNacos(nacosDataSourceProperties); +// +// assertEquals( +// "DataSourcePropertiesConfiguration valid field size was wrong after set file and nacos attribute", +// 2, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNull( +// "DataSourcePropertiesConfiguration valid properties was not null after set file and nacos attribute", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testFileConstructor() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( +// buildFileProperties()); +// assertEquals( +// "DataSourcePropertiesConfiguration file constructor valid field size was wrong", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration file constructor valid properties was null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testNacosConstructor() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( +// buildNacosProperties()); +// assertEquals( +// "DataSourcePropertiesConfiguration nacos constructor valid field size was wrong", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration nacos constructor valid properties was null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testApolloConstructor() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( +// buildApolloProperties()); +// assertEquals( +// "DataSourcePropertiesConfiguration apollo constructor valid field size was wrong", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration apollo constructor valid properties was null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// @Test +// public void testZKConstructor() { +// DataSourcePropertiesConfiguration dataSourcePropertiesConfiguration = new DataSourcePropertiesConfiguration( +// buildZKProperties()); +// assertEquals( +// "DataSourcePropertiesConfiguration zk constructor valid field size was wrong", +// 1, dataSourcePropertiesConfiguration.getValidField().size()); +// assertNotNull( +// "DataSourcePropertiesConfiguration zk constructor valid properties was null", +// dataSourcePropertiesConfiguration.getValidDataSourceProperties()); +// } +// +// private FileDataSourceProperties buildFileProperties() { +// FileDataSourceProperties fileDataSourceProperties = new FileDataSourceProperties(); +// +// fileDataSourceProperties.setFile("/tmp/test.json"); +// fileDataSourceProperties.setBufSize(1024); +// fileDataSourceProperties.setRecommendRefreshMs(2000); +// return fileDataSourceProperties; +// } +// +// private NacosDataSourceProperties buildNacosProperties() { +// NacosDataSourceProperties nacosDataSourceProperties = new NacosDataSourceProperties(); +// nacosDataSourceProperties.setServerAddr("127.0.0.1:8848"); +// nacosDataSourceProperties.setDataId("sentinel"); +// nacosDataSourceProperties.setGroupId("custom-group"); +// return nacosDataSourceProperties; +// } +// +// private ApolloDataSourceProperties buildApolloProperties() { +// ApolloDataSourceProperties apolloDataSourceProperties = new ApolloDataSourceProperties(); +// apolloDataSourceProperties.setFlowRulesKey("test-key"); +// apolloDataSourceProperties.setDefaultFlowRuleValue("dft-val"); +// apolloDataSourceProperties.setNamespaceName("namespace"); +// return apolloDataSourceProperties; +// } +// +// private ZookeeperDataSourceProperties buildZKProperties() { +// ZookeeperDataSourceProperties zookeeperDataSourceProperties = new ZookeeperDataSourceProperties(); +// +// zookeeperDataSourceProperties.setServerAddr("localhost:2181"); +// zookeeperDataSourceProperties.setPath("/path"); +// return zookeeperDataSourceProperties; +// } +// +//} diff --git a/spring-cloud-starter-alibaba/pom.xml b/spring-cloud-starter-alibaba/pom.xml index c0de36447..d277c389f 100644 --- a/spring-cloud-starter-alibaba/pom.xml +++ b/spring-cloud-starter-alibaba/pom.xml @@ -20,26 +20,4 @@ spring-cloud-starter-stream-rocketmq spring-cloud-starter-bus-rocketmq - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - \ No newline at end of file diff --git a/spring-cloud-starter-alicloud/pom.xml b/spring-cloud-starter-alicloud/pom.xml index 3684464e5..df47cfbbd 100644 --- a/spring-cloud-starter-alicloud/pom.xml +++ b/spring-cloud-starter-alicloud/pom.xml @@ -17,26 +17,4 @@ spring-cloud-starter-alicloud-schedulerx spring-cloud-starter-alicloud-sms - - - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - - - org.codehaus.mojo - cobertura-maven-plugin - false - - true - - - - - \ No newline at end of file