This is an automated email from the ASF dual-hosted git repository. reta pushed a commit to branch 3.4.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 6565ebeeb02ba9f0c0ad96a76bd5b013ec9e90ca Author: Andriy Redko <[email protected]> AuthorDate: Thu Jun 30 07:51:01 2022 -0400 CXF-8730: Fix org.apache.cxf.osgi.itests.jaxrs.JaxRsServiceTest (#967) (cherry picked from commit 5ee153623cad891671e8e14f674441daf8f4538b) (cherry picked from commit 400ce2dfbe7db1e632feedde08d0a2c52b55f638) --- .../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 a1d38f4817..b7508324c3 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"), // TODO: remove it when 5.16.1 is released, https://issues.apache.org/jira/browse/AMQ-8009 features(maven().groupId("org.apache.karaf.features").artifactId("spring-legacy").versionAsInProject()
