You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/06/30 11:51:07 UTC
[cxf] branch 3.6.x-fixes updated: CXF-8730: Fix org.apache.cxf.osgi.itests.jaxrs.JaxRsServiceTest (#967)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.6.x-fixes by this push:
new 5ee153623c CXF-8730: Fix org.apache.cxf.osgi.itests.jaxrs.JaxRsServiceTest (#967)
5ee153623c is described below
commit 5ee153623cad891671e8e14f674441daf8f4538b
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Jun 30 07:51:01 2022 -0400
CXF-8730: Fix org.apache.cxf.osgi.itests.jaxrs.JaxRsServiceTest (#967)
---
.../org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java | 1 +
.../test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java | 9 ++++++---
.../java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java | 4 ++--
.../java/org/apache/cxf/osgi/itests/soap/HttpServiceTest.java | 2 +-
.../java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java | 1 +
5 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
index b1ed1c991d..479397150e 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
@@ -54,6 +54,7 @@ public class BundlesAndNamespacesTest extends CXFOSGiTestSupport {
public Option[] config() {
return OptionUtils.combine(
cxfBaseConfig(),
+ testUtils(),
features(cxfUrl, "aries-blueprint", "cxf-core", "cxf-jaxws"),
logLevel(LogLevel.INFO)
);
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
index 3d0db64178..07de4532fe 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
@@ -24,6 +24,7 @@ import java.io.File;
import javax.inject.Inject;
+import org.apache.cxf.testutil.common.TestUtil;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
@@ -48,12 +49,14 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDist
/**
*
*/
-public class CXFOSGiTestSupport {
+public abstract class CXFOSGiTestSupport {
// Adding apache snapshots as cxf trunk may contain snapshot dependencies
// private static final String REPOS = "https://repo1.maven.org/maven2@id=central,"
// + "https://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases";
+ protected static final String PORT = TestUtil.getPortNumber("osgi-itests");
+
@Inject
protected BundleContext bundleContext;
@@ -69,7 +72,6 @@ public class CXFOSGiTestSupport {
.type("xml").classifier("features");
String localRepo = System.getProperty("localRepository");
- Object urp = System.getProperty("cxf.useRandomFirstPort");
final Option[] basicOptions = new Option[] {
karafDistributionConfiguration()
@@ -90,7 +92,8 @@ public class CXFOSGiTestSupport {
.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"))
+ systemProperty("testutil.ports.osgi-itests").value(PORT),
+ editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", PORT)
};
if (JavaVersionUtil.getMajorVersion() >= 9) {
final String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf-minimal");
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
index 8ef4fae3dc..0b749c77dd 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
@@ -53,7 +53,7 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
@ExamReactorStrategy(PerClass.class)
public class JaxRsServiceTest extends CXFOSGiTestSupport {
- private static final String BASE_URL = "http://localhost:8181/cxf/jaxrs/bookstore";
+ private static final String BASE_URL = "http://localhost:" + PORT + "/cxf/jaxrs/bookstore";
private final WebTarget wt = ClientBuilder.newClient().target(BASE_URL);
@@ -109,6 +109,7 @@ public class JaxRsServiceTest extends CXFOSGiTestSupport {
cxfBaseConfig(),
features(cxfUrl, "cxf-core", "cxf-wsdl", "cxf-jaxrs", "cxf-bean-validation-core", "cxf-bean-validation"),
logLevel(LogLevel.INFO),
+ testUtils(),
provision(serviceBundle())
);
}
@@ -133,5 +134,4 @@ public class JaxRsServiceTest extends CXFOSGiTestSupport {
.build(TinyBundles.withBnd());
}
}
-
}
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/HttpServiceTest.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/HttpServiceTest.java
index 3467daaf8f..871d828597 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/HttpServiceTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/HttpServiceTest.java
@@ -48,7 +48,7 @@ public class HttpServiceTest extends CXFOSGiTestSupport {
@Test
public void testHttpEndpoint() throws Exception {
- Greeter greeter = greeterHttpProxy("8181");
+ Greeter greeter = greeterHttpProxy(PORT);
String res = greeter.greetMe("Chris");
assertEquals("Hi Chris", res);
}
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
index 0127f37d02..3f13e380ce 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
@@ -77,6 +77,7 @@ public class JmsServiceTest extends CXFOSGiTestSupport {
public Option[] config() {
return OptionUtils.combine(
cxfBaseConfig(),
+ testUtils(),
features(cxfUrl, "cxf-jaxws", "cxf-transports-jms"),
features(maven().groupId("org.apache.activemq").artifactId("activemq-karaf").versionAsInProject()
.type("xml").classifier("features-core"),