diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2021-09-17 15:07:38 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2021-09-17 17:40:37 +0100 |
commit | 73001f6a64b3548a9584acc8c4bfe3a7806917e7 (patch) | |
tree | 21ec4cd440d18413019256d629da4189ab894ebe | |
parent | bd8ab2fc4737aebada59962baed8b35d4f86dd1c (diff) |
Fix SonarQube (jacoco) code coverage reporting
- Add report module for aggregating (as per jacocos current recommendation)(
- increased overall (cps-parent) minimum code coverage to 0.97
- set lower minimum in modules that are not at that level (yet)
- add exclude for cps-events generated code
- made xml identing consistentent some pom files
Issue-ID: CPS-475
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: If7b7839d7e03522575bc76a2253b613e63400b6b
-rwxr-xr-x | cps-application/pom.xml | 2 | ||||
-rw-r--r-- | cps-events/pom.xml | 11 | ||||
-rw-r--r-- | cps-ncmp-rest/pom.xml | 254 | ||||
-rw-r--r-- | cps-ncmp-service/pom.xml | 92 | ||||
-rwxr-xr-x | cps-parent/pom.xml | 31 | ||||
-rw-r--r-- | cps-service/pom.xml | 4 | ||||
-rw-r--r-- | jacoco-report/pom.xml | 94 | ||||
-rw-r--r-- | pom.xml | 1 |
8 files changed, 277 insertions, 212 deletions
diff --git a/cps-application/pom.xml b/cps-application/pom.xml index dfa469745e..9c6945a5fe 100755 --- a/cps-application/pom.xml +++ b/cps-application/pom.xml @@ -37,7 +37,7 @@ <app>org.onap.cps.Application</app> <jib-maven-plugin.version>2.8.0</jib-maven-plugin.version> <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> - <minimum-coverage>0.7</minimum-coverage> + <minimum-coverage>0.82</minimum-coverage> <base.image>${docker.pull.registry}/onap/integration-java11:8.0.0</base.image> <image.tag>${project.version}-${maven.build.timestamp}</image.tag> </properties> diff --git a/cps-events/pom.xml b/cps-events/pom.xml index 3dc5f1e0ac..6f51479bb0 100644 --- a/cps-events/pom.xml +++ b/cps-events/pom.xml @@ -62,16 +62,7 @@ <serializable>true</serializable> </configuration> </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude>org/onap/cps/event/model/*</exclude> - </excludes> - </configuration> - </plugin> </plugins> </build> -</project>
\ No newline at end of file +</project> diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml index e77ede50dc..2c44c24807 100644 --- a/cps-ncmp-rest/pom.xml +++ b/cps-ncmp-rest/pom.xml @@ -33,133 +33,133 @@ <artifactId>cps-ncmp-rest</artifactId> -<properties> - <minimum-coverage>0.5</minimum-coverage> -</properties> + <properties> + <minimum-coverage>0.95</minimum-coverage> + </properties> -<dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>cps-ncmp-service</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - <exclusions> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-validation</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jetty</artifactId> - </dependency> - <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-annotations</artifactId> - </dependency> - <!-- T E S T D E P E N D E N C I E S --> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-json</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.spockframework</groupId> - <artifactId>spock-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.spockframework</groupId> - <artifactId>spock-spring</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib-nodep</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> -</dependencies> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-ncmp-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jetty</artifactId> + </dependency> + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-annotations</artifactId> + </dependency> + <!-- T E S T D E P E N D E N C I E S --> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-json</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.spockframework</groupId> + <artifactId>spock-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.spockframework</groupId> + <artifactId>spock-spring</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + </dependency> + </dependencies> -<build> - <plugins> - <!-- Swagger code generation. --> - <plugin> - <groupId>io.swagger.codegen.v3</groupId> - <artifactId>swagger-codegen-maven-plugin</artifactId> - <executions> - <execution> - <id>code-gen</id> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> - <invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage> - <modelPackage>org.onap.cps.ncmp.rest.model</modelPackage> - <apiPackage>org.onap.cps.ncmp.rest.api</apiPackage> - <language>spring</language> - <generateSupportingFiles>false</generateSupportingFiles> - <configOptions> - <sourceFolder>src/gen/java</sourceFolder> - <dateLibrary>java11</dateLibrary> - <interfaceOnly>true</interfaceOnly> - <useTags>true</useTags> - </configOptions> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <id>copy-resources</id> - <phase>compile</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-ncmp</outputDirectory> - <resources> - <resource> - <directory>${project.basedir}/target/generated-sources/swagger/</directory> - <includes> - <include>openapi.yaml</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> -</build> + <build> + <plugins> + <!-- Swagger code generation. --> + <plugin> + <groupId>io.swagger.codegen.v3</groupId> + <artifactId>swagger-codegen-maven-plugin</artifactId> + <executions> + <execution> + <id>code-gen</id> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec> + <invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage> + <modelPackage>org.onap.cps.ncmp.rest.model</modelPackage> + <apiPackage>org.onap.cps.ncmp.rest.api</apiPackage> + <language>spring</language> + <generateSupportingFiles>false</generateSupportingFiles> + <configOptions> + <sourceFolder>src/gen/java</sourceFolder> + <dateLibrary>java11</dateLibrary> + <interfaceOnly>true</interfaceOnly> + <useTags>true</useTags> + </configOptions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>compile</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.basedir}/target/classes/static/api-docs/cps-ncmp</outputDirectory> + <resources> + <resource> + <directory>${project.basedir}/target/generated-sources/swagger/</directory> + <includes> + <include>openapi.yaml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/cps-ncmp-service/pom.xml b/cps-ncmp-service/pom.xml index 294b290161..0ee81c784c 100644 --- a/cps-ncmp-service/pom.xml +++ b/cps-ncmp-service/pom.xml @@ -22,53 +22,53 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> -<modelVersion>4.0.0</modelVersion> -<parent> - <groupId>org.onap.cps</groupId> - <artifactId>cps-parent</artifactId> - <version>2.0.1-SNAPSHOT</version> - <relativePath>../cps-parent/pom.xml</relativePath> -</parent> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.cps</groupId> + <artifactId>cps-parent</artifactId> + <version>2.0.1-SNAPSHOT</version> + <relativePath>../cps-parent/pom.xml</relativePath> + </parent> -<artifactId>cps-ncmp-service</artifactId> + <artifactId>cps-ncmp-service</artifactId> -<properties> - <minimum-coverage>0.7</minimum-coverage> -</properties> + <properties> + <minimum-coverage>0.87</minimum-coverage> + </properties> -<dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>cps-service</artifactId> - </dependency> - <dependency> - <groupId>org.spockframework</groupId> - <artifactId>spock-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.spockframework</groupId> - <artifactId>spock-spring</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-validation</artifactId> - </dependency> -</dependencies> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-service</artifactId> + </dependency> + <dependency> + <groupId>org.spockframework</groupId> + <artifactId>spock-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.spockframework</groupId> + <artifactId>spock-spring</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </dependency> + </dependencies> </project> diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index 3de50c3c14..3c2eab5e0f 100755 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -38,24 +38,11 @@ <properties> <app>org.onap.cps.Application</app> <java.version>11</java.version> - <minimum-coverage>0.9</minimum-coverage> + <minimum-coverage>0.97</minimum-coverage> <jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate> <sonar.coverage.jacoco.xmlReportPaths> - ../cps-ri/target/site/jacoco-ut/jacoco.xml, - ../cps-ri/target/site/jacoco-aggregate/jacoco.xml, - ../cps-service/target/site/jacoco-ut/jacoco.xml, - ../cps-service/target/site/jacoco-aggregate/jacoco.xml, - ../cps-rest/target/site/jacoco-ut/jacoco.xml, - ../cps-rest/target/site/jacoco-aggregate/jacoco.xml, - ../cps-ncmp-service/target/site/jacoco-ut/jacoco.xml, - ../cps-ncmp-service/target/site/jacoco-aggregate/jacoco.xml, - ../cps-ncmp-rest/target/site/jacoco-ut/jacoco.xml, - ../cps-ncmp-rest/target/site/jacoco-aggregate/jacoco.xml, - ../cps-path-parser/target/site/jacoco-ut/jacoco.xml, - ../cps-path-parser/target/site/jacoco-aggregate/jacoco.xml, - ../cps-application/target/site/jacoco-ut/jacoco.xml, - ../cps-application/target/site/jacoco-aggregate/jacoco.xml + ../jacoco-report/target/site/jacoco-aggregate/jacoco.xml </sonar.coverage.jacoco.xmlReportPaths> </properties> @@ -346,10 +333,10 @@ <artifactId>jacoco-maven-plugin</artifactId> <configuration> <excludes> + <exclude>org/onap/cps/event/model/*</exclude> <exclude>org/onap/cps/rest/model/*</exclude> <exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude> <exclude>org/onap/cps/ncmp/rest/model/*</exclude> - <exclude>org/onap/cps/ncmp/api/models/*</exclude> </excludes> </configuration> <executions> @@ -380,18 +367,6 @@ </rules> </configuration> </execution> - <execution> - <id>report</id> - <goals> - <goal>report-aggregate</goal> - </goals> - <phase>verify</phase> - <configuration> - <dataFileIncludes> - <fileInclude>**/code-coverage/jacoco-ut.exec</fileInclude> - </dataFileIncludes> - </configuration> - </execution> </executions> </plugin> <plugin> diff --git a/cps-service/pom.xml b/cps-service/pom.xml index c8daccca4d..0e0831558d 100644 --- a/cps-service/pom.xml +++ b/cps-service/pom.xml @@ -34,6 +34,10 @@ <artifactId>cps-service</artifactId>
+ <properties>
+ <minimum-coverage>0.94</minimum-coverage>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.onap.cps</groupId>
diff --git a/jacoco-report/pom.xml b/jacoco-report/pom.xml new file mode 100644 index 0000000000..2c2a4db97b --- /dev/null +++ b/jacoco-report/pom.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>cps-aggregator</artifactId> + <groupId>org.onap.cps</groupId> + <version>2.0.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>jacoco-report</artifactId> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-application</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-events</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-ncmp-rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-ncmp-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-path-parser</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-ri</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cps-service</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <configuration> + <excludes> + <exclude>org/onap/cps/event/model/*</exclude> + <exclude>org/onap/cps/rest/model/*</exclude> + <exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude> + <exclude>org/onap/cps/ncmp/rest/model/*</exclude> + </excludes> + </configuration> + <executions> + <execution> + <id>default-prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>report</id> + <goals> + <goal>report-aggregate</goal> + </goals> + <phase>verify</phase> + <configuration> + <dataFileIncludes> + <fileInclude>**/code-coverage/jacoco-ut.exec</fileInclude> + </dataFileIncludes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> @@ -62,6 +62,7 @@ <module>checkstyle</module>
<module>spotbugs</module>
<module>cps-application</module>
+ <module>jacoco-report</module>
</modules>
<build>
|