Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions osgi/itests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,46 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-testutils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-jms</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>

<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<version>${cxf.karaf.version}</version>
<scope>test</scope>
<type>tar.gz</type>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- Karaf features -->
<dependency>
<groupId>org.apache.cxf.karaf</groupId>
Expand Down Expand Up @@ -173,20 +181,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</dependency>

<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<version>${cxf.karaf.version}</version>
<type>tar.gz</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -209,7 +203,6 @@
<configuration>
<systemPropertyVariables>
<org.ops4j.pax.logging.DefaultServiceLog.level>WARN</org.ops4j.pax.logging.DefaultServiceLog.level>
<karaf.version>${cxf.karaf.version}</karaf.version>
<localRepository>${maven.repo.local}</localRepository>
</systemPropertyVariables>
<reuseForks>true</reuseForks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
Expand Down Expand Up @@ -51,9 +52,10 @@ public void test() throws Exception {

@Configuration
public Option[] config() {
return new Option[]{
cxfBaseConfig(),
features(cxfUrl, "aries-blueprint", "cxf-core", "cxf-jaxws"),
logLevel(LogLevel.INFO)};
return OptionUtils.combine(
cxfBaseConfig(),
features(cxfUrl, "aries-blueprint", "cxf-core", "cxf-jaxws"),
logLevel(LogLevel.INFO)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.cxf.osgi.itests;



import java.io.File;

import javax.inject.Inject;
Expand All @@ -31,17 +30,18 @@

import org.ops4j.pax.exam.MavenUtils;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.options.extra.VMOption;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.when;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;

Expand All @@ -51,104 +51,81 @@
public class CXFOSGiTestSupport {

// Adding apache snapshots as cxf trunk may contain snapshot dependencies
// https://blog.sonatype.com/central-repository-moving-to-https
private static final String REPOS = "https://repo1.maven.org/maven2@id=central,"
+ "http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases";
// private static final String REPOS = "https://repo1.maven.org/maven2@id=central,"
// + "https://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases";

@Inject
protected BundleContext bundleContext;

protected MavenUrlReference cxfUrl;
protected MavenUrlReference amqUrl;
protected MavenUrlReference springLegacyUrl;

private static String getKarafVersion() {
return MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
}

/**
* Create an {@link org.ops4j.pax.exam.Option} for using a .
*
* @return
*/
protected Option cxfBaseConfig() {
final String karafVersion = getKarafVersion();
final MavenUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf")
.version(karafVersion).type("tar.gz");
protected Option[] cxfBaseConfig() {
cxfUrl = maven().groupId("org.apache.cxf.karaf").artifactId("apache-cxf").versionAsInProject()
.type("xml").classifier("features");
amqUrl = maven().groupId("org.apache.activemq")
.artifactId("activemq-karaf").type("xml").classifier("features").versionAsInProject();
springLegacyUrl = maven().groupId("org.apache.karaf.features").artifactId("spring-legacy")
.version(karafVersion).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").versionAsInProject().type("tar.gz"))
.name("Apache Karaf")
.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) {
return composite(karafDistributionConfiguration()
.frameworkUrl(karafUrl)
.karafVersion(karafVersion)
.name("Apache Karaf")
.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),
when(localRepo != null)
.useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
"org.ops4j.pax.url.mvn.localRepository",
localRepo)),
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/*"),
when(urp != null).useOptions(systemProperty("cxf.useRandomFirstPort").value("true")));
} else {
return composite(karafDistributionConfiguration()
.frameworkUrl(karafUrl)
.karafVersion(karafVersion)
.name("Apache Karaf")
.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),
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")));
final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
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;
}

protected static Option testUtils() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
Expand Down Expand Up @@ -104,12 +105,12 @@ private static void assertStatus(Status expectedStatus, Response response) {

@Configuration
public Option[] config() {
return new Option[] {
return OptionUtils.combine(
cxfBaseConfig(),
features(cxfUrl, "cxf-core", "cxf-wsdl", "cxf-jaxrs", "cxf-bean-validation-core", "cxf-bean-validation"),
logLevel(LogLevel.INFO),
provision(serviceBundle())
};
);
}

private static InputStream serviceBundle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
Expand Down Expand Up @@ -68,13 +69,13 @@ private Greeter greeterHttpProxy(String port) {

@Configuration
public Option[] config() {
return new Option[] {
return OptionUtils.combine(
cxfBaseConfig(),
features(cxfUrl, "cxf-jaxws", "cxf-http-jetty"),
testUtils(),
logLevel(LogLevel.INFO),
provision(serviceBundle())
};
);
}

private static InputStream serviceBundle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
Expand Down Expand Up @@ -73,13 +74,12 @@ private static ActiveMQConnectionFactory createConnectionFactory() {

@Configuration
public Option[] config() {
return new Option[] {
return OptionUtils.combine(
cxfBaseConfig(),
features(cxfUrl, "cxf-core", "cxf-jaxws", "cxf-transports-jms"),
features(springLegacyUrl, "spring/4.3.18.RELEASE_1"),
features(amqUrl, "shell-compat", "activemq-broker-noweb"),
provision(serviceBundle())
};
);
}

private static InputStream serviceBundle() {
Expand Down
2 changes: 1 addition & 1 deletion parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<cxf.jaxb.bundle.version>2.3.1_1</cxf.jaxb.bundle.version>
<cxf.jaxb.context.class.property>none</cxf.jaxb.context.class.property>
<cxf.jdom.bundle.version>1.1_4</cxf.jdom.bundle.version>
<cxf.karaf.version>4.2.7</cxf.karaf.version>
<cxf.karaf.version>4.2.8</cxf.karaf.version>
<cxf.oauth.bundle.version>20100527_1</cxf.oauth.bundle.version>
<cxf.oro.bundle.version>2.0.8_6</cxf.oro.bundle.version>
<cxf.osgi.saaj.version>[1.4,2)</cxf.osgi.saaj.version>
Expand Down
Loading