This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 28b76119ba9623b9b0a8d6572d0626a0fb63d237 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Wed Feb 9 11:13:37 2022 +0000 Upgrade Camel to 3.16.0 --- docs/antora.yml | 6 +- .../ROOT/pages/reference/extensions/yaml-dsl.adoc | 6 -- .../pages/user-guide/defining-camel-routes.adoc | 6 +- .../deployment/MicroProfileHealthProcessor.java | 5 -- .../MicroProfileHealthCamelChecksDisabledTest.java | 6 +- extensions/openapi-java/deployment/pom.xml | 5 ++ .../openapi/java/deployment/RESTOpenAPITest.java | 4 +- .../openapi/java/deployment/RestRoutes.java | 7 +- .../src/test/resources/application.properties | 2 +- .../resources/routes/{my-route.xml => rests.xml} | 4 +- .../resources/routes/{my-route.xml => routes.xml} | 16 ++-- .../src/main/resources/application.properties | 2 +- .../component/stream/it/StreamResource.java | 2 +- .../quarkus/component/stream/it/StreamTest.java | 2 +- integration-tests/google-storage/pom.xml | 5 ++ .../storage/it/GoogleStorageTestResource.java | 13 +-- .../quarkus/component/kafka/CamelKafkaRoutes.java | 2 +- .../src/main/resources/rests/my-rests.xml | 8 +- .../src/main/resources/routes/my-routes.xml | 7 ++ .../src/main/resources/rests/my-rests.xml | 8 +- .../src/main/resources/routes/my-routes.xml | 7 ++ .../camel/quarkus/main/CoreMainXmlJaxbTest.java | 2 +- .../src/main/resources/routes/my-rests.yaml | 6 +- .../it/health/CustomHealthCheckRepository.java | 17 ---- .../microprofile/it/health/FailingHealthCheck.java | 2 +- .../it/health/FailureThresholdHealthCheck.java | 51 ------------ .../it/health/MicroProfileHealthResource.java | 17 +--- .../src/main/resources/application.properties | 7 +- .../it/health/MicroProfileHealthTest.java | 67 ---------------- .../component/openapijava/it/OpenApiRoutes.java | 44 ++++------ .../openapijava/it/common/OpenApiTest.java | 4 +- integration-tests/platform-http/pom.xml | 17 ++++ .../platform/http/it/PlatformHttpRouteBuilder.java | 18 ++--- .../component/http/server/it/PlatformHttpTest.java | 4 +- integration-tests/rest/pom.xml | 17 ++++ .../quarkus/component/rest/it/RestRoutes.java | 93 +++++++++++----------- integration-tests/servlet/pom.xml | 21 ++++- .../quarkus/component/servlet/CamelRoute.java | 19 +++-- pom.xml | 6 +- 39 files changed, 215 insertions(+), 320 deletions(-) diff --git a/docs/antora.yml b/docs/antora.yml index bf9badc..3995ae4 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -29,11 +29,11 @@ asciidoc: min-maven-version: 3.8.1 # replace ${min-maven-version} target-maven-version: 3.8.4 # replace ${target-maven-version} - camel-version: 3.15.0 # replace ${camel.version} - camel-docs-version: 3.15.x # replace ${camel.docs.components.version} + camel-version: 3.16.0-SNAPSHOT # replace ${camel.version} + camel-docs-version: 3.16.x # replace ${camel.docs.components.version} quarkus-version: 2.7.3.Final # replace ${quarkus.version} graalvm-version: 21.3.1 # replace ${graalvm.version} graalvm-docs-version: 21.3 # attributes used in xrefs to other Antora components - cq-camel-components: 3.15.x@components # replace ${camel.docs.components.xref} + cq-camel-components: 3.16.x@components # replace ${camel.docs.components.xref} quarkus-examples-version: latest diff --git a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc index bdde5d3..26484a9 100644 --- a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc @@ -16,12 +16,6 @@ An YAML stack for parsing YAML route definitions -== What's inside - -* xref:{cq-camel-components}:others:yaml-dsl.adoc[YAML DSL] - -Please refer to the above link for usage and configuration details. - == Maven coordinates https://code.quarkus.io/?extension-search=camel-quarkus-yaml-dsl[Create a new project with this extension on code.quarkus.io, window="_blank"] diff --git a/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc b/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc index 9ae1eaa..fc5b912 100644 --- a/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc +++ b/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc @@ -96,10 +96,8 @@ The route XML should be in the simplified version like: ---- <rests xmlns="http://camel.apache.org/schema/spring"> <rest id="greeting" path="/greeting"> - <get uri="/hello"> - <setBody> - <constant>Hello World!</constant> - </setBody> + <get path="/hello"> + <to uri="direct:greet"/> </get> </rest> </rests> diff --git a/extensions/microprofile-health/deployment/src/main/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthProcessor.java b/extensions/microprofile-health/deployment/src/main/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthProcessor.java index 6ea3406..e5a3b9e 100644 --- a/extensions/microprofile-health/deployment/src/main/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthProcessor.java +++ b/extensions/microprofile-health/deployment/src/main/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthProcessor.java @@ -32,7 +32,6 @@ import org.apache.camel.health.HealthCheck; import org.apache.camel.health.HealthCheckRegistry; import org.apache.camel.health.HealthCheckRepository; import org.apache.camel.impl.health.ConsumersHealthCheckRepository; -import org.apache.camel.impl.health.ContextHealthCheck; import org.apache.camel.impl.health.HealthCheckRegistryRepository; import org.apache.camel.impl.health.RoutesHealthCheckRepository; import org.apache.camel.quarkus.component.microprofile.health.runtime.CamelMicroProfileHealthConfig; @@ -118,10 +117,6 @@ class MicroProfileHealthProcessor { return false; } - if (className.equals(ContextHealthCheck.class.getName())) { - return config.getOptionalValue("camel.health.contextEnabled", boolean.class).orElse(true); - } - if (className.equals(RoutesHealthCheckRepository.class.getName())) { return config.getOptionalValue("camel.health.routesEnabled", boolean.class).orElse(true); } diff --git a/extensions/microprofile-health/deployment/src/test/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthCamelChecksDisabledTest.java b/extensions/microprofile-health/deployment/src/test/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthCamelChecksDisabledTest.java index 16e194a5..3e8b6df 100644 --- a/extensions/microprofile-health/deployment/src/test/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthCamelChecksDisabledTest.java +++ b/extensions/microprofile-health/deployment/src/test/java/org/apache/camel/quarkus/component/microprofile/health/deployment/MicroProfileHealthCamelChecksDisabledTest.java @@ -37,6 +37,7 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -54,7 +55,6 @@ public class MicroProfileHealthCamelChecksDisabledTest { Writer writer = new StringWriter(); Properties props = new Properties(); - props.put("camel.health.contextEnabled", "false"); props.put("camel.health.routesEnabled", "false"); props.put("camel.health.consumersEnabled", "false"); props.put("camel.health.registryEnabled", "false"); @@ -69,9 +69,9 @@ public class MicroProfileHealthCamelChecksDisabledTest { } @Test - public void contextHealthCheckNull() { + public void contextHealthCheckNotNull() { ContextHealthCheck contextHealthCheck = context.getRegistry().lookupByNameAndType("context", ContextHealthCheck.class); - assertNull(contextHealthCheck); + assertNotNull(contextHealthCheck); } @Test diff --git a/extensions/openapi-java/deployment/pom.xml b/extensions/openapi-java/deployment/pom.xml index 3ab740b..053ed8f 100644 --- a/extensions/openapi-java/deployment/pom.xml +++ b/extensions/openapi-java/deployment/pom.xml @@ -49,6 +49,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest</artifactId> <scope>test</scope> </dependency> diff --git a/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RESTOpenAPITest.java b/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RESTOpenAPITest.java index 7e75be4..0ee6b74 100644 --- a/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RESTOpenAPITest.java +++ b/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RESTOpenAPITest.java @@ -17,7 +17,6 @@ package org.apache.camel.quarkus.component.openapi.java.deployment; -import java.io.File; import java.util.Arrays; import io.quarkus.bootstrap.model.AppArtifact; @@ -41,7 +40,8 @@ public class RESTOpenAPITest { .withConfigurationResource("application.properties") .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) .addClasses(RestRoutes.class, QuarkusResource.class) - .addAsResource(new File("src/test/resources/routes/my-route.xml"), "routes/my-route.xml")); + .addAsResource("routes/rests.xml", "routes/rests.xml") + .addAsResource("routes/routes.xml", "routes/routes.xml")); @BeforeAll static void setUp() { diff --git a/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RestRoutes.java b/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RestRoutes.java index a2b1e91..358df70 100644 --- a/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RestRoutes.java +++ b/extensions/openapi-java/deployment/src/test/java/org/apache/camel/quarkus/component/openapi/java/deployment/RestRoutes.java @@ -29,8 +29,9 @@ public class RestRoutes extends RouteBuilder { .description("get test") .id("get") .produces("text/plain") - .route() - .setBody(constant("GET: /rest")) - .endRest(); + .to("direct:output"); + + from("direct:output") + .setBody().constant("GET: /rest"); } } diff --git a/extensions/openapi-java/deployment/src/test/resources/application.properties b/extensions/openapi-java/deployment/src/test/resources/application.properties index 685ea3f..a5d206d 100644 --- a/extensions/openapi-java/deployment/src/test/resources/application.properties +++ b/extensions/openapi-java/deployment/src/test/resources/application.properties @@ -23,4 +23,4 @@ quarkus.camel.openapi.expose.enabled=true # Camel - REST # camel.rest.context-path=/camel -camel.main.routes-include-pattern=routes/my-route.xml +camel.main.routes-include-pattern=routes/routes.xml,routes/rests.xml diff --git a/extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml b/extensions/openapi-java/deployment/src/test/resources/routes/rests.xml similarity index 86% copy from extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml copy to extensions/openapi-java/deployment/src/test/resources/routes/rests.xml index f809a04..8c2e3c1 100644 --- a/extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml +++ b/extensions/openapi-java/deployment/src/test/resources/routes/rests.xml @@ -16,10 +16,10 @@ limitations under the License. --> -<rests xmlns="http://camel.apache.org/schema/spring"> +<rests> <rest id="camel_xml_rest" path="/xml"> <get> - <route><transform><constant>Camel XML Rest</constant></transform></route> + <to uri="direct:outputXML" /> </get> </rest> </rests> diff --git a/extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml b/extensions/openapi-java/deployment/src/test/resources/routes/routes.xml similarity index 77% rename from extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml rename to extensions/openapi-java/deployment/src/test/resources/routes/routes.xml index f809a04..53cf194 100644 --- a/extensions/openapi-java/deployment/src/test/resources/routes/my-route.xml +++ b/extensions/openapi-java/deployment/src/test/resources/routes/routes.xml @@ -16,10 +16,12 @@ limitations under the License. --> -<rests xmlns="http://camel.apache.org/schema/spring"> - <rest id="camel_xml_rest" path="/xml"> - <get> - <route><transform><constant>Camel XML Rest</constant></transform></route> - </get> - </rest> -</rests> + +<routes xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:outputXML"/> + <setBody> + <constant>Camel XML Rest</constant> + </setBody> + </route> +</routes> diff --git a/integration-test-groups/foundation/core-fault-tolerance/src/main/resources/application.properties b/integration-test-groups/foundation/core-fault-tolerance/src/main/resources/application.properties index 82f317f..48c4c9b 100644 --- a/integration-test-groups/foundation/core-fault-tolerance/src/main/resources/application.properties +++ b/integration-test-groups/foundation/core-fault-tolerance/src/main/resources/application.properties @@ -17,7 +17,7 @@ # # Camel -camel.faulttolerance.circuitBreakerRef = customCircuitBreaker +camel.faulttolerance.circuitBreaker = customCircuitBreaker camel.faulttolerance.delay = 15 camel.faulttolerance.successThreshold = 4 camel.faulttolerance.requestVolumeThreshold = 60 diff --git a/integration-test-groups/foundation/stream/src/main/java/org/apache/camel/quarkus/component/stream/it/StreamResource.java b/integration-test-groups/foundation/stream/src/main/java/org/apache/camel/quarkus/component/stream/it/StreamResource.java index 24f6ea0..462bccc 100644 --- a/integration-test-groups/foundation/stream/src/main/java/org/apache/camel/quarkus/component/stream/it/StreamResource.java +++ b/integration-test-groups/foundation/stream/src/main/java/org/apache/camel/quarkus/component/stream/it/StreamResource.java @@ -42,7 +42,7 @@ public class StreamResource { public String greetingStream(String message) throws Exception { try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { producerTemplate.sendBodyAndHeader("stream:header", message.getBytes(), "stream", stream); - return "Hello " + stream.toString(); + return "Hello " + stream; } } } diff --git a/integration-test-groups/foundation/stream/src/test/java/org/apache/camel/quarkus/component/stream/it/StreamTest.java b/integration-test-groups/foundation/stream/src/test/java/org/apache/camel/quarkus/component/stream/it/StreamTest.java index 374c3c7..b8b1ab9 100644 --- a/integration-test-groups/foundation/stream/src/test/java/org/apache/camel/quarkus/component/stream/it/StreamTest.java +++ b/integration-test-groups/foundation/stream/src/test/java/org/apache/camel/quarkus/component/stream/it/StreamTest.java @@ -33,6 +33,6 @@ class StreamTest { .body("Camel Quarkus Stream") .post("/stream/post") .then().statusCode(200) - .body(is("Hello Camel Quarkus Stream")); + .body(is("Hello Camel Quarkus Stream" + System.lineSeparator())); } } diff --git a/integration-tests/google-storage/pom.xml b/integration-tests/google-storage/pom.xml index 383f1d0..7048f87 100644 --- a/integration-tests/google-storage/pom.xml +++ b/integration-tests/google-storage/pom.xml @@ -68,6 +68,11 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-test-support</artifactId> + <scope>test</scope> + </dependency> </dependencies> <profiles> diff --git a/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java index 92c6cf5..234da5c 100644 --- a/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java +++ b/integration-tests/google-storage/src/test/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageTestResource.java @@ -20,11 +20,13 @@ import java.util.HashMap; import java.util.Map; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.apache.camel.quarkus.test.AvailablePortFinder; +import org.testcontainers.containers.FixedHostPortGenericContainer; import org.testcontainers.containers.GenericContainer; public class GoogleStorageTestResource implements QuarkusTestResourceLifecycleManager { - public static final int PORT = 4443; + public static final int PORT = AvailablePortFinder.getNextAvailable(); public static final String CONTAINER_NAME = "fsouza/fake-gcs-server"; private GenericContainer<?> container; @@ -35,14 +37,13 @@ public class GoogleStorageTestResource implements QuarkusTestResourceLifecycleMa Map<String, String> properties = new HashMap<>(); if (GoogleStorageHelper.usingMockBackend()) { - - container = new GenericContainer<>(CONTAINER_NAME) - .withExposedPorts(PORT) + container = new FixedHostPortGenericContainer<>(CONTAINER_NAME) + .withFixedExposedPort(PORT, PORT) .withCreateContainerCmdModifier( - it -> it.withEntrypoint("/bin/fake-gcs-server", "-scheme", "http")); + it -> it.withEntrypoint("/bin/fake-gcs-server", "-scheme", "http", "-port", String.valueOf(PORT))); container.start(); - properties.put(GoogleStorageResource.PARAM_PORT, container.getMappedPort(PORT).toString()); + properties.put(GoogleStorageResource.PARAM_PORT, String.valueOf(PORT)); } return properties; diff --git a/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaRoutes.java b/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaRoutes.java index e460fbc..381d825 100644 --- a/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaRoutes.java +++ b/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaRoutes.java @@ -61,7 +61,7 @@ public class CamelKafkaRoutes extends RouteBuilder { from("direct:idempotent") .idempotentConsumer(header("id")) - .messageIdRepositoryRef("kafkaIdempotentRepository") + .idempotentRepository("kafkaIdempotentRepository") .to("mock:idempotent-results") .end(); diff --git a/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml b/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml index fcbd834..24f641f 100644 --- a/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml +++ b/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml @@ -19,12 +19,8 @@ --> <rests xmlns="http://camel.apache.org/schema/spring"> <rest id="greet" path="/greeting"> - <get uri="/hello"> - <route id="rest-route"> - <setBody> - <constant>Hello World!</constant> - </setBody> - </route> + <get path="/hello"> + <to uri="direct:greet"/> </get> </rest> </rests> diff --git a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml b/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml index 48feb17..c367467 100644 --- a/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml +++ b/integration-tests/main-xml-io/src/main/resources/routes/my-routes.xml @@ -24,6 +24,13 @@ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + <route id="rest-route"> + <from uri="direct:greet"/> + <setBody> + <constant>Hello World!</constant> + </setBody> + </route> + <route id="my-xml-route"> <from uri="timer:from-xml?period=3000"/> <setBody> diff --git a/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml index fcbd834..24f641f 100644 --- a/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml +++ b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml @@ -19,12 +19,8 @@ --> <rests xmlns="http://camel.apache.org/schema/spring"> <rest id="greet" path="/greeting"> - <get uri="/hello"> - <route id="rest-route"> - <setBody> - <constant>Hello World!</constant> - </setBody> - </route> + <get path="/hello"> + <to uri="direct:greet"/> </get> </rest> </rests> diff --git a/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml b/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml index e491c29..c3763c0 100644 --- a/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml +++ b/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml @@ -23,6 +23,13 @@ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + <route id="rest-route"> + <from uri="direct:greet"/> + <setBody> + <constant>Hello World!</constant> + </setBody> + </route> + <route id="my-xml-route"> <from uri="timer:from-xml?period=3000"/> <setBody> diff --git a/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java b/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java index 6fbbfdc..89170e5 100644 --- a/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java +++ b/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java @@ -80,7 +80,7 @@ public class CoreMainXmlJaxbTest { private boolean logContainsDumpedRoutes(String log) { return log.contains("<route customId=\"true\" id=\"my-xml-route\">") && - log.contains("<route customId=\"true\" id=\"rest-route\" rest=\"true\">") && + log.contains("<route customId=\"true\" id=\"rest-route\">") && log.contains("<rest customId=\"true\" id=\"greet\" path=\"/greeting\">") && log.contains("<routeTemplate customId=\"true\" id=\"myTemplate\">"); } diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml b/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml index fd1f1b6..b248831 100644 --- a/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml +++ b/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml @@ -16,10 +16,10 @@ # - rest: - path: "/greeting" - verb: - - method: "get" + get: + - path: "/greeting" to: "direct:rest" + - route: id: "rest-route" from: diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/CustomHealthCheckRepository.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/CustomHealthCheckRepository.java index c54665d..2d31330 100644 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/CustomHealthCheckRepository.java +++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/CustomHealthCheckRepository.java @@ -16,12 +16,10 @@ */ package org.apache.camel.quarkus.component.microprofile.it.health; -import java.util.Collections; import java.util.Map; import java.util.stream.Stream; import org.apache.camel.health.HealthCheck; -import org.apache.camel.health.HealthCheckConfiguration; import org.apache.camel.health.HealthCheckRepository; import org.apache.camel.health.HealthCheckResultBuilder; import org.apache.camel.impl.health.AbstractHealthCheck; @@ -44,21 +42,6 @@ public class CustomHealthCheckRepository implements HealthCheckRepository { } @Override - public void setConfigurations(Map<String, HealthCheckConfiguration> configurations) { - // Noop - } - - @Override - public Map<String, HealthCheckConfiguration> getConfigurations() { - return Collections.emptyMap(); - } - - @Override - public void addConfiguration(String id, HealthCheckConfiguration configuration) { - // Noop - } - - @Override public Stream<HealthCheck> stream() { return Stream.of(check); } diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailingHealthCheck.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailingHealthCheck.java index 2d56d54..b278052 100644 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailingHealthCheck.java +++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailingHealthCheck.java @@ -25,7 +25,7 @@ public class FailingHealthCheck extends AbstractHealthCheck { public FailingHealthCheck() { super("failing-check"); - getConfiguration().setEnabled(false); + setEnabled(false); } @Override diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailureThresholdHealthCheck.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailureThresholdHealthCheck.java deleted file mode 100644 index 6fbcb6e..0000000 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/FailureThresholdHealthCheck.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.quarkus.component.microprofile.it.health; - -import java.util.Map; - -import org.apache.camel.health.HealthCheckResultBuilder; -import org.apache.camel.impl.health.AbstractHealthCheck; - -public final class FailureThresholdHealthCheck extends AbstractHealthCheck { - - private boolean returnStatusUp = false; - - public FailureThresholdHealthCheck() { - super("failure-threshold", "failure-threshold"); - getConfiguration().setEnabled(false); - getConfiguration().setFailureThreshold(2); - getConfiguration().setInterval(500); - } - - @Override - protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) { - if (isReturnStatusUp()) { - builder.up(); - } else { - builder.down(); - } - } - - public void setReturnStatusUp(boolean returnStatusUp) { - this.returnStatusUp = returnStatusUp; - } - - public boolean isReturnStatusUp() { - return returnStatusUp; - } -} diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthResource.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthResource.java index f5392e6..1e2e297 100644 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthResource.java +++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthResource.java @@ -24,7 +24,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import org.apache.camel.CamelContext; -import org.apache.camel.health.HealthCheck; import org.apache.camel.health.HealthCheckRegistry; @Path("/microprofile-health") @@ -52,7 +51,7 @@ public class MicroProfileHealthResource { @QueryParam("healthCheckEnabled") boolean isHealthCheckEnabled) { HealthCheckRegistry registry = camelContext.getExtension(HealthCheckRegistry.class); registry.getCheck(healthCheckId).ifPresent(healthCheck -> { - healthCheck.getConfiguration().setEnabled(isHealthCheckEnabled); + healthCheck.setEnabled(isHealthCheckEnabled); if (isHealthCheckEnabled) { registry.register(healthCheck); } else { @@ -60,18 +59,4 @@ public class MicroProfileHealthResource { } }); } - - @Path("/{healthCheckId}/return/status") - @POST - public void modifyHealthCheckStatus( - @PathParam("healthCheckId") String healthCheckId, - @QueryParam("returnStatusUp") boolean isReturnStatusUp) { - HealthCheck healthCheck = camelContext - .getExtension(HealthCheckRegistry.class) - .getCheck(healthCheckId) - .get(); - - FailureThresholdHealthCheck failureThresholdHealthCheck = (FailureThresholdHealthCheck) healthCheck; - failureThresholdHealthCheck.setReturnStatusUp(isReturnStatusUp); - } } diff --git a/integration-tests/microprofile/src/main/resources/application.properties b/integration-tests/microprofile/src/main/resources/application.properties index 4537e97..9b94638 100644 --- a/integration-tests/microprofile/src/main/resources/application.properties +++ b/integration-tests/microprofile/src/main/resources/application.properties @@ -26,9 +26,4 @@ quarkus.camel.metrics.enable-message-history = true camel.context.name = quarkus-camel-example # Prevent unwanted routes appearing in the health check output -camel.health.config[disabledHealthRoute].parent=routes -camel.health.config[disabledHealthRoute].enabled=false - -camel.health.config[checkIntervalThreshold].parent = routes -camel.health.config[checkIntervalThreshold].interval = 100 -camel.health.config[checkIntervalThreshold].failure-threshold = 2 +camel.health.exclude-pattern = disabledHealthRoute diff --git a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthTest.java b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthTest.java index db79af1..4c24962 100644 --- a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthTest.java +++ b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/health/MicroProfileHealthTest.java @@ -16,15 +16,10 @@ */ package org.apache.camel.quarkus.component.microprofile.it.health; -import java.util.List; -import java.util.concurrent.TimeUnit; - import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; -import io.restassured.path.json.JsonPath; import org.apache.camel.ServiceStatus; -import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; import static org.hamcrest.Matchers.contains; @@ -165,66 +160,4 @@ class MicroProfileHealthTest { .statusCode(204); } } - - @Test - public void testFailureThreshold() { - try { - RestAssured.given() - .queryParam("healthCheckEnabled", "true") - .post("/microprofile-health/failure-threshold") - .then() - .statusCode(204); - - // Configured failure threshold and interval should allow the initial health state be UP - RestAssured.when().get("/q/health").then() - .contentType(ContentType.JSON) - .header("Content-Type", containsString("charset=UTF-8")) - .body("status", is("UP"), - "checks.findAll { it.name == 'failure-threshold' }.status.unique()", contains("UP")); - - // Poll the health endpoint until the threshold / interval is exceeded and the health state transitions to DOWN - Awaitility.await().atMost(10, TimeUnit.SECONDS).pollDelay(50, TimeUnit.MILLISECONDS).until(() -> { - JsonPath result = RestAssured.when().get("/q/health").then() - .contentType(ContentType.JSON) - .header("Content-Type", containsString("charset=UTF-8")) - .extract() - .jsonPath(); - - String status = result.getString("status"); - List<String> routeStatus = result.getList("checks.findAll { it.name == 'failure-threshold' }.status.unique()"); - return status.equals("DOWN") && routeStatus.contains("DOWN"); - }); - - RestAssured.given() - .queryParam("returnStatusUp", true) - .post("/microprofile-health/failure-threshold/return/status") - .then() - .statusCode(204); - - // Try again with a poll delay > the failure interval and wait for the health state to transition to UP - Awaitility.await().atMost(10, TimeUnit.SECONDS).pollDelay(50, TimeUnit.MILLISECONDS).until(() -> { - JsonPath result = RestAssured.when().get("/q/health").then() - .contentType(ContentType.JSON) - .header("Content-Type", containsString("charset=UTF-8")) - .extract() - .jsonPath(); - - String status = result.getString("status"); - List<String> routeStatus = result.getList("checks.findAll { it.name == 'failure-threshold' }.status.unique()"); - return status.equals("UP") && routeStatus.contains("UP"); - }); - } finally { - RestAssured.given() - .queryParam("returnStatusUp", false) - .post("/microprofile-health/failure-threshold/return/status") - .then() - .statusCode(204); - - RestAssured.given() - .queryParam("healthCheckEnabled", "false") - .post("/microprofile-health/failure-threshold") - .then() - .statusCode(204); - } - } } diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java index 8e6a1e3..213bfbb 100644 --- a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java +++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java @@ -63,10 +63,7 @@ public class OpenApiRoutes extends RouteBuilder { .description("Gets a list of fruits") .id("list") .produces(MediaType.APPLICATION_JSON) - .route() - .setBody().constant(getFruits()) - .marshal().json() - .endRest() + .to("direct:fruits") .get("/operation/spec") .param() @@ -101,20 +98,14 @@ public class OpenApiRoutes extends RouteBuilder { .code("error") .message("Response Error") .endResponseMessage() - .route() - .setBody().constant("GET: /operation/spec") - .endRest() + .to("direct:echoMethodPath") .get("/security/scopes") .security("OAuth2", "scope1,scope2,scope3") - .route() - .setBody().constant("GET: /security/scopes") - .endRest() + .to("direct:echoMethodPath") .get("/security/api/key") - .route() - .setBody().constant("GET: /security/api/key/header") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .apiKey("X-API-Key", "The API key") .withHeader("X-API-KEY") @@ -122,17 +113,13 @@ public class OpenApiRoutes extends RouteBuilder { .end() .get("/security/basic/auth") - .route() - .setBody().constant("/security/basic/auth") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .basicAuth("basicAuth", "Basic Authentication") .end() .get("/security/oauth2") - .route() - .setBody().constant("/security/oauth2") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .oauth2("oauth2", "OAuth2 Authentication") .flow("implicit") @@ -146,29 +133,30 @@ public class OpenApiRoutes extends RouteBuilder { if (openApiVersion.equals("3.0.0")) { rest() .get("/security/bearer/token") - .route() - .setBody().constant("/security/bearer/token") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .bearerToken("bearerAuth", "Bearer Token Authentication") .end() .get("/security/mutual/tls") - .route() - .setBody().constant("/security/mutual/tls") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .mutualTLS("mutualTLS") .end() .get("/security/openid") - .route() - .setBody().constant("/security/openid") - .endRest() + .to("direct:echoMethodPath") .securityDefinitions() .openIdConnect("openId", "https://secure.apache.org/fake/openid-configuration") .end(); } + + from("direct:fruits") + .setBody().constant(getFruits()) + .marshal().json(); + + from("direct:echoMethodPath") + .setBody().simple("${header.CamelHttpMethod}: ${header.CamelHttpPath}"); } private Set<Fruit> getFruits() { diff --git a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/common/OpenApiTest.java b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/common/OpenApiTest.java index 4f97265..352851e 100644 --- a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/common/OpenApiTest.java +++ b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/common/OpenApiTest.java @@ -200,9 +200,7 @@ public abstract class OpenApiTest { .then() .contentType(ContentType.JSON) .statusCode(200) - .body( - containsString("x-camelContextId"), - containsString("x-routeId")); + .body(containsString("x-camelContextId")); } @Test diff --git a/integration-tests/platform-http/pom.xml b/integration-tests/platform-http/pom.xml index 172b01a..ea7a162 100644 --- a/integration-tests/platform-http/pom.xml +++ b/integration-tests/platform-http/pom.xml @@ -33,6 +33,10 @@ <dependencies> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-platform-http</artifactId> </dependency> <dependency> @@ -110,6 +114,19 @@ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-log-deployment</artifactId> <version>${project.version}</version> <type>pom</type> diff --git a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java index 46cdad9..41a54eb 100644 --- a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java +++ b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java @@ -46,14 +46,16 @@ public class PlatformHttpRouteBuilder extends RouteBuilder { rest() .get("/platform-http/rest-get") - .route() - .setBody(constant("GET: /rest-get")) - .endRest() + .to("direct:echoMethodPath") .post("/platform-http/rest-post") .consumes("text/plain").produces("text/plain") - .route() - .setBody(constant("POST: /rest-post")) - .endRest(); + .to("direct:echoMethodPath"); + + from("direct:echoMethodPath") + .setBody().simple("${header.CamelHttpMethod}: ${header.CamelHttpPath}"); + + from("direct:greet") + .setBody().simple("Hello ${header.name}"); from("platform-http:/platform-http/hello?httpMethodRestrict=GET").setBody(simple("Hello ${header.name}")); from("platform-http:/platform-http/get-post?httpMethodRestrict=GET,POST").setBody(simple("Hello ${body}")); @@ -122,9 +124,7 @@ public class PlatformHttpRouteBuilder extends RouteBuilder { rest() .get("/platform-http/hello-by-name/{name}") .produces("text/plain") - .route() - .setBody(e -> "Hello " + e.getIn().getHeader("name", String.class)) - .endRest(); + .to("direct:greet"); // Webhook tests from("platform-http:/platform-http/webhookpath") diff --git a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java index 2060398..4868e6a 100644 --- a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java +++ b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java @@ -66,11 +66,11 @@ class PlatformHttpTest { @Test public void rest() throws Throwable { RestAssured.get("/my-context/platform-http/rest-get") - .then().body(equalTo("GET: /rest-get")); + .then().body(equalTo("GET: /my-context/platform-http/rest-get")); RestAssured.given() .contentType("text/plain") .post("/my-context/platform-http/rest-post") - .then().body(equalTo("POST: /rest-post")); + .then().body(equalTo("POST: /my-context/platform-http/rest-post")); } @Test diff --git a/integration-tests/rest/pom.xml b/integration-tests/rest/pom.xml index dc80da2..dec26a0 100644 --- a/integration-tests/rest/pom.xml +++ b/integration-tests/rest/pom.xml @@ -37,6 +37,10 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-http</artifactId> </dependency> <dependency> @@ -126,6 +130,19 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-http-deployment</artifactId> <version>${project.version}</version> <type>pom</type> diff --git a/integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestRoutes.java b/integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestRoutes.java index 5342994..de4f92f 100644 --- a/integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestRoutes.java +++ b/integration-tests/rest/src/main/java/org/apache/camel/quarkus/component/rest/it/RestRoutes.java @@ -43,41 +43,29 @@ public class RestRoutes extends RouteBuilder { rest("/rest") .delete() .produces("text/plain") - .route() - .setBody(constant("DELETE: /rest")) - .endRest() + .to("direct:echoMethodPath") .get() .produces("text/plain") - .route() - .setBody(constant("GET: /rest")) - .endRest() + .to("direct:echoMethodPath") .head() - .route() - .setHeader(Exchange.CONTENT_TYPE).constant("text/plain") - .endRest() + .to("direct:contentTypeText") .patch() .consumes("text/plain") .produces("text/plain") - .route() - .setBody(simple("${body}: /rest")) - .endRest() + .to("direct:echoBodyPath") .post() .consumes("text/plain") .produces("text/plain") - .route() - .setBody(simple("${body}: /rest")) - .endRest() + .to("direct:echoBodyPath") .put() .consumes("text/plain") .produces("text/plain") - .route() - .setBody(simple("${body}: /rest")) - .endRest() + .to("direct:echoBodyPath") .post("/validation") .clientRequestValidation(true) @@ -85,55 +73,67 @@ public class RestRoutes extends RouteBuilder { .param().name("messageMiddle").type(RestParamType.body).required(true).endParam() .param().name("messageEnd").type(RestParamType.header).required(true).endParam() .param().name("unused").type(RestParamType.formData).required(false).endParam() - .route() - .setBody(simple("${header.messageStart} ${body} ${header.messageEnd}")) - .endRest() + .to("direct:greetWithBody") .get("/template/{messageStart}/{messageEnd}") - .route() - .setBody(simple("${header.messageStart} ${header.messageEnd}")) - .endRest() + .to("direct:greet") .post("/pojo/binding/json") .bindingMode(RestBindingMode.json) .type(Person.class) .produces(MediaType.TEXT_PLAIN) - .route() - .setBody(simple("Name: ${body.firstName} ${body.lastName}, Age: ${body.age}")) - .setHeader(Exchange.CONTENT_TYPE, constant("text/plain")) - .endRest() + .to("direct:personString") .get("/binding/json/producer") - .route() - .setBody(constant(PERSON_JSON)) - .endRest() + .to("direct:personJson") .post("/pojo/binding/xml") .bindingMode(RestBindingMode.xml) .type(Person.class) .produces(MediaType.TEXT_PLAIN) - .route() - .setBody(simple("Name: ${body.firstName} ${body.lastName}, Age: ${body.age}")) - .setHeader(Exchange.CONTENT_TYPE, constant("text/plain")) - .endRest() + .to("direct:personString") .get("/binding/xml/producer") - .route() - .setBody(constant(PERSON_XML)) - .endRest() + .to("direct:personXml") .post("/log") - .route() - .log("Hello ${body}") - .endRest() + .to("direct:hello") .verb("head", "/custom/verb") - .route() - .setHeader(Exchange.CONTENT_TYPE, constant("text/plain")) - .endRest() + .to("direct:contentTypeText") .post("/multipart/upload") - .route() + .to("direct:processAttachments"); + + from("direct:echoMethodPath") + .setBody().simple("${header.CamelHttpMethod}: ${header.CamelHttpPath}"); + + from("direct:echoBodyPath") + .setBody().simple("${body}: ${header.CamelHttpPath}"); + + from("direct:greetWithBody") + .setBody(simple("${header.messageStart} ${body} ${header.messageEnd}")); + + from("direct:greet") + .setBody(simple("${header.messageStart} ${header.messageEnd}")); + + from("direct:hello") + .log("Hello ${body}"); + + from("direct:personString") + .setHeader(Exchange.CONTENT_TYPE, constant("text/plain")) + .setBody().simple("Name: ${body.firstName} ${body.lastName}, Age: ${body.age}"); + + from("direct:personJson") + .setBody().constant(PERSON_JSON); + + from("direct:personXml") + .setBody().constant(PERSON_XML); + + from("direct:contentTypeText") + .setHeader(Exchange.CONTENT_TYPE).constant("text/plain"); + + from("direct:processAttachments") .process(exchange -> { AttachmentMessage attachmentMessage = exchange.getMessage(AttachmentMessage.class); Map<String, DataHandler> attachments = attachmentMessage.getAttachments(); @@ -143,7 +143,6 @@ public class RestRoutes extends RouteBuilder { } else { exchange.getMessage().setBody("0"); } - }) - .endRest(); + }); } } diff --git a/integration-tests/servlet/pom.xml b/integration-tests/servlet/pom.xml index 45737b4..36d8e71 100644 --- a/integration-tests/servlet/pom.xml +++ b/integration-tests/servlet/pom.xml @@ -33,7 +33,11 @@ <dependencies> <dependency> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-servlet</artifactId> + <artifactId>camel-quarkus-core-cloud</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> @@ -41,7 +45,7 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-core-cloud</artifactId> + <artifactId>camel-quarkus-servlet</artifactId> </dependency> <!-- test dependencies --> @@ -110,6 +114,19 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest-deployment</artifactId> <version>${project.version}</version> <type>pom</type> diff --git a/integration-tests/servlet/src/main/java/org/apache/camel/quarkus/component/servlet/CamelRoute.java b/integration-tests/servlet/src/main/java/org/apache/camel/quarkus/component/servlet/CamelRoute.java index 0730289..933e426 100644 --- a/integration-tests/servlet/src/main/java/org/apache/camel/quarkus/component/servlet/CamelRoute.java +++ b/integration-tests/servlet/src/main/java/org/apache/camel/quarkus/component/servlet/CamelRoute.java @@ -18,6 +18,8 @@ package org.apache.camel.quarkus.component.servlet; import javax.enterprise.context.ApplicationScoped; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; @ApplicationScoped @@ -33,13 +35,10 @@ public class CamelRoute extends RouteBuilder { rest() .get("/rest-get") - .route() - .setBody(constant("GET: /rest-get")) - .endRest() + .to("direct:echoMethodPath") + .post("/rest-post") - .route() - .setBody(constant("POST: /rest-post")) - .endRest(); + .to("direct:echoMethodPath"); from("servlet://hello?matchOnUriPrefix=true") .setBody(constant("GET: /hello")); @@ -50,6 +49,14 @@ public class CamelRoute extends RouteBuilder { from("servlet://favorite?servletName=my-favorite-servlet") .setBody(constant("GET: /favorite")); + from("direct:echoMethodPath") + .process(new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.toString(); + } + }) + .setBody().simple("${header.CamelHttpMethod}: ${header.CamelServletContextPath}"); } } diff --git a/pom.xml b/pom.xml index fea1eab..afdccb4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.camel</groupId> <artifactId>camel-dependencies</artifactId> - <version>3.15.0</version> + <version>3.16.0-SNAPSHOT</version> </parent> <groupId>org.apache.camel.quarkus</groupId> @@ -39,8 +39,8 @@ <properties> <!-- Primary dependencies - maintained manually --> - <camel.major.minor>3.15</camel.major.minor> <!-- run after each change: cd docs && mvnd validate --> - <camel.version>${camel.major.minor}.0</camel.version> + <camel.major.minor>3.16</camel.major.minor> <!-- run after each change: cd docs && mvnd validate --> + <camel.version>${camel.major.minor}.0-SNAPSHOT</camel.version> <camel.docs.components.version>${camel.major.minor}.x</camel.docs.components.version><!-- the version in Camel's docs/components/antora.yml --> <camel.docs.components.xref>${camel.docs.components.version}@components</camel.docs.components.xref><!-- the version in Camel's docs/components/antora.yml --> <camel.docs.branch>camel-${camel.major.minor}.x</camel.docs.branch><!-- The stable camel branch on which our Antora docs depends -->