This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-4.18.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8a3db4790089a4474b8f19fbc598544c11095b71 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Mar 3 11:55:58 2026 +0100 CAMEL-23115 Keep base.path it present. Otherwise use context path. --- ...Test.java => RestApiOverrideBasePathJettyTest.java} | 18 +++++++++++------- .../jetty/rest/RestApiOverrideHostJettyTest.java | 8 ++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java similarity index 80% copy from components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java copy to components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java index 773f1b45d5b7..9c76d7456d10 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java @@ -19,14 +19,14 @@ package org.apache.camel.component.jetty.rest; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jetty.BaseJettyTest; import org.apache.camel.model.rest.RestParamType; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -@Disabled("Does not run well on CI due test uses JMX mbeans") -public class RestApiOverrideHostJettyTest extends BaseJettyTest { +@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Flaky on Github CI due to use of JMX") +public class RestApiOverrideBasePathJettyTest extends BaseJettyTest { @Override protected boolean useJmx() { @@ -35,12 +35,13 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest { @Test public void testApi() { - String out = template.requestBody("jetty:http://localhost:{{port}}/api-doc", null, String.class); + String out = template.requestBody("http://localhost:{{port}}/myapp/api-doc", null, String.class); assertNotNull(out); + System.out.println(out); assertTrue(out.contains("\"version\" : \"1.2.3\"")); assertTrue(out.contains("\"title\" : \"The hello rest thing\"")); - assertTrue(out.contains("\"host\" : \"mycoolserver/myapi\"")); + assertTrue(out.contains("\"url\" : \"http://localhost:" + getPort() + "/cheese\"")); assertTrue(out.contains("\"/hello/bye/{name}\"")); assertTrue(out.contains("\"/hello/hi/{name}\"")); assertTrue(out.contains("\"summary\" : \"To update the greeting message\"")); @@ -51,8 +52,11 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest { return new RouteBuilder() { @Override public void configure() { - restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc") - .apiHost("mycoolserver/myapi").apiProperty("cors", "true") + restConfiguration().component("jetty").host("localhost").port(getPort()) + .contextPath("myapp") + .apiContextPath("/api-doc") + .apiProperty("base.path", "cheese") + .apiProperty("cors", "true") .apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3"); rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}") diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java index 773f1b45d5b7..685ed6c2b32e 100644 --- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java +++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java @@ -19,13 +19,13 @@ package org.apache.camel.component.jetty.rest; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jetty.BaseJettyTest; import org.apache.camel.model.rest.RestParamType; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -@Disabled("Does not run well on CI due test uses JMX mbeans") +@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Flaky on Github CI due to use of JMX") public class RestApiOverrideHostJettyTest extends BaseJettyTest { @Override @@ -35,12 +35,12 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest { @Test public void testApi() { - String out = template.requestBody("jetty:http://localhost:{{port}}/api-doc", null, String.class); + String out = template.requestBody("http://localhost:{{port}}/api-doc", null, String.class); assertNotNull(out); assertTrue(out.contains("\"version\" : \"1.2.3\"")); assertTrue(out.contains("\"title\" : \"The hello rest thing\"")); - assertTrue(out.contains("\"host\" : \"mycoolserver/myapi\"")); + assertTrue(out.contains("\"url\" : \"http://mycoolserver/myapi\"")); assertTrue(out.contains("\"/hello/bye/{name}\"")); assertTrue(out.contains("\"/hello/hi/{name}\"")); assertTrue(out.contains("\"summary\" : \"To update the greeting message\""));
