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/23 10:05:25 UTC
[sling-org-apache-sling-karaf-integration-tests] branch master
updated: SLING-3017 Improve Karaf integration tests
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-karaf-integration-tests.git
The following commit(s) were added to refs/heads/master by this push:
new b5a2cd4 SLING-3017 Improve Karaf integration tests
b5a2cd4 is described below
commit b5a2cd4d2f714ab589959ab139af1659de5febf0
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jun 23 11:59:54 2021 +0200
SLING-3017 Improve Karaf integration tests
enable JaCoCo for integration tests
---
.../org/apache/sling/karaf/testing/KarafTestSupport.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java b/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
index c474811..c390525 100644
--- a/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
+++ b/src/main/java/org/apache/sling/karaf/testing/KarafTestSupport.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Dictionary;
+import java.util.Objects;
import java.util.Properties;
import javax.inject.Inject;
@@ -29,6 +30,8 @@ import javax.inject.Inject;
import org.apache.karaf.features.BootFinished;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
+import org.ops4j.pax.exam.options.OptionalCompositeOption;
+import org.ops4j.pax.exam.options.extra.VMOption;
import org.ops4j.pax.exam.util.Filter;
import org.ops4j.pax.exam.util.PathUtils;
import org.osgi.framework.Bundle;
@@ -42,6 +45,7 @@ import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.streamBundle;
import static org.ops4j.pax.exam.CoreOptions.vmOption;
+import static org.ops4j.pax.exam.CoreOptions.when;
import static org.ops4j.pax.exam.OptionUtils.combine;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
@@ -152,7 +156,8 @@ public abstract class KarafTestSupport {
addSlingFeatures("sling-configs"),
mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("tinybundles").versionAsInProject(),
mavenBundle().groupId("biz.aQute.bnd").artifactId("biz.aQute.bndlib").versionAsInProject(),
- karafTestSupportBundle()
+ karafTestSupportBundle(),
+ jacoco()
);
if (JavaVersionUtil.getMajorVersion() >= 9) {
return combine(options, java9plus());
@@ -161,6 +166,12 @@ public abstract class KarafTestSupport {
}
}
+ 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[] java9plus() {
return options(
vmOption("--add-reads=java.xml=java.logging"),