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 15:45:03 UTC
[sling-org-apache-sling-jcr-presence] 02/02: SLING-10532 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-jcr-presence.git
commit 597830d6e997b149036828079bd5417c435748a6
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jun 22 17:44:51 2021 +0200
SLING-10532 Enable code coverage with JaCoCo
---
pom.xml | 9 +++------
.../sling/jcr/presence/JcrPresenceTestSupport.java | 16 +++++++++++++++-
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7ac50ae..ae66bf7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,12 +74,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>
</plugins>
diff --git a/src/test/java/org/apache/sling/jcr/presence/JcrPresenceTestSupport.java b/src/test/java/org/apache/sling/jcr/presence/JcrPresenceTestSupport.java
index fb21c5e..ebc2fb5 100644
--- a/src/test/java/org/apache/sling/jcr/presence/JcrPresenceTestSupport.java
+++ b/src/test/java/org/apache/sling/jcr/presence/JcrPresenceTestSupport.java
@@ -18,12 +18,16 @@
*/
package org.apache.sling.jcr.presence;
+import java.util.Objects;
+
import javax.inject.Inject;
import org.apache.sling.jcr.api.SlingRepository;
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 org.osgi.framework.BundleContext;
import static org.apache.sling.testing.paxexam.SlingOptions.awaitility;
@@ -31,6 +35,8 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTa
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.CoreOptions.wrappedBundle;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
@@ -63,10 +69,18 @@ public abstract class JcrPresenceTestSupport extends TestSupport {
mavenBundle().groupId("com.googlecode.java-diff-utils").artifactId("diffutils").versionAsInProject(),
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
.put("whitelist.bundles.regexp", "PAXEXAM-PROBE-.*")
- .asOption()
+ .asOption(),
+ 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();