I tried adding a file containing

--------
org.ops4j.pax.url.mvn.repositories=https://repo1.maven.org/maven2@id=central
org.ops4j.pax.url.mvn.useFallbackRepositories=false
org.ops4j.pax.url.mvn.requireConfigAdminConfig=true
--------

and using the below as the start (but not complete) return from the
config() method

--------
return options(
frameworkProperty("org.ops4j.pax.url.mvn.requireConfigAdminConfig").value(true),
                replaceConfigurationFile("etc/config.properties",
                        new File("config.properties")
                ),
                when( debugRemote ).useOptions(
                       debugConfiguration( "5005", true )
                ),

                karafDistributionConfiguration()
                    .frameworkUrl(
                            maven()
                            .groupId("org.apache.karaf")
                            .artifactId("apache-karaf")
                            .version(karafVersion)
                            .type("zip")
                    )
                    .karafVersion(karafVersion)
                    .unpackDirectory(new File("build/exam"))
                    .useDeployFolder(false),
                when( debugExam ).useOptions(
                    keepRuntimeFolder()
                ),
--------

It still fails, I think because all of these configuration settings
assume I have Karaf installed. But the failure is in downloading the
test container.

I tell it make the frameworkUrl using Maven,

.frameworkUrl(
    maven()
    .groupId("org.apache.karaf")
    .artifactId("apache-karaf")
    .version(karafVersion)
    .type("zip")
)

which calls the ArchiveExtractor

https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/ArchiveExtractor.java#L88

which call openStream(), openStream() (part of java.net)

public final InputStream openStream() throws java.io.IOException {
   return openConnection().getInputStream();
}

uses openConnection(), which is overridden to use the MavenResolver

https://github.com/ops4j/org.ops4j.pax.url/blob/master/pax-url-aether/src/main/java/org/ops4j/pax/url/mvn/Handler.java#L48

but passes a null in as system properties.

https://github.com/ops4j/org.ops4j.pax.url/blob/master/pax-url-aether/src/main/java/org/ops4j/pax/url/mvn/MavenResolvers.java#L27-L29

So then it passes in a propertyResolver that has no properties and just
the fallbackResolver (which contains http://repo1.maven.org/maven1)

propertyResolver = {DictionaryPropertyResolver@2189}
 - m_properties = null
 - m_fallbackResolver = {PropertiesPropertyResolver@2192}


So I guess what I need to do is manually build the correct Maven URL and
pass that directly in to the frameworkUrl() function?

cheers,
jared

On 2020-02-28 12:30 a.m., Grzegorz Grzybek wrote:
> Hello
> 
> Both org.ops4j.pax.url.mvn.useFallbackRepositories and
> org.ops4j.pax.url.mvn.repositories properties are OK, but only if you
> specify them in org.ops4j.pax.url.mvn PID (ConfigAdmin) or context
> property (in Pax-Exam - frameworkProperty()).
> 
> There's additional _context property_ (framework property, in Karaf -
> etc/config.properties) "org.ops4j.pax.url.mvn.requireConfigAdminConfig"
> - with this set (to any value), pax-url-aether will synchronously wait
> for proper ConfigurationAdmin (otherwise it _could_ fallback to default
> configuration).
> 
> I hope this will help.
> 
> regards
> Grzegorz Grzybek
> 
> czw., 27 lut 2020 o 20:12 Jared Whiklo <jwhi...@gmail.com
> <mailto:jwhi...@gmail.com>> napisał(a):
> 
>     Coming back to this post 4.13.2 release and I'm clearly missing
>     something and am still getting
> 
>     Gradle Test Run :islandora-karaf:test > Gradle Test Executor 13 >
>     ca.islandora.alpaca.karaf.KarafIT > classMethod FAILED
>         java.lang.RuntimeException: Problem starting container
> 
>             Caused by:
>             java.io.IOException: Error resolving artifact
>     org.apache.karaf:apache-karaf:zip:4.0.6: Could not transfer artifact
>     org.apache.karaf:apache-karaf:zip:4.0.6 from/to central
>     (http://repo1.maven.org/maven2/): Failed to transfer file:
>     
> http://repo1.maven.org/maven2/org/apache/karaf/apache-karaf/4.0.6/apache-karaf-4.0.6.zip.
>     Return code is: 501 , ReasonPhrase:HTTPS Required.
> 
>     Gradle Test Run :islandora-karaf:test > Gradle Test Executor 13 >
>     ca.islandora.alpaca.karaf.KarafIT > executionError FAILED
>         java.lang.RuntimeException: Container never came up
> 
>     I tried to add and return additional options() in the config()
>     method, but because the failure is occurring while trying to
>     download the Karaf container for the test, I feel like it must not
>     be using any of those settings.
> 
>     So I tried to setup a test-settings.xml file which defined a profile
>     with a repository for Maven using the https URL, and have it
>     activeByDefault. Then I tried to set this and via the
> 
>     final String settingsLocation =
>     getClass().getClassLoader().getResource("test-settings.xml").getPath();
>     systemProperty("org.ops4j.pax.url.mvn.settings").value(settingsLocation);
> 
> 
>     But this also did not have any effect.
> 
>     So I tried
> 
>     
> systemProperty("org.ops4j.pax.url.mvn.useFallbackRepositories").value("false");
>     systemProperty("org.ops4j.pax.url.mvn.repositories")
>     .value("https://repo1.maven.org/maven2@id=central";);
> 
> 
>     Which also didn't have any effect.
> 
>     Can someone explain where to set the settings explained on this page
>     (https://ops4j1.jira.com/wiki/spaces/paxurl/pages/3833866/Mvn+Protocol)
>     so that they are used when interpreting the
>     karafDistributionConfiguration() and/or frameworkUrl() please?
> 
>     cheers,
>     jared
> 
>     -- 
>     -- 
>     ------------------
>     OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>     <mailto:ops4j@googlegroups.com>
> 
>     ---
>     You received this message because you are subscribed to the Google
>     Groups "OPS4J" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to ops4j+unsubscr...@googlegroups.com
>     <mailto:ops4j+unsubscr...@googlegroups.com>.
>     To view this discussion on the web visit
>     
> https://groups.google.com/d/msgid/ops4j/a9670011-f1ef-4f41-aadb-59dbaf0876ef%40googlegroups.com
>     
> <https://groups.google.com/d/msgid/ops4j/a9670011-f1ef-4f41-aadb-59dbaf0876ef%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> -- 
> ------------------
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
> 
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "OPS4J" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ops4j/pJ98QaBVPfE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ops4j+unsubscr...@googlegroups.com
> <mailto:ops4j+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/CAAdXmhrJ8AGVCg032THLx-oWeTaVHmd-XGiRi-bfNHBVDQHvBQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ops4j/CAAdXmhrJ8AGVCg032THLx-oWeTaVHmd-XGiRi-bfNHBVDQHvBQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
Jared Whiklo
Pronouns: he/him/his
jwhi...@gmail.com
--------------------------------------------------
I drive way too fast to worry about cholesterol.

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/1ab803b4-e088-4ec8-caa0-fc85178a839c%40gmail.com.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to