org.ops4j.pax.exam.MavenUtils Java Examples
The following examples show how to use
org.ops4j.pax.exam.MavenUtils.
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 |
@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 |
@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 |
@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: AbstractKarafIntegrationTest.java From jbpm-work-items with Apache License 2.0 | 5 votes |
protected static String getKarafVersion() { String karafVersion = System.getProperty(PROP_KARAF_VERSION); if (karafVersion == null) { if (System.getProperty(PROP_KARAF_DISTRIBUTION_FILE) != null) { throw new RuntimeException("When you are running against custom container " + "it is necessary to define Karaf version by defining system property karaf.version."); } // set the Karaf version defined by Maven MavenUrlReference.VersionResolver versionResolver = MavenUtils.asInProject(); karafVersion = versionResolver.getVersion(KARAF_GROUP_ID, KARAF_ARTIFACT_ID); } return karafVersion; }
Example #5
Source File: KarafTestSupport.java From mobi with GNU Affero General Public License v3.0 | 5 votes |
@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 #6
Source File: RestCollectorTest.java From karaf-decanter with Apache License 2.0 | 5 votes |
@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 #7
Source File: SoapCollectorTest.java From karaf-decanter with Apache License 2.0 | 5 votes |
@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: WebsocketAppenderTest.java From karaf-decanter with Apache License 2.0 | 5 votes |
@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 #9
Source File: RestAppenderTest.java From karaf-decanter with Apache License 2.0 | 5 votes |
@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 #10
Source File: NexusPaxExamSupport.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
/** * @return Pax-Exam option to change the Nexus edition based on groupId and artifactId */ public static Option nexusEdition(final String groupId, final String artifactId) { return nexusEdition(maven(groupId, artifactId).versionAsInProject().classifier("features").type("xml"), artifactId + '/' + MavenUtils.getArtifactVersion(groupId, artifactId)); }
Example #11
Source File: NexusPaxExamSupport.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
/** * @return Pax-Exam option to install a Nexus plugin based on groupId and artifactId */ public static Option nexusFeature(final String groupId, final String artifactId) { return nexusFeature(maven(groupId, artifactId).versionAsInProject().classifier("features").type("xml"), artifactId + '/' + MavenUtils.getArtifactVersion(groupId, artifactId)); }
Example #12
Source File: ItUtils.java From roboconf-platform with Apache License 2.0 | 4 votes |
/** * @return the Roboconf version (found in the manifest of roboconf-core) */ public static String findRoboconfVersion() { return MavenUtils.getArtifactVersion( "net.roboconf", "roboconf-core" ); }
Example #13
Source File: CXFOSGiTestSupport.java From cxf with Apache License 2.0 | 4 votes |
/** * 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 #14
Source File: BasicSTSIntegrationTest.java From cxf with Apache License 2.0 | 4 votes |
@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 #15
Source File: BasicIntegrationTest.java From cxf with Apache License 2.0 | 4 votes |
@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; }