Java Code Examples for org.ops4j.pax.exam.MavenUtils#getArtifactVersion()

The following examples show how to use org.ops4j.pax.exam.MavenUtils#getArtifactVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsCollectorTest.java    From karaf-decanter with Apache License 2.0 6 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "activemq.version", System.getProperty("activemq.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.features.cfg", "featuresRepositories",
                    "mvn:org.apache.karaf.features/framework/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.karaf.features/spring/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.karaf.features/spring-legacy/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.karaf.features/enterprise/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.karaf.features/enterprise-legacy/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features," +
                    "mvn:org.apache.activemq/activemq-karaf/" + System.getProperty("activemq.version") + "/xml/features," +
                    "mvn:org.apache.karaf.decanter/apache-karaf-decanter/" + System.getProperty("decanter.version") + "/xml/features")
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 2
Source File: MqttCollectorTest.java    From karaf-decanter with Apache License 2.0 6 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "activemq.version", System.getProperty("activemq.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.features.cfg", "featuresRepositories",
                    "mvn:org.apache.karaf.features/framework/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/spring/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/spring-legacy/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/enterprise/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/enterprise-legacy/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.activemq/activemq-karaf/" + System.getProperty("activemq.version") + "/xml/features," +
                            "mvn:org.apache.karaf.decanter/apache-karaf-decanter/" + System.getProperty("decanter.version") + "/xml/features"),
            KarafDistributionOption.editConfigurationFileExtend("etc/org.apache.karaf.features.cfg", "featuresBoot", "aries-blueprint,activemq-broker-noweb"),
            KarafDistributionOption.replaceConfigurationFile("etc/activemq.xml", getConfigFile("/etc/activemq.xml")),
            mavenBundle().groupId("org.eclipse.paho").artifactId("org.eclipse.paho.client.mqttv3").version(System.getProperty("paho.version"))
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 3
Source File: JmsAppenderTest.java    From karaf-decanter with Apache License 2.0 6 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "activemq.version", System.getProperty("activemq.version")),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.features.cfg", "featuresRepositories",
                    "mvn:org.apache.karaf.features/framework/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/spring/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/spring-legacy/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/enterprise/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/enterprise-legacy/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features," +
                            "mvn:org.apache.activemq/activemq-karaf/" + System.getProperty("activemq.version") + "/xml/features," +
                            "mvn:org.apache.karaf.decanter/apache-karaf-decanter/" + System.getProperty("decanter.version") + "/xml/features"),
            KarafDistributionOption.editConfigurationFileExtend("etc/org.apache.karaf.features.cfg", "featuresBoot", "aries-blueprint,activemq-broker-noweb"),
            KarafDistributionOption.replaceConfigurationFile("etc/activemq.xml", getConfigFile("/etc/activemq.xml"))
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 4
Source File: RestCollectorTest.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.features("mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features", "http")
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 5
Source File: SoapCollectorTest.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.features("mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features", "http")
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 6
Source File: WebsocketAppenderTest.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.features("mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features", "http", "jetty")
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 7
Source File: RestAppenderTest.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
    Option[] options = new Option[]{
            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "decanter.version", System.getProperty("decanter.version")),
            KarafDistributionOption.features("mvn:org.apache.karaf.features/standard/" + karafVersion + "/xml/features", "http")
    };
    return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
}
 
Example 8
Source File: ItUtils.java    From roboconf-platform with Apache License 2.0 4 votes vote down vote up
/**
 * @return the Roboconf version (found in the manifest of roboconf-core)
 */
public static String findRoboconfVersion() {
	return MavenUtils.getArtifactVersion( "net.roboconf", "roboconf-core" );
}
 
Example 9
Source File: CXFOSGiTestSupport.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
     * Create an {@link org.ops4j.pax.exam.Option} for using a .
     *
     * @return
     */
    protected Option[] cxfBaseConfig() {
        cxfUrl = maven().groupId("org.apache.cxf.karaf").artifactId("apache-cxf").versionAsInProject()
            .type("xml").classifier("features");

        String localRepo = System.getProperty("localRepository");
        Object urp = System.getProperty("cxf.useRandomFirstPort");

        final Option[] basicOptions = new Option[] {
            karafDistributionConfiguration()
                .frameworkUrl(
                    maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject()
                        .type("tar.gz"))
                .useDeployFolder(false)
                .unpackDirectory(new File("target/paxexam/")),
            //DO NOT COMMIT WITH THIS LINE ENABLED!!!
            //KarafDistributionOption.keepRuntimeFolder(),
            //debugConfiguration(), // nor this
            systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
            systemProperty("java.awt.headless").value("true"),
//            editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
//                "org.ops4j.pax.url.mvn.repositories", REPOS),
            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
            when(localRepo != null)
                .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
                                                     "org.ops4j.pax.url.mvn.localRepository",
                                                     localRepo)),
            when(urp != null).useOptions(systemProperty("cxf.useRandomFirstPort").value("true"))
        };
        if (JavaVersionUtil.getMajorVersion() >= 9) {
            final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf-minimal");
            return OptionUtils.combine(basicOptions,
                new VMOption("--add-reads=java.xml=java.logging"),
                new VMOption("--add-exports=java.base/"
                    + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                new VMOption("--patch-module"),
                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + karafVersion + ".jar"),
                new VMOption("--patch-module"),
                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + karafVersion + ".jar"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.security=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.net=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.lang=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.util=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                new VMOption("-classpath"),
                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
            );
        }
        return basicOptions;
    }
 
Example 10
Source File: BasicSTSIntegrationTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] getConfig() {
    final String port = TestUtil.getPortNumber(BasicSTSIntegrationTest.class);
    final String localRepository = System.getProperty("maven.repo.local", "");

    final Option[] basicOptions = new Option[] {
        karafDistributionConfiguration()
            .frameworkUrl(maven("org.apache.karaf", "apache-karaf-minimal").versionAsInProject().type("tar.gz"))
            .unpackDirectory(new File("target/paxexam/"))
            .useDeployFolder(false),
        configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
        systemProperty("java.awt.headless").value("true"),
        systemProperty("BasicSTSIntegrationTest.PORT").value(port),
        editConfigurationFilePut("etc/org.ops4j.pax.web.cfg",
                                "org.osgi.service.http.port", port),
        when(!localRepository.isEmpty())
            .useOptions(systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepository)),
        //DO NOT COMMIT WITH THIS LINE ENABLED!!!
        //KarafDistributionOption.keepRuntimeFolder(),
        //KarafDistributionOption.debugConfiguration(), // nor this
        //KarafDistributionOption.logLevel(LogLevelOption.LogLevel.INFO),

        features(
            maven("org.apache.cxf.karaf", "apache-cxf").versionAsInProject().type("xml").classifier("features"),
            "aries-blueprint", "cxf-jaxws", "cxf-sts"),
        mavenBundle("org.apache.cxf.services.sts.systests", "cxf-services-sts-systests-osgi").versionAsInProject(),
        copy("clientKeystore.properties"),
        copy("clientstore.jks")
    };
    if (JavaVersionUtil.getMajorVersion() >= 9) {
        final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf-minimal");
        return OptionUtils.combine(basicOptions,
            new VMOption("--add-reads=java.xml=java.logging"),
            new VMOption("--add-exports=java.base/"
                + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
            new VMOption("--patch-module"),
            new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + karafVersion + ".jar"),
            new VMOption("--patch-module"),
            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + karafVersion + ".jar"),
            new VMOption("--add-opens"),
            new VMOption("java.base/java.security=ALL-UNNAMED"),
            new VMOption("--add-opens"), new VMOption("java.base/java.net=ALL-UNNAMED"),
            new VMOption("--add-opens"), new VMOption("java.base/java.lang=ALL-UNNAMED"),
            new VMOption("--add-opens"), new VMOption("java.base/java.util=ALL-UNNAMED"),
            new VMOption("--add-opens"),
            new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
            new VMOption("--add-opens"),
            new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
            new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
            new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
            new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
            new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
            new VMOption("-classpath"),
            new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
        );
    }
    return basicOptions;
}
 
Example 11
Source File: BasicIntegrationTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Configuration
    public Option[] getConfig() {
        String port = TestUtil.getPortNumber(BasicIntegrationTest.class);
        System.setProperty("BasicIntegrationTest.PORT", port);
        String xkmsEndpoint = "http://localhost:" + port + "/cxf/XKMS";

        String localRepository = System.getProperty("localRepository");
        MavenArtifactUrlReference xkmsFeatures = maven() //
            .groupId("org.apache.cxf.services.xkms") //
            .artifactId("cxf-services-xkms-features") //
            .versionAsInProject() //
            .type("xml");

        final Option[] basicOptions = new Option[] {
             karafDistributionConfiguration()
                 .frameworkUrl(
                     maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject()
                         .type("tar.gz"))
                 .unpackDirectory(new File("target/paxexam/"))
                 .useDeployFolder(false),
             systemProperty("java.awt.headless").value("true"),
             systemProperty("BasicIntegrationTest.PORT").value(port),

             copy("data/xkms/certificates/trusted_cas/root.cer"),
             copy("data/xkms/certificates/trusted_cas/wss40CA.cer"),
             copy("data/xkms/certificates/cas/alice.cer"),
             copy("data/xkms/certificates/dave.cer"),
             copy("data/xkms/certificates/http___localhost_8080_services_TestService.cer"),
//             editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
//                 "org.ops4j.pax.url.mvn.repositories", REPOS),
             editConfigurationFilePut("etc/org.ops4j.pax.web.cfg",
                                      "org.osgi.service.http.port", port),
             editConfigurationFilePut("etc/org.apache.cxf.xkms.client.cfg",
                                      "xkms.endpoint", xkmsEndpoint),
             when(localRepository != null)
                 .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
                                                      "org.ops4j.pax.url.mvn.localRepository",
                                                      localRepository)),
             features(xkmsFeatures, "cxf-xkms-service", "cxf-xkms-client",
                      "cxf-xkms-ldap"),
             configureConsole().ignoreLocalConsole().ignoreRemoteShell(),

            // org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder(),
            // CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
        };
        if (JavaVersionUtil.getMajorVersion() >= 9) {
            final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf-minimal");
            return OptionUtils.combine(basicOptions,
                new VMOption("--add-reads=java.xml=java.logging"),
                new VMOption("--add-exports=java.base/"
                    + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                new VMOption("--patch-module"),
                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + karafVersion + ".jar"),
                new VMOption("--patch-module"),
                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + karafVersion + ".jar"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.security=ALL-UNNAMED"),
                new VMOption("--add-opens"), new VMOption("java.base/java.net=ALL-UNNAMED"),
                new VMOption("--add-opens"), new VMOption("java.base/java.lang=ALL-UNNAMED"),
                new VMOption("--add-opens"), new VMOption("java.base/java.util=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                new VMOption("-classpath"),
                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
            );
        }
        return basicOptions;
    }