org.ops4j.pax.exam.options.MavenArtifactUrlReference Java Examples

The following examples show how to use org.ops4j.pax.exam.options.MavenArtifactUrlReference. 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: KarafFullFeatureIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 6 votes vote down vote up
@Configuration
public Option[] config() {
  MavenArtifactUrlReference karafUrl =
    maven()
      .groupId("org.apache.karaf")
      .artifactId("apache-karaf")
      .type("zip")
      .versionAsInProject();
  return new Option[] {
      karafDistributionConfiguration().frameworkUrl(karafUrl)
        .unpackDirectory(new File("target/exam")),
      // We use this option to allow the container to use artifacts found in private / local repo.
      editConfigurationFileExtend("etc/org.ops4j.pax.url.mvn.cfg",
        "org.ops4j.pax.url.mvn.repositories",
        "file:${maven.repo.local}@id=mavenlocalrepo@snapshots"),
      editConfigurationFileExtend("etc/org.ops4j.pax.url.mvn.cfg",
        "org.ops4j.pax.url.mvn.localRepository",
        "${maven.repo.local}"),
      editConfigurationFileExtend("etc/system.properties",
        "maven.repo.local",
        System.getProperty("maven.repo.local", "")), keepRuntimeFolder(),
      features(new File("target/classes/features.xml").toURI().toString(),
        "camunda-bpm-karaf-feature-full") };
}
 
Example #2
Source File: KarafTestSupport.java    From mobi with GNU Affero General Public License v3.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException, URISyntaxException {
    MavenArtifactUrlReference karafUrl = CoreOptions.maven()
            .groupId("com.mobi")
            .artifactId("mobi-distribution")
            .version(MavenUtils.getArtifactVersion("com.mobi", "mobi-distribution"))
            .type("tar.gz");

    List<Option> options = new ArrayList<>(Arrays.asList(
            KarafDistributionOption.karafDistributionConfiguration()
                    .frameworkUrl(karafUrl)
                    .unpackDirectory(new File("target/exam"))
                    .useDeployFolder(false),
            KarafDistributionOption.keepRuntimeFolder(),
            KarafDistributionOption.logLevel(LogLevel.INFO),
            KarafDistributionOption.replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", getFileResource("/etc/org.ops4j.pax.logging.cfg")),
            KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port.secure", HTTPS_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", RMI_REG_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", SSH_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", RMI_SERVER_PORT),
            CoreOptions.mavenBundle()
                    .groupId("com.mobi")
                    .artifactId("itests-support")
                    .version(MavenUtils.getArtifactVersion("com.mobi", "itests-support"))
    ));

    Files.list(getFileResource("/etc").toPath()).forEach(path ->
            options.add(KarafDistributionOption.replaceConfigurationFile("etc/" + path.getFileName(), path.toFile())));

    return options.toArray(new Option[options.size()]);
}
 
Example #3
Source File: KarafMinimalFeatureIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
  MavenArtifactUrlReference karafUrl =
    maven()
      .groupId("org.apache.karaf")
      .artifactId("apache-karaf")
      .type("zip")
      .versionAsInProject();
  return new Option[] {
      // logLevel(LogLevel.TRACE),
      // debugConfiguration("5005", true),
      karafDistributionConfiguration().frameworkUrl(karafUrl)
        .unpackDirectory(new File("target/exam"))
      // .useDeployFolder(false)
      ,
      // We use this option to allow the container to use artifacts found in private / local repo.
      editConfigurationFileExtend("etc/org.ops4j.pax.url.mvn.cfg",
        "org.ops4j.pax.url.mvn.repositories",
        "file:${maven.repo.local}@id=mavenlocalrepo@snapshots"),
      editConfigurationFileExtend("etc/org.ops4j.pax.url.mvn.cfg",
        "org.ops4j.pax.url.mvn.localRepository",
        "${maven.repo.local}"),
      editConfigurationFileExtend("etc/system.properties",
        "maven.repo.local",
        System.getProperty("maven.repo.local", "")), keepRuntimeFolder(),
      features(new File("target/classes/features.xml").toURI().toString(),
        "camunda-bpm-karaf-feature-minimal")
  };
}
 
Example #4
Source File: ServiceTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() throws URISyntaxException, MalformedURLException {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) { 
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            keepRuntimeFolder(),
                            logLevel(LogLevelOption.LogLevel.INFO),
                            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-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".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/*")
                        };
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            keepRuntimeFolder(),
            logLevel(LogLevelOption.LogLevel.INFO)
        };
    }
}
 
Example #5
Source File: FeatureInstallationTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) {
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            keepRuntimeFolder(),
                            editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml")),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            logLevel(LogLevelOption.LogLevel.INFO),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-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".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/*")
                        };
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            keepRuntimeFolder(),
            editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml")),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            logLevel(LogLevelOption.LogLevel.INFO),
        };
    }
}
 
Example #6
Source File: PropertiesOverrideTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() throws URISyntaxException, MalformedURLException {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) {
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            features(getFeaturesFile().toURI().toURL().toString(), "scr", "openshift-client"),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            keepRuntimeFolder(),
                            systemProperty("kubernetes.namespace").value("my-namespace"),
                            systemProperty("kubernetes.master").value("http://my.kube.master:8443"),
                            systemProperty("kubernetes.auth.tryKubeConfig").value("false"),
                            logLevel(LogLevelOption.LogLevel.DEBUG),
                            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-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".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/*")
        };
        
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            features(getFeaturesFile().toURI().toURL().toString(), "scr", "openshift-client"),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            keepRuntimeFolder(),
            systemProperty("kubernetes.namespace").value("my-namespace"),
            systemProperty("kubernetes.master").value("http://my.kube.master:8443"),
            systemProperty("kubernetes.auth.tryKubeConfig").value("false"),
            logLevel(LogLevelOption.LogLevel.DEBUG),
        };
    }
}
 
Example #7
Source File: TestBase.java    From Karaf-Cassandra with Apache License 2.0 4 votes vote down vote up
private MavenArtifactUrlReference mvnKarafDist() {
    return maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").version(asInProject());
}
 
Example #8
Source File: CopyOSGiLibBundleOption.java    From carbon-kernel with Apache License 2.0 4 votes vote down vote up
public CopyOSGiLibBundleOption(MavenArtifactUrlReference mavenArtifactUrlReference) {
    this.mavenArtifactUrlReference = mavenArtifactUrlReference;
}
 
Example #9
Source File: CopyOSGiLibBundleOption.java    From carbon-kernel with Apache License 2.0 4 votes vote down vote up
public MavenArtifactUrlReference getMavenArtifactUrlReference() {
    return mavenArtifactUrlReference;
}
 
Example #10
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;
    }
 
Example #11
Source File: CarbonDistributionOption.java    From carbon-kernel with Apache License 2.0 2 votes vote down vote up
/**
 * Copy a maven bundle to the OSGi-lib directory.
 *
 * @param mavenArtifactUrlReference maven reference of the artifact
 * @return carbon OSGi-lib bundle option
 */
public static Option copyOSGiLibBundle(MavenArtifactUrlReference mavenArtifactUrlReference) {
    return new CopyOSGiLibBundleOption(mavenArtifactUrlReference);
}