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 2021/06/22 12:24:13 UTC
[sling-org-apache-sling-resource-presence] 02/02: SLING-10526
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-resource-presence.git
commit ed0882fd1147296e2f55e9e4a1e357b745406b59
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jun 22 14:24:03 2021 +0200
SLING-10526 Enable code coverage with JaCoCo
---
pom.xml | 9 +++------
.../resource/presence/ResourcePresenterTestSupport.java | 16 +++++++++++++++-
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 98bcd87..079c747 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,12 +62,9 @@
</executions>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
- <systemProperties>
- <property>
- <name>bundle.filename</name>
- <value>${basedir}/target/${project.build.finalName}.jar</value>
- </property>
- </systemProperties>
+ <systemPropertyVariables combine.children="append">
+ <bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
+ </systemPropertyVariables>
</configuration>
</plugin>
<plugin>
diff --git a/src/test/java/org/apache/sling/resource/presence/ResourcePresenterTestSupport.java b/src/test/java/org/apache/sling/resource/presence/ResourcePresenterTestSupport.java
index dcaa8c0..5c75cba 100644
--- a/src/test/java/org/apache/sling/resource/presence/ResourcePresenterTestSupport.java
+++ b/src/test/java/org/apache/sling/resource/presence/ResourcePresenterTestSupport.java
@@ -18,14 +18,20 @@
*/
package org.apache.sling.resource.presence;
+import java.util.Objects;
+
import org.apache.sling.testing.paxexam.TestSupport;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.ModifiableCompositeOption;
+import org.ops4j.pax.exam.options.OptionalCompositeOption;
+import org.ops4j.pax.exam.options.extra.VMOption;
import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
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.CoreOptions.when;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
public abstract class ResourcePresenterTestSupport extends TestSupport {
@@ -43,10 +49,18 @@ public abstract class ResourcePresenterTestSupport extends TestSupport {
.asOption(),
// testing
mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
- junitBundles()
+ junitBundles(),
+ jacoco() // remove with Testing PaxExam 4.0
);
}
+ // remove with Testing PaxExam 4.0
+ protected OptionalCompositeOption jacoco() {
+ final String jacocoCommand = System.getProperty("jacoco.command");
+ final VMOption option = Objects.nonNull(jacocoCommand) && !jacocoCommand.trim().isEmpty() ? vmOption(jacocoCommand) : null;
+ return when(Objects.nonNull(option)).useOptions(option);
+ }
+
protected Option slingQuickstart() {
final int httpPort = findFreePort();
final String workingDirectory = workingDirectory();