Merge "Configure Jacoco plugin to enforce min coverage"
authorTian Lee <TianL@amdocs.com>
Mon, 1 Apr 2019 13:22:55 +0000 (13:22 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 1 Apr 2019 13:22:55 +0000 (13:22 +0000)
1  2 
pom.xml

diff --combined pom.xml
+++ b/pom.xml
@@@ -41,6 -41,10 +41,10 @@@ limitations under the License
          <version.org.onap.aai.aai-utils>1.4.0</version.org.onap.aai.aai-utils>
          <version.org.onap.aai.aai-auth>1.4.0</version.org.onap.aai.aai-auth>
          <event.client.version>1.3.1</event.client.version>
+         <!-- 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.60</jacoco.line.coverage.limit>
+         <jacoco.report.directory>${project.build.directory}/code-coverage</jacoco.report.directory>
      </properties>
  
      <dependencyManagement>
@@@ -49,7 -53,7 +53,7 @@@
                  <!-- Import dependency management from Spring Boot -->
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-dependencies</artifactId>
 -                <version>1.5.18.RELEASE</version>
 +                <version>1.5.19.RELEASE</version>
                  <type>pom</type>
                  <scope>import</scope>
              </dependency>
                      </execution>
                  </executions>
              </plugin>
-         </plugins>
+             <plugin>
+                 <groupId>org.jacoco</groupId>
+                 <artifactId>jacoco-maven-plugin</artifactId>
+                 <executions>
+                     <execution>
+                         <id>default-check</id>
+                         <goals>
+                             <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>
+          </plugins>
      </build>
  
      <distributionManagement>