You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2020/08/27 09:23:24 UTC

[sling-org-apache-sling-scripting-core] branch master updated: SLING-9705 Enable code coverage with JaCoCo

This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-core.git


The following commit(s) were added to refs/heads/master by this push:
     new af6e4b0  SLING-9705 Enable code coverage with JaCoCo
af6e4b0 is described below

commit af6e4b0c8acc1a57ed5aed5c14aaa7c26f341c30
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Aug 27 11:23:13 2020 +0200

    SLING-9705 Enable code coverage with JaCoCo
---
 pom.xml                                            | 26 ++++++++++++++++++++++
 .../core/it/ScriptingCoreTestSupport.java          |  4 +++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 8d7c136..491bbdb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,9 +77,35 @@
                             <name>bundle.filename</name>
                             <value>${basedir}/target/${project.build.finalName}.jar</value>
                         </property>
+                        <property>
+                            <name>jacoco.command</name>
+                            <value>${jacoco.command}</value>
+                        </property>
                     </systemProperties>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>prepare-agent</id>
+                        <configuration>
+                            <propertyName>jacoco.command</propertyName>
+                        </configuration>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>report</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <reporting>
diff --git a/src/test/java/org/apache/sling/scripting/core/it/ScriptingCoreTestSupport.java b/src/test/java/org/apache/sling/scripting/core/it/ScriptingCoreTestSupport.java
index dc67652..625671a 100644
--- a/src/test/java/org/apache/sling/scripting/core/it/ScriptingCoreTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/core/it/ScriptingCoreTestSupport.java
@@ -29,6 +29,7 @@ import static org.apache.sling.testing.paxexam.SlingOptions.versionResolver;
 import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.vmOption;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
 
 public class ScriptingCoreTestSupport extends TestSupport {
@@ -61,7 +62,8 @@ public class ScriptingCoreTestSupport extends TestSupport {
             mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.commons.compiler").versionAsInProject(),
             mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.servlets.resolver").versionAsInProject(),
             junitBundles(),
-            awaitility()
+            awaitility(),
+            vmOption(System.getProperty("jacoco.command"))
         ).add(
             mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.converter").version("1.0.12") // new Sling API dependency
         ).remove(