Add JaCoCo coverage for OVSDB 32/8832/1
authorDave Tucker <djt@redhat.com>
Tue, 8 Jul 2014 23:35:18 +0000 (00:35 +0100)
committerDave Tucker <djt@redhat.com>
Tue, 8 Jul 2014 23:38:22 +0000 (00:38 +0100)
- Update to JaCoCo 6.4
- Add UT and IT configurations
- Required to push UT/IT coverage to Sonar
- Can be run locally:
 mvn clean verify -Pintegrationtest
- Local coverage reports are in the target/site directory of each
  module

Change-Id: I5c4c1c4d2e7b37eb67f9bf2ade818c8ed4256cd0
Signed-off-by: Dave Tucker <djt@redhat.com>
commons/parent/pom.xml
integrationtest/pom.xml

index 853afb8227d64e13f10e1cb335f9983815bb80ba..226ef4e734d2a6cf57bc01fdb587bf292de3b9e5 100755 (executable)
     <java.version.target>1.7</java.version.target>
     <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <!-- Use Jacoco 6.4 for the seperate integration-test reporting -->
+    <jacoco.version>0.6.4.201312101107</jacoco.version>
+    <sonar.jacoco.reportPath>target/code-coverage/jacoco.exec</sonar.jacoco.reportPath>
+    <sonar.jacoco.itReportPath>target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
+    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
   </properties>
 
   <dependencyManagement>
         </plugin>
       </plugins>
     </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>org.opendaylight.ovsdb.*</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>pre-unit-test</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+            <configuration>
+              <destFile>${sonar.jacoco.reportPath}</destFile>
+              <propertyName>surefireArgLine</propertyName>
+            </configuration>
+          </execution>
+          <execution>
+            <id>pre-integration-test</id>
+            <goals>
+              <goal>prepare-agent-integration</goal>
+            </goals>
+            <configuration>
+              <destFile>${sonar.jacoco.itReportPath}</destFile>
+              <propertyName>failsafeArgLine</propertyName>
+            </configuration>
+          </execution>
+          <execution>
+            <id>post-unit-test</id>
+            <goals>
+              <goal>report</goal>
+            </goals>
+            <configuration>
+              <dataFile>${sonar.jacoco.reportPath}</dataFile>
+            </configuration>
+          </execution>
+          <execution>
+            <id>post-integration-test</id>
+            <goals>
+              <goal>report-integration</goal>
+            </goals>
+            <configuration>
+              <dataFile>${sonar.jacoco.itReportPath}</dataFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!-- Use the Jacoco Argline -->
+          <argLine>${surefireArgLine}</argLine>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <configuration>
+          <!-- Use the Jacoco Argline -->
+          <argLine>${failsafeArgLine}</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
   </build>
   <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
   <scm>
index 5521dd62ef2900d62ee2b5d0532f10d5e8f16ce2..2c6febce5d329fa6f5b19a83371b9bbd03ffa066 100644 (file)
   <version>1.0.0-SNAPSHOT</version>
   <packaging>jar</packaging>
 
-  <properties>
-    <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
-    <!-- Sonar jacoco plugin to get integration test coverage info -->
-    <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
-  </properties>
-
   <dependencies>
     <dependency>
       <groupId>ch.qos.logback</groupId>
   </dependencies>
   <build>
     <plugins>
-      <plugin>
-        <groupId>org.jacoco</groupId>
-        <artifactId>jacoco-maven-plugin</artifactId>
-        <configuration>
-          <destFile>../implementation/target/jacoco-it.exec</destFile>
-          <includes>
-            <include>org.opendaylight.controller.*</include>
-            <include>org.opendaylight.ovsdb.*</include>
-          </includes>
-        </configuration>
-        <executions>
-          <execution>
-            <id>pre-test</id>
-            <goals>
-              <goal>prepare-agent</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>post-test</id>
-            <configuration>
-              <skip>true</skip>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>