This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch 22874 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 92321e5e3f9920b64cc1bcdf711fdd7331badcb8 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Feb 6 11:35:05 2026 +0100 CAMEL-22874: Added unit test --- .../vertx/RestOpenApiOnExceptionIssueTest.java | 81 ++++++++++++++++++++++ components/pom.xml | 4 +- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java new file mode 100644 index 000000000000..d306338835b2 --- /dev/null +++ b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.platform.http.vertx; + +import io.restassured.RestAssured; +import org.apache.camel.CamelContext; +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.impl.DefaultCamelContext; +import org.apache.camel.test.AvailablePortFinder; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; + +@Disabled("CAMEL-22874") +public class RestOpenApiOnExceptionIssueTest extends CamelTestSupport { + + @Test + public void testOnException() throws Exception { + getMockEndpoint("mock:error").expectedMessageCount(1); + + given() + .when() + .get("/api/v3/pet/1") + .then() + .statusCode(500); + + MockEndpoint.assertIsSatisfied(context); + } + + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + onException(Exception.class) + .log("Error processing request: ${exception.message}") + .to("mock:error") + .handled(false); + + rest().openApi().specification("openapi-v3.json").missingOperation("ignore"); + + from("direct:getPetById").routeId("directRoute") + .process(e -> { + throw new RuntimeException("Simulated error get pet"); + }); + } + }; + } + + @Override + public CamelContext createCamelContext() throws Exception { + int port = AvailablePortFinder.getNextAvailable(); + VertxPlatformHttpServerConfiguration conf = new VertxPlatformHttpServerConfiguration(); + conf.setBindPort(port); + + RestAssured.port = port; + + CamelContext context = new DefaultCamelContext(); + context.addService(new VertxPlatformHttpServer(conf)); + return context; + } + +} diff --git a/components/pom.xml b/components/pom.xml index 772588193e3e..ab17b10a9705 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -114,8 +114,8 @@ <module>camel-crypto</module> <module>camel-crypto-pgp</module> <module>camel-csimple-joor</module> - <module>camel-csv</module> - <module>camel-cyberark-vault</module> + <module>camel-csv</module> + <module>camel-cyberark-vault</module> <module>camel-dapr</module> <module>camel-datasonnet</module> <module>camel-debug</module>
