You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2020/02/07 14:06:45 UTC

[sling-org-apache-sling-servlets-resolver] branch master updated: Workaround for pax's RepositoryOptionImpl bug (and yes I should contribute a fix to that)

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

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new c14870e  Workaround for pax's RepositoryOptionImpl bug (and yes I should contribute a fix to that)
c14870e is described below

commit c14870e99658ff3b9945745977d4bbc892641543
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Feb 7 15:06:28 2020 +0100

    Workaround for pax's RepositoryOptionImpl bug (and yes I should contribute a fix to that)
---
 .../resolver/it/ServletResolverTestSupport.java      | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
index 3f55b8b..e0f5fe6 100644
--- a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
+++ b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
@@ -53,7 +53,8 @@ import org.apache.sling.servlethelpers.MockSlingHttpServletResponse;
 import org.ops4j.pax.exam.options.CompositeOption;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
 import static org.ops4j.pax.exam.CoreOptions.keepCaches;
-import static org.ops4j.pax.exam.CoreOptions.repository;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
@@ -81,15 +82,26 @@ public class ServletResolverTestSupport extends TestSupport {
     @Configuration
     public Option[] configuration() {
         final String vmOpt = System.getProperty("pax.vm.options");
+        final String localRepo = System.getProperty("maven.repo.local", "");
+
+        // workaround for https support, and pax's RepositoryOptionImpl adds a +
+        // in front of each URL, cannot use several instances of that option
+        final String repositoriesURL =
+            "+"
+            + "https://repository.apache.org/content/groups/snapshots/@snapshots@id=apache-snapshots"
+            + ",https://repo1.maven.org/maven2@id=central"
+        ;
+
         assertNotNull("Expecting non-null VM options", vmOpt);
         return remove(
             options(
                 vmOption(vmOpt),
                 failOnUnresolvedBundles(),
                 keepCaches(),
-                localMavenRepo(),
-                repository("https://repository.apache.org/snapshots/").id("apache-snapshots").allowSnapshots(),
-                repository("https://repo1.maven.org/maven2").id("central"),
+                systemProperty("org.ops4j.pax.url.mvn.repositories").value(repositoriesURL),
+                when(localRepo.length() > 0).useOptions(
+                    systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
+                ),
                 baseConfiguration(),
                 slingQuickstartOakTar(workingDirectory(), httpPort),
                 mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.api").versionAsInProject(),