Enable PowerMock instrumentation with JaCoCo 27/32427/1
authorStephen Kitt <skitt@redhat.com>
Tue, 12 Jan 2016 15:20:19 +0000 (16:20 +0100)
committerStephen Kitt <skitt@redhat.com>
Tue, 12 Jan 2016 15:20:19 +0000 (16:20 +0100)
By default PowerMock is incompatible with JaCoCo, even with the older
version of JaCoCo defined by odlparent: the tests run but their
coverage isn't measured. This patch forces offline instrumentation
which allows both PowerMock and JaCoCo to operate (more or less)
properly. There are a number of "class already instrumented" errors
but they don't affect the test results.

This patch also upgrades PowerMock to 1.6.4 (initially in the hope
that it would work with JaCoCo as-is); this requires an upgrade to
Mockito too. I'll drive these changes properly in odlparent and remove
the local overrides when appropriate!

Change-Id: I2ab704f7a28f325ed3bb5a75a6f34ffb6c3b36b3
Signed-off-by: Stephen Kitt <skitt@redhat.com>
openstack/net-virt-providers/pom.xml
openstack/net-virt-sfc/impl/pom.xml
openstack/net-virt/pom.xml
utils/config/pom.xml
utils/servicehelper/pom.xml

index 2d7a664cfcd42835b5988c365ceb1c4bb89f2dd5..034fb03eac9dff79be2f5143b5c1936f713c1215 100644 (file)
@@ -46,7 +46,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <properties>
     <liblldp.version>0.10.0-SNAPSHOT</liblldp.version>
     <openflowplugin.version>0.2.0-SNAPSHOT</openflowplugin.version>
-    <powermock.version>1.5.2</powermock.version>
+    <powermock.version>1.6.4</powermock.version>
     <sonar.jacoco.itReportPath>../net-virt-it/target/jacoco-it.exec</sonar.jacoco.itReportPath>
   </properties>
 
@@ -149,6 +149,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
+      <version>1.10.19</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -220,6 +221,24 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </properties>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-instrument</id>
+            <goals>
+              <goal>instrument</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>default-restore-instrumented-classes</id>
+            <goals>
+              <goal>restore-instrumented-classes</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
index e3b09a1a0eaf24b1c67960dbd8780c92161d128e..44eee54066fa76395c40b1d30e939fe96dd434fd 100644 (file)
@@ -26,7 +26,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <properties>
     <openflowplugin.version>0.2.0-SNAPSHOT</openflowplugin.version>
-    <powermock.version>1.5.2</powermock.version>
+    <powermock.version>1.6.4</powermock.version>
     <sfc.version>0.2.0-SNAPSHOT</sfc.version>
     <sonar.jacoco.itReportPath>../it/target/jacoco-it.exec</sonar.jacoco.itReportPath>
   </properties>
@@ -135,6 +135,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
+      <version>1.10.19</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -185,6 +186,24 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </properties>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-instrument</id>
+            <goals>
+              <goal>instrument</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>default-restore-instrumented-classes</id>
+            <goals>
+              <goal>restore-instrumented-classes</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
index 90823bd410dcdd080af0c2e73547e8859d3b1a20..b42dcedc1f6a9eb2978d8430820f622e2f5c5a8e 100644 (file)
@@ -46,7 +46,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <properties>
     <neutron.model.version>0.6.0-SNAPSHOT</neutron.model.version>
-    <powermock.version>1.5.2</powermock.version>
+    <powermock.version>1.6.4</powermock.version>
     <sonar.jacoco.itReportPath>../net-virt-it/target/jacoco-it.exec</sonar.jacoco.itReportPath>
   </properties>
 
@@ -124,6 +124,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
+      <version>1.10.19</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -192,6 +193,24 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </properties>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-instrument</id>
+            <goals>
+              <goal>instrument</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>default-restore-instrumented-classes</id>
+            <goals>
+              <goal>restore-instrumented-classes</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
index 8e414710ba9d4377a69b99f0f8624443f9025734..0376bd9eb810e2bec127ea459983152851ee6074 100644 (file)
@@ -46,7 +46,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </scm>
 
   <properties>
-    <powermock.version>1.5.2</powermock.version>
+    <powermock.version>1.6.4</powermock.version>
   </properties>
 
   <dependencies>
@@ -54,6 +54,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
+      <version>1.10.19</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -75,4 +76,27 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <version>${powermock.version}</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-instrument</id>
+            <goals>
+              <goal>instrument</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>default-restore-instrumented-classes</id>
+            <goals>
+              <goal>restore-instrumented-classes</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>
index fba5f0902d7711c1a888e0a4e5c3a8b0e8d0d920..dd99e667bd007e53b4760dbbcb855e8f8270468f 100644 (file)
@@ -45,7 +45,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </scm>
 
   <properties>
-    <powermock.version>1.5.2</powermock.version>
+    <powermock.version>1.6.4</powermock.version>
   </properties>
 
   <dependencies>
@@ -65,6 +65,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
+      <version>1.10.19</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -111,6 +112,24 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-instrument</id>
+            <goals>
+              <goal>instrument</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>default-restore-instrumented-classes</id>
+            <goals>
+              <goal>restore-instrumented-classes</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>