Configure Jacoco plugin to enforce min coverage 34/83734/3
authorMichael Arrastia <MArrasti@amdocs.com>
Fri, 29 Mar 2019 14:09:14 +0000 (14:09 +0000)
committerTian Lee <TianL@amdocs.com>
Mon, 1 Apr 2019 13:21:48 +0000 (13:21 +0000)
Jacoco plugin is configured to set the minimum line coverage ratios to
equal that of the current coverage level, to prevent future updates from
decreasing the coverage level.

Change-Id: Iff78f455bf9610bcf3e8611490a51794287dce67
Issue-ID: AAI-2302
Signed-off-by: Michael Arrastia <MArrasti@amdocs.com>
.gitignore
pom.xml

index 08a78dd..0631527 100644 (file)
@@ -1,5 +1,6 @@
 # Application
 logs/
+debug-logs/
 
 # Maven
 target/
@@ -17,4 +18,4 @@ target/
 # Misc
 .checkstyle
 .springBeans
-.vscode
\ No newline at end of file
+.vscode
diff --git a/pom.xml b/pom.xml
index 424f8e1..38b34ea 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <event.client.version>1.4.0-SNAPSHOT</event.client.version>
         <version.aai-schema>1.0.0</version.aai-schema>
         <version.aai-schema-ingest>1.4.1</version.aai-schema-ingest>
+        <!-- Minimum code coverage percentage. Please update this figure as coverage increases to prevent any drops in
+         coverage caused by new changes. Note that this figure cannot be lower than the ONAP requirement of 0.55 -->
+        <jacoco.line.coverage.limit>0.55</jacoco.line.coverage.limit>
+        <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
     </properties>
 
     <dependencyManagement>
                 <artifactId>jacoco-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>prepare-agent</id>
+                        <id>default-check</id>
                         <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>report</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>report</goal>
+                            <goal>check</goal>
                         </goals>
+                        <configuration>
+                            <dataFile>${jacoco.report.directory}/jacoco-ut.exec</dataFile>
+                            <rules>
+                                <!--  implementation is needed only for Maven 2  -->
+                                <rule implementation="org.jacoco.maven.RuleConfiguration">
+                                    <element>BUNDLE</element>
+                                    <limits>
+                                        <limit implementation="org.jacoco.report.check.Limit">
+                                            <counter>LINE</counter>
+                                            <value>COVEREDRATIO</value>
+                                            <minimum>${jacoco.line.coverage.limit}</minimum>
+                                        </limit>
+                                    </limits>
+                                </rule>
+                            </rules>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>