You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/02/07 07:32:46 UTC

[camel-quarkus] branch 2.13.x updated (8dae35146b -> 6f33c5bbf3)

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a change to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


    from 8dae35146b Upgrade to Quarkus 2.13.7
     new 57f6c57e05 DoBeforeEach does not work with Advice #4362
     new 3678cf2a39 Reenable Olingo4 native integration tests
     new 7e5fc808cd Test framework - warn in case that global RouteBuilder is used when not supposed #4381
     new 8a1f81d606 Add platform-http test for retrieving an HTTP header with no value
     new 9d2adaadb8 Telegram: Testing subscribing and unsubscribing to Webhook Fixes #3562
     new 702574794c Add test for REST DSL returning CORS headers for OPTIONS request
     new 47e47d3400 Clean up redundant properties from root pom.xml
     new 35ba191545 Fix #4454 to set jms properties with ActiveMQ connections in native building (#4455)
     new 019ff14833 Aws2-sqs: Test with real account fails. #4389
     new 4587f0d720 Verify that the specific log message we're interested in is not present for RouteBuilderWarningWithoutProducedBuilderTest
     new 0786d87cbe Remove redundant limitations section from SQL extension docs
     new e3f73189b5 Fix SQL extension native testing of alternative JDBC drivers
     new 64b9a6c6ce Re-enable filter test #3584
     new 844c5007e1 file: fix warning
     new 8c76bec471 Fix various documentation typos
     new 33a921aaaa Simplify 'Other route DSLs' section in defining-camel-routes.adoc
     new e8c1f6522b Improve yaml-dsl documentation and add simple test scenarios
     new 6f33c5bbf3 Deprecate quarkus.camel.yaml.flow-mode

The 18 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../pages/contributor-guide/release-guide.adoc     |   2 +-
 .../modules/ROOT/pages/migration-guide/2.11.0.adoc |   2 +-
 .../ROOT/pages/reference/extensions/leveldb.adoc   |   4 +-
 .../ROOT/pages/reference/extensions/sql.adoc       |   9 --
 .../ROOT/pages/reference/extensions/telegram.adoc  |  19 +++
 .../ROOT/pages/reference/extensions/yaml-dsl.adoc  | 132 +++++++++++++++++----
 .../ROOT/pages/user-guide/configuration.adoc       |   2 +-
 .../pages/user-guide/defining-camel-routes.adoc    |  87 ++++++++++++--
 .../modules/ROOT/pages/user-guide/native-mode.adoc |   2 +-
 docs/modules/ROOT/pages/user-guide/testing.adoc    |   5 +-
 extensions-core/yaml-dsl/deployment/pom.xml        |  16 +++
 .../yaml/deployment/YamlDslClassicModeTest.java}   |  47 ++++----
 .../src/test/resources/routes/routes.yaml          |  11 +-
 .../yaml-dsl/runtime/src/main/doc/usage.adoc       | 111 +++++++++++++++++
 .../quarkus/dsl/yaml/YamlDslConfiguration.java     |   9 +-
 .../activemq/deployment/ActiveMQProcessor.java     |   4 +
 .../leveldb/runtime/src/main/doc/limitations.adoc  |   4 +-
 .../sql/runtime/src/main/doc/limitations.adoc      |   4 -
 .../telegram/runtime/src/main/doc/usage.adoc       |  14 +++
 .../component/aws2/sqs/it/Aws2SqsResource.java     |  18 ++-
 .../quarkus/component/aws2/sqs/it/Aws2SqsTest.java |  53 ++++-----
 .../aws2/sqs/it/Aws2SqsTestEnvCustomizer.java      |  19 ++-
 .../activemq/it/ActiveMQTestResource.java          |   4 +-
 .../camel/quarkus/component/file/it/FileTest.java  |   4 +-
 integration-tests/main-yaml/pom.xml                |  28 +----
 .../camel/quarkus/main/CoreMainYamlResource.java   |  23 +++-
 .../camel/quarkus/main/CustomException.java}       |  11 +-
 .../org/apache/camel/quarkus/main/ErrorBean.java}  |   7 +-
 .../apache/camel/quarkus/main/GreetingBean.java}   |  13 +-
 .../src/main/resources/application.properties      |   2 +-
 .../src/main/resources/routes/my-rests.yaml        |  23 +++-
 .../src/main/resources/routes/my-routes.yaml       |  48 +++++++-
 .../routes/{my-rests.yaml => my-templates.yaml}    |  27 +++--
 .../camel/quarkus/main/CoreMainYamlTest.java       |  60 +++++++++-
 .../quarkus/component/olingo4/it/Olingo4IT.java    |   2 -
 .../platform/http/it/PlatformHttpRouteBuilder.java |  11 ++
 .../component/http/server/it/PlatformHttpTest.java |  18 +++
 .../camel/quarkus/component/rest/it/RestTest.java  |  19 ++-
 integration-tests/sql/pom.xml                      |   5 +
 integration-tests/telegram/pom.xml                 |   9 +-
 .../quarkus/component/telegram}/it/Routes.java     |   9 +-
 .../mappings/telegramWebhook-register.json         |  21 ++++
 .../mappings/telegramWebhook-unregister.json       |  21 ++++
 pom.xml                                            |   2 -
 .../ProducedRouteBuilderET.java}                   |  59 ++++-----
 .../ProducedRouteBuilderTest.java}                 |  18 +--
 ...lderFalseET.java => RouteBuilderFailureET.java} |  10 +-
 .../routeBuilder/RouteBuilderFailureTest.java      |  37 +++---
 ...lloRouteBuilder.java => RouteBuilderHello.java} |   2 +-
 .../extensions/routeBuilder/RouteBuilderUtil.java  |  45 +++++++
 ...ilderTrueET.java => RouteBuilderWarningET.java} |   7 +-
 ...ource.java => RouteBuilderWarningResource.java} |   2 +-
 ...outeBuilderWarningWithProducedBuilderTest.java} |  37 ++----
 ...eBuilderWarningWithoutProducedBuilderTest.java} |  37 ++----
 .../camel/quarkus/test/AfterAllCallback.java       |   2 +-
 .../camel/quarkus/test/AfterEachCallback.java      |   8 +-
 .../camel/quarkus/test/BeforeEachCallback.java     |   1 +
 .../quarkus/test/CamelQuarkusTestSupport.java      |  36 ++++++
 .../quarkus/test/junit5/CamelTestSupportTest.java  |   2 -
 .../junit5/patterns/IsMockEndpointsFileTest.java   |   2 -
 .../RouteBuilderConfigureExceptionTest.java        |   2 -
 .../AdviceInDoBeforeEachMethodsTest.java           |  88 ++++++++++++++
 62 files changed, 996 insertions(+), 340 deletions(-)
 copy extensions-core/{core/deployment/src/test/java/org/apache/camel/quarkus/core/runtime/CamelConfigurationPlaceholdersTest.java => yaml-dsl/deployment/src/test/java/org/apache/camel/quarkus/dsl/yaml/deployment/YamlDslClassicModeTest.java} (62%)
 copy integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml => extensions-core/yaml-dsl/deployment/src/test/resources/routes/routes.yaml (84%)
 create mode 100644 extensions-core/yaml-dsl/runtime/src/main/doc/usage.adoc
 delete mode 100644 extensions/sql/runtime/src/main/doc/limitations.adoc
 create mode 100644 extensions/telegram/runtime/src/main/doc/usage.adoc
 copy integration-tests/{jslt/src/main/java/org/apache/camel/quarkus/component/jslt/it/MathFunctionStub.java => main-yaml/src/main/java/org/apache/camel/quarkus/main/CustomException.java} (82%)
 copy integration-tests/{bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/model/OptionalChecks.java => main-yaml/src/main/java/org/apache/camel/quarkus/main/ErrorBean.java} (84%)
 copy integration-tests/{dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/model/Views.java => main-yaml/src/main/java/org/apache/camel/quarkus/main/GreetingBean.java} (80%)
 copy integration-tests/main-yaml/src/main/resources/routes/{my-rests.yaml => my-templates.yaml} (64%)
 copy integration-tests/{platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy => telegram/src/main/java/org/apache/camel/quarkus/component/telegram}/it/Routes.java (78%)
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramWebhook-register.json
 create mode 100644 integration-tests/telegram/src/test/resources/mappings/telegramWebhook-unregister.json
 copy test-framework/{junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/SimpleWeaveAddMockLastTest.java => junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderET.java} (53%)
 copy test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/{routeBuilder/RouteBuilderTest.java => producedRouteBuilder/ProducedRouteBuilderTest.java} (78%)
 rename test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{RouteBuilderFalseET.java => RouteBuilderFailureET.java} (90%)
 copy extensions-jvm/debug/deployment/src/test/java/org/apache/camel/quarkus/component/debug/deployment/DebugTest.java => test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureTest.java (54%)
 rename test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{HelloRouteBuilder.java => RouteBuilderHello.java} (95%)
 create mode 100644 test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderUtil.java
 rename test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{RouteBuilderTrueET.java => RouteBuilderWarningET.java} (93%)
 rename test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{RouteBuilderResource.java => RouteBuilderWarningResource.java} (96%)
 copy test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{RouteBuilderTest.java => RouteBuilderWarningWithProducedBuilderTest.java} (54%)
 rename test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/{RouteBuilderTest.java => RouteBuilderWarningWithoutProducedBuilderTest.java} (54%)
 create mode 100644 test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/userTestCases/AdviceInDoBeforeEachMethodsTest.java


[camel-quarkus] 14/18: file: fix warning

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 844c5007e15c23f7fbd08a6662cc6dcc47067940
Author: aldettinger <al...@gmail.com>
AuthorDate: Thu Feb 2 18:57:05 2023 +0100

    file: fix warning
---
 .../test/java/org/apache/camel/quarkus/component/file/it/FileTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
index a28005535b..8517763f3d 100644
--- a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
+++ b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
@@ -99,7 +99,7 @@ class FileTest {
         startRouteAndWait(CONSUME_BATCH);
 
         await().atMost(10, TimeUnit.SECONDS).until(() -> {
-            Map<String, Object> records = RestAssured
+            Map<?, ?> records = RestAssured
                     .get("/file/getBatch/")
                     .then()
                     .statusCode(200)


[camel-quarkus] 12/18: Fix SQL extension native testing of alternative JDBC drivers

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit e3f73189b5da948492eeaa2d7939a66f1dc31c7e
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 30 15:53:21 2023 +0000

    Fix SQL extension native testing of alternative JDBC drivers
---
 integration-tests/sql/pom.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/integration-tests/sql/pom.xml b/integration-tests/sql/pom.xml
index ad9656246c..6a0decae57 100644
--- a/integration-tests/sql/pom.xml
+++ b/integration-tests/sql/pom.xml
@@ -102,6 +102,11 @@
                                 </goals>
                             </execution>
                         </executions>
+                        <configuration>
+                            <systemPropertyVariables>
+                                <quarkus.test.arg-line>-Dcq.sqlJdbcKind=${cq.sqlJdbcKind}</quarkus.test.arg-line>
+                            </systemPropertyVariables>
+                        </configuration>
                     </plugin>
                 </plugins>
             </build>


[camel-quarkus] 07/18: Clean up redundant properties from root pom.xml

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 47e47d34002bde735a5e0de7fe8cc23c045dc6af
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Feb 6 11:14:06 2023 +0000

    Clean up redundant properties from root pom.xml
---
 pom.xml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index a5cfae3020..be350f63d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,7 +104,6 @@
         <hapi-fhir-core.version>4.2.0</hapi-fhir-core.version><!-- @sync ca.uhn.hapi.fhir:hapi-fhir:${hapi-fhir.version} prop:fhir_core_version -->
         <hbase.version>${hbase-version}</hbase.version>
         <htrace.version>4.2.0-incubating</htrace.version><!-- Mess in hbase transitive deps -->
-        <infinispan.version>13.0.11.Final</infinispan.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:org.infinispan:infinispan-core -->
         <influxdb.version>${influx-java-driver-version}</influxdb.version>
         <jackson1.version>1.9.13</jackson1.version><!-- Mess in the transitive dependencies of hbase-testing-util -->
         <jackson-asl.version>${jackson1.version}</jackson-asl.version><!-- Can be different from jackson1.version on some occasions -->
@@ -128,7 +127,6 @@
         <kudu.version>${kudu-version}</kudu.version>
         <kotlin.version>1.7.20</kotlin.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:org.jetbrains.kotlin:kotlin-stdlib -->
         <kryo.version>2.24.0</kryo.version><!-- @sync org.apache.flink:flink-core:${flink-version} dep:com.esotericsoftware.kryo:kryo -->
-        <libthrift.version>${libthrift-version}</libthrift.version> <!-- Spark -->
         <msal4j.version>1.13.1</msal4j.version><!-- @sync com.azure:azure-identity:${azure-identity-version} dep:com.microsoft.azure:msal4j -->
         <mvel2.version>2.4.14.Final</mvel2.version><!-- @sync org.apache.camel:camel-dependencies:${camel.version} prop:mvel-version -->
         <okio.version>${squareup-okio-version}</okio.version>


[camel-quarkus] 09/18: Aws2-sqs: Test with real account fails. #4389

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 019ff1483337a22324bbb033d92cc015ccd9d0d2
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Fri Jan 27 13:32:25 2023 +0100

    Aws2-sqs: Test with real account fails. #4389
---
 .../component/aws2/sqs/it/Aws2SqsResource.java     | 18 ++++----
 .../quarkus/component/aws2/sqs/it/Aws2SqsTest.java | 53 ++++++++++------------
 .../aws2/sqs/it/Aws2SqsTestEnvCustomizer.java      | 19 +++++++-
 3 files changed, 49 insertions(+), 41 deletions(-)

diff --git a/integration-test-groups/aws2/aws2-sqs/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsResource.java b/integration-test-groups/aws2/aws2-sqs/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsResource.java
index 65ea892b2a..9a5af39999 100644
--- a/integration-test-groups/aws2/aws2-sqs/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsResource.java
+++ b/integration-test-groups/aws2/aws2-sqs/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsResource.java
@@ -151,20 +151,18 @@ public class Aws2SqsResource {
         return Response.ok().build();
     }
 
-    @Path("queue/autocreate/delayed/{queueName}/{delay}")
-    @POST
-    @Produces(MediaType.APPLICATION_JSON)
-    public List<String> autoCreateDelayedQueue(@PathParam("queueName") String queueName, @PathParam("delay") String delay)
-            throws Exception {
-        // queue creation without any operation resulted in 405 status code
-        String uri = String.format("aws2-sqs://%s?autoCreateQueue=true&delayQueue=true&delaySeconds=%s&operation=listQueues",
+    @Path("queue/autocreate/delayed/{queueName}/{delay}/{msg}")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String autoCreateDelayedQueue(@PathParam("queueName") String queueName, @PathParam("delay") String delay,
+            @PathParam("msg") String msg) {
+        String uri = String.format("aws2-sqs://%s?autoCreateQueue=true&delayQueue=true&delaySeconds=%s",
                 queueName, delay);
         return producerTemplate
                 .requestBody(
                         uri,
-                        null,
-                        ListQueuesResponse.class)
-                .queueUrls();
+                        msg,
+                        String.class);
     }
 
     private String componentUri() {
diff --git a/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTest.java b/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTest.java
index 72a8c40103..b485452a09 100644
--- a/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTest.java
+++ b/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTest.java
@@ -23,7 +23,6 @@ import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Locale;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Stream;
@@ -32,9 +31,10 @@ import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
 import org.apache.camel.quarkus.test.support.aws2.Aws2LocalStack;
 import org.apache.camel.quarkus.test.support.aws2.Aws2TestResource;
-import org.apache.commons.lang3.RandomStringUtils;
 import org.awaitility.Awaitility;
 import org.eclipse.microprofile.config.ConfigProvider;
 import org.jboss.logging.Logger;
@@ -43,6 +43,7 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.Matchers.anyOf;
+import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 
 @QuarkusTest
@@ -66,6 +67,10 @@ class Aws2SqsTest {
         return ConfigProvider.getConfig().getValue("aws-sqs.deadletter-name", String.class);
     }
 
+    private String getDelayedQueueName() {
+        return ConfigProvider.getConfig().getValue("aws-sqs.delayed-name", String.class);
+    }
+
     private Integer getPollIntervalSendToDelayQueueInSecs() {
         return ConfigProvider.getConfig().getOptionalValue("aws-sqs.delayed-queue.poll-interval-secs", Integer.class)
                 .orElse(10);
@@ -137,8 +142,8 @@ class Aws2SqsTest {
         // assertion is here twice because in case delete wouldn't work in our queue would be two messages
         // it's possible that the first retrieval would retrieve the correct message and therefore the test
         // would incorrectly pass. By receiving message twice we check if the message was really deleted.
-        Assertions.assertEquals(receiveMessageFromQueue(qName, false), msg);
-        Assertions.assertEquals(receiveMessageFromQueue(qName, false), msg);
+        awaitMessageWithExpectedContentFromQueue(msg, qName);
+        awaitMessageWithExpectedContentFromQueue(msg, qName);
     }
 
     private String sendSingleMessageToQueue(String queueName) {
@@ -172,48 +177,38 @@ class Aws2SqsTest {
 
     @Test
     void sqsAutoCreateDelayedQueue() {
-        final String qName = "delayQueue-" + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
+        final String qName = getDelayedQueueName();
         final int delay = 20;
         try {
-            createDelayQueueAndVerifyExistence(qName, delay);
+            final String msg = "sqs" + UUID.randomUUID().toString().replace("-", "");
             Instant start = Instant.now();
-            final String[] msgSent = new String[1];
-            // verifying existence is not enough, as the queue can be in not Ready state, so we just keep trying to send messages
-            Awaitility.await().pollInterval(getPollIntervalSendToDelayQueueInSecs(), TimeUnit.SECONDS)
-                    .atMost(getTimeoutSendToDelayQueueInMins(), TimeUnit.MINUTES)
-                    .until(() -> {
-                        try {
-                            msgSent[0] = sendSingleMessageToQueue(qName);
-                        } catch (Throwable e) {
-                            LOG.debug("Expected exception", e);
-                            return false;
-                        }
-                        return true;
-                    });
-            awaitMessageWithExpectedContentFromQueue(msgSent[0], qName);
+            RestAssured.get("/aws2-sqs/queue/autocreate/delayed/" + qName + "/" + delay + "/" + msg)
+                    .then()
+                    .statusCode(200)
+                    .body(equalTo(msg));
+            awaitMessageWithExpectedContentFromQueue(msg, qName);
             Assertions.assertTrue(Duration.between(start, Instant.now()).getSeconds() >= delay);
         } catch (AssertionError e) {
             e.printStackTrace();
             Assertions.fail();
-        } finally {
-            deleteQueue(qName);
         }
     }
 
-    private void createDelayQueueAndVerifyExistence(String queueName, int delay) {
-        RestAssured.post("/aws2-sqs/queue/autocreate/delayed/" + queueName + "/" + delay)
+    private String createDelayQueueAndVerifyExistence(String queueName, int delay) {
+        return RestAssured.get("/aws2-sqs/queue/autocreate/delayed/" + queueName + "/" + delay)
                 .then()
                 .statusCode(200)
                 .extract()
-                .body()
-                .as(String[].class);
-        Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
-                () -> Stream.of(listQueues()).anyMatch(url -> url.contains(queueName)));
+                .body().asString();
     }
 
     private void awaitMessageWithExpectedContentFromQueue(String expectedContent, String queueName) {
         Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
-                () -> receiveMessageFromQueue(queueName, false).equals(expectedContent));
+                () -> {
+                    ExtractableResponse<Response> resp = RestAssured.get("/aws2-sqs/receive/" + queueName + "/false")
+                            .then().extract();
+                    return resp.statusCode() == 200 && expectedContent.equals(resp.body().asString());
+                });
     }
 
     private void deleteQueue(String queueName) {
diff --git a/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTestEnvCustomizer.java b/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTestEnvCustomizer.java
index ca00184f19..679b0acb94 100644
--- a/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTestEnvCustomizer.java
+++ b/integration-test-groups/aws2/aws2-sqs/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsTestEnvCustomizer.java
@@ -25,6 +25,8 @@ import org.testcontainers.containers.localstack.LocalStackContainer.Service;
 import software.amazon.awssdk.services.sqs.SqsClient;
 import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
 import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;
+import software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest;
+import software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException;
 
 public class Aws2SqsTestEnvCustomizer implements Aws2TestEnvCustomizer {
 
@@ -38,10 +40,15 @@ public class Aws2SqsTestEnvCustomizer implements Aws2TestEnvCustomizer {
         /* SQS */
         final String queueName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
         envContext.property("aws-sqs.queue-name", queueName);
-        final String failingQueueName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
+        final String failingQueueName = "camel-quarkus-failing-"
+                + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
         envContext.property("aws-sqs.failing-name", failingQueueName);
-        final String deadletterQueueName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
+        final String deadletterQueueName = "camel-quarkus-dead-letter-"
+                + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
         envContext.property("aws-sqs.deadletter-name", deadletterQueueName);
+        final String delayedQueueName = "camel-quarkus-delayed-"
+                + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
+        envContext.property("aws-sqs.delayed-name", delayedQueueName);
 
         final SqsClient sqsClient = envContext.client(Service.SQS, SqsClient::builder);
         {
@@ -67,6 +74,14 @@ public class Aws2SqsTestEnvCustomizer implements Aws2TestEnvCustomizer {
                 sqsClient.deleteQueue(DeleteQueueRequest.builder().queueUrl(queueUrl).build());
                 sqsClient.deleteQueue(DeleteQueueRequest.builder().queueUrl(failingUrl).build());
                 sqsClient.deleteQueue(DeleteQueueRequest.builder().queueUrl(deadletterUrl).build());
+
+                try {
+                    String url = sqsClient.getQueueUrl(GetQueueUrlRequest.builder().queueName(delayedQueueName).build())
+                            .queueUrl();
+                    sqsClient.deleteQueue(DeleteQueueRequest.builder().queueUrl(url).build());
+                } catch (QueueDoesNotExistException e) {
+                    //no need to do anything, the queue does not exist
+                }
             });
 
         }


[camel-quarkus] 03/18: Test framework - warn in case that global RouteBuilder is used when not supposed #4381

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 7e5fc808cdce183bdca1cf0965d951bf577a6202
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Thu Jan 5 16:46:27 2023 +0100

    Test framework - warn in case that global RouteBuilder is used when not supposed #4381
---
 docs/modules/ROOT/pages/user-guide/testing.adoc    |  1 +
 test-framework/junit5-extension-tests/pom.xml      |  5 +++
 ...lderFalseET.java => RouteBuilderFailureET.java} | 10 +----
 ...ilderTest.java => RouteBuilderFailureTest.java} | 35 +++++------------
 ...lloRouteBuilder.java => RouteBuilderHello.java} |  2 +-
 .../extensions/routeBuilder/RouteBuilderUtil.java  | 45 ++++++++++++++++++++++
 ...ilderTrueET.java => RouteBuilderWarningET.java} |  7 +---
 ...ource.java => RouteBuilderWarningResource.java} |  2 +-
 ...outeBuilderWarningWithProducedBuilderTest.java} | 38 +++++++-----------
 ...eBuilderWarningWithoutProducedBuilderTest.java} | 38 +++++++-----------
 .../quarkus/test/CamelQuarkusTestSupport.java      | 15 ++++++++
 11 files changed, 108 insertions(+), 90 deletions(-)

diff --git a/docs/modules/ROOT/pages/user-guide/testing.adoc b/docs/modules/ROOT/pages/user-guide/testing.adoc
index c595e5596d..ccc24f2d29 100644
--- a/docs/modules/ROOT/pages/user-guide/testing.adoc
+++ b/docs/modules/ROOT/pages/user-guide/testing.adoc
@@ -261,6 +261,7 @@ build together, exclusion behavior is implemented into `CamelQuarkusTestSupport`
 * JUnit Jupiter callbacks (`BeforeEachCallback`, `AfterEachCallback`, `AfterAllCallback`, `BeforeAllCallback`, `BeforeTestExecutionCallback` and `AfterTestExecutionCallback`) and JUnit Jupiter annotations (`@BeforeEach`, `@AfterEach`, `@AfterAll` and `@BeforeAll`) might not work correctly. See the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation].
 * If there is an unaffected route, when using advice with, it's important to execute method `CamelQuarkusTestSupport.startRouteDefinitions()` manually from the unit test after you are done doing all the advice with
 * Do not use `@Produces` with `RouteBuilder` use the overridden method `createRouteBuilder()` instead. `@Produces` with `RouteBuilder` might not work correctly.
+* Please use `quarkus.camel.routes-discovery.exclude-patterns` and/or `quarkus.camel.routes-discovery.include-patterns` to configure which routes from the application (`src/main/java`) are used during the tests execution. See more details in the xref:reference/extensions/core.adoc[documentation].
 
 [source,java]
 ----
diff --git a/test-framework/junit5-extension-tests/pom.xml b/test-framework/junit5-extension-tests/pom.xml
index c85445d6c2..60c1531e42 100644
--- a/test-framework/junit5-extension-tests/pom.xml
+++ b/test-framework/junit5-extension-tests/pom.xml
@@ -65,5 +65,10 @@
             <artifactId>camel-quarkus-direct</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFalseET.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureET.java
similarity index 90%
rename from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFalseET.java
rename to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureET.java
index 4723080009..be5eedc4c1 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFalseET.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureET.java
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
 import static org.hamcrest.CoreMatchers.is;
 
 @QuarkusTest
-public class RouteBuilderFalseET extends CamelQuarkusTestSupport {
+public class RouteBuilderFailureET extends CamelQuarkusTestSupport {
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -40,16 +40,10 @@ public class RouteBuilderFalseET extends CamelQuarkusTestSupport {
                 .statusCode(204);
 
         RestAssured.given()
-                .body("file:target/data/RouteBuilderET?fileName=hello_false.txt")
+                .body("file:target/data/RouteBuilderET?fileName=hello_true.txt")
                 .post("/hello/message")
                 .then()
                 .statusCode(200)
                 .body(is("Hello (from routeBuilder) Sheldon"));
     }
-
-    @Test
-    public void hello2Test() throws Exception {
-        helloTest();
-    }
-
 }
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureTest.java
similarity index 52%
copy from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
copy to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureTest.java
index 5a78302b0b..8ff06ffbe6 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderFailureTest.java
@@ -16,46 +16,29 @@
  */
 package org.apache.camel.quarkus.test.extensions.routeBuilder;
 
-import java.util.function.Supplier;
-
 import io.quarkus.test.ContinuousTestingTestUtils;
 import io.quarkus.test.QuarkusDevModeTest;
 import org.apache.camel.quarkus.test.extensions.continousDev.HelloResource;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class RouteBuilderTest {
+/**
+ * Scenario when useRouteBuilder is FALSE and NO RouteBuilder is produced -> should fail.
+ */
+public class RouteBuilderFailureTest {
 
     @RegisterExtension
-    static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
-            .setArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class)
-                            .addClasses(RouteBuilderResource.class, HelloRouteBuilder.class, HelloResource.class)
-                            .add(new StringAsset(
-                                    ContinuousTestingTestUtils.appProperties("camel-quarkus.junit5.message=Sheldon")),
-                                    "application.properties");
-                }
-            })
-            .setTestArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class).addClasses(RouteBuilderFalseET.class, RouteBuilderTrueET.class);
-                }
-            });
+    static final QuarkusDevModeTest TEST = RouteBuilderUtil.createTestModule(RouteBuilderFailureET.class,
+            RouteBuilderWarningResource.class, HelloResource.class);
 
     @Test
-    public void checkTests() throws InterruptedException {
+    public void checkTests() {
         ContinuousTestingTestUtils utils = new ContinuousTestingTestUtils();
         ContinuousTestingTestUtils.TestStatus ts = utils.waitForNextCompletion();
 
-        Assertions.assertEquals(0L, ts.getTestsFailed());
-        Assertions.assertEquals(4L, ts.getTestsPassed());
+        Assertions.assertEquals(1L, ts.getTestsFailed());
+        Assertions.assertEquals(0L, ts.getTestsPassed());
         Assertions.assertEquals(0L, ts.getTestsSkipped());
     }
 }
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/HelloRouteBuilder.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderHello.java
similarity index 95%
rename from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/HelloRouteBuilder.java
rename to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderHello.java
index b611cb2e14..b20908bb52 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/HelloRouteBuilder.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderHello.java
@@ -21,7 +21,7 @@ import javax.enterprise.context.ApplicationScoped;
 import org.apache.camel.builder.RouteBuilder;
 
 @ApplicationScoped
-public class HelloRouteBuilder extends RouteBuilder {
+public class RouteBuilderHello extends RouteBuilder {
 
     @Override
     public void configure() {
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderUtil.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderUtil.java
new file mode 100644
index 0000000000..0ba81a2f30
--- /dev/null
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderUtil.java
@@ -0,0 +1,45 @@
+/*
+ * 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.test.extensions.routeBuilder;
+
+import java.util.logging.Level;
+
+import io.quarkus.test.ContinuousTestingTestUtils;
+import io.quarkus.test.QuarkusDevModeTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public class RouteBuilderUtil {
+
+    static QuarkusDevModeTest createTestModule(Class testClass, Class<?>... archiveClasses) {
+        QuarkusDevModeTest retVal = new QuarkusDevModeTest()
+                .setArchiveProducer(() -> {
+                    JavaArchive ja = ShrinkWrap.create(JavaArchive.class)
+                            .addClasses(archiveClasses)
+                            .add(new StringAsset(
+                                    ContinuousTestingTestUtils.appProperties("camel-quarkus.junit5.message=Sheldon")),
+                                    "application.properties");
+                    return ja;
+                })
+                .setTestArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(testClass))
+                .setLogRecordPredicate(record -> record.getLevel().equals(Level.WARNING));
+
+        return retVal;
+    }
+
+}
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTrueET.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningET.java
similarity index 93%
rename from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTrueET.java
rename to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningET.java
index 263dcc3fa2..3a6c04baeb 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTrueET.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningET.java
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
 import static org.hamcrest.CoreMatchers.is;
 
 @QuarkusTest
-public class RouteBuilderTrueET extends CamelQuarkusTestSupport {
+public class RouteBuilderWarningET extends CamelQuarkusTestSupport {
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -48,11 +48,6 @@ public class RouteBuilderTrueET extends CamelQuarkusTestSupport {
                 .body(is("Hello (from routeBuilder) Sheldon"));
     }
 
-    @Test
-    public void hello2Test() throws Exception {
-        helloTest();
-    }
-
     @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderResource.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningResource.java
similarity index 96%
rename from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderResource.java
rename to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningResource.java
index 5cab10c092..758fdaa5b3 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderResource.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningResource.java
@@ -27,7 +27,7 @@ import org.apache.camel.ProducerTemplate;
 
 @Path("/routeBuilder")
 @ApplicationScoped
-public class RouteBuilderResource {
+public class RouteBuilderWarningResource {
 
     @Inject
     ProducerTemplate producerTemplate;
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
similarity index 54%
copy from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
copy to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
index 5a78302b0b..4401699ceb 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
@@ -16,46 +16,36 @@
  */
 package org.apache.camel.quarkus.test.extensions.routeBuilder;
 
-import java.util.function.Supplier;
+import java.util.concurrent.TimeUnit;
 
 import io.quarkus.test.ContinuousTestingTestUtils;
 import io.quarkus.test.QuarkusDevModeTest;
 import org.apache.camel.quarkus.test.extensions.continousDev.HelloResource;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class RouteBuilderTest {
+/**
+ * Scenario when useRouteBuilder is TRUE and RouteBuilder is created via HelloRouteBuilder -> should succeed with
+ * warning.
+ */
+public class RouteBuilderWarningWithProducedBuilderTest {
 
     @RegisterExtension
-    static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
-            .setArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class)
-                            .addClasses(RouteBuilderResource.class, HelloRouteBuilder.class, HelloResource.class)
-                            .add(new StringAsset(
-                                    ContinuousTestingTestUtils.appProperties("camel-quarkus.junit5.message=Sheldon")),
-                                    "application.properties");
-                }
-            })
-            .setTestArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class).addClasses(RouteBuilderFalseET.class, RouteBuilderTrueET.class);
-                }
-            });
+    static final QuarkusDevModeTest TEST = RouteBuilderUtil.createTestModule(RouteBuilderWarningET.class,
+            RouteBuilderWarningResource.class, HelloResource.class, RouteBuilderHello.class);
 
     @Test
-    public void checkTests() throws InterruptedException {
+    public void checkTests() {
         ContinuousTestingTestUtils utils = new ContinuousTestingTestUtils();
         ContinuousTestingTestUtils.TestStatus ts = utils.waitForNextCompletion();
 
         Assertions.assertEquals(0L, ts.getTestsFailed());
-        Assertions.assertEquals(4L, ts.getTestsPassed());
+        Assertions.assertEquals(1L, ts.getTestsPassed());
         Assertions.assertEquals(0L, ts.getTestsSkipped());
+
+        Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> TEST.getLogRecords().stream()
+                .anyMatch(logRecord -> logRecord.getMessage().contains("`RouteBuilder` detected")));
     }
 }
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
similarity index 54%
rename from test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
rename to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
index 5a78302b0b..dcd0a0e228 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
@@ -16,46 +16,36 @@
  */
 package org.apache.camel.quarkus.test.extensions.routeBuilder;
 
-import java.util.function.Supplier;
+import java.util.concurrent.TimeUnit;
 
 import io.quarkus.test.ContinuousTestingTestUtils;
 import io.quarkus.test.QuarkusDevModeTest;
 import org.apache.camel.quarkus.test.extensions.continousDev.HelloResource;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class RouteBuilderTest {
+/**
+ * Scenario when useRouteBuilder is TRUE and RouteBuilder is created via HelloRouteBuilder -> should succeed without
+ * warning.
+ */
+public class RouteBuilderWarningWithoutProducedBuilderTest {
 
     @RegisterExtension
-    static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
-            .setArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class)
-                            .addClasses(RouteBuilderResource.class, HelloRouteBuilder.class, HelloResource.class)
-                            .add(new StringAsset(
-                                    ContinuousTestingTestUtils.appProperties("camel-quarkus.junit5.message=Sheldon")),
-                                    "application.properties");
-                }
-            })
-            .setTestArchiveProducer(new Supplier<>() {
-                @Override
-                public JavaArchive get() {
-                    return ShrinkWrap.create(JavaArchive.class).addClasses(RouteBuilderFalseET.class, RouteBuilderTrueET.class);
-                }
-            });
+    static final QuarkusDevModeTest TEST = RouteBuilderUtil.createTestModule(RouteBuilderWarningET.class,
+            RouteBuilderWarningResource.class, HelloResource.class);
 
     @Test
-    public void checkTests() throws InterruptedException {
+    public void checkTests() {
         ContinuousTestingTestUtils utils = new ContinuousTestingTestUtils();
         ContinuousTestingTestUtils.TestStatus ts = utils.waitForNextCompletion();
 
         Assertions.assertEquals(0L, ts.getTestsFailed());
-        Assertions.assertEquals(4L, ts.getTestsPassed());
+        Assertions.assertEquals(1L, ts.getTestsPassed());
         Assertions.assertEquals(0L, ts.getTestsSkipped());
+
+        Awaitility.await().pollDelay(10, TimeUnit.SECONDS).atMost(15, TimeUnit.SECONDS)
+                .until(() -> TEST.getLogRecords().isEmpty());
     }
 }
diff --git a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
index 66276fa398..3baaaebe2c 100644
--- a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
+++ b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
@@ -27,6 +27,7 @@ import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.Service;
+import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.quarkus.core.FastCamelContext;
@@ -34,6 +35,8 @@ import org.apache.camel.spi.Registry;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.extension.ExtensionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The {@link CamelTestSupport} class does not work on Quarkus. This class provides a replacement, which can be used in
@@ -72,6 +75,8 @@ import org.junit.jupiter.api.extension.ExtensionContext;
 public class CamelQuarkusTestSupport extends CamelTestSupport
         implements QuarkusTestProfile {
 
+    private static final Logger LOG = LoggerFactory.getLogger(CamelQuarkusTestSupport.class);
+
     @Inject
     protected CamelContext context;
 
@@ -258,6 +263,16 @@ public class CamelQuarkusTestSupport extends CamelTestSupport
     @Override
     protected final void doQuarkusCheck() {
         //can run on Quarkus
+
+        //log warning in case that at least one RouteBuilder in the registry, it might mean, that unintentionally
+        // RouteBuilders are shared across or that RouteBuilder is created with @Produces
+        if (isUseRouteBuilder() && !context.getRegistry().findByType(RouteBuilder.class).isEmpty()) {
+            LOG.warn(
+                    "Test with `true` in `isUserRouteBuilder' and `RouteBuilder` detected in the context registry. " +
+                            "All tests will share this routeBuilder from the registry. This is usually not intended. " +
+                            "If `@Produces` is used to create such a RouteBuilder, please refactor the code " +
+                            "by overriding the method `createRouteBuilder()` instead.");
+        }
     }
 
     void internalAfterAll(QuarkusTestContext context) {


[camel-quarkus] 11/18: Remove redundant limitations section from SQL extension docs

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 0786d87cbef9d3c7c101409116068cad138e8fe7
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 30 15:52:31 2023 +0000

    Remove redundant limitations section from SQL extension docs
    
    Fixes #3256
---
 docs/modules/ROOT/pages/reference/extensions/sql.adoc | 9 ---------
 extensions/sql/runtime/src/main/doc/limitations.adoc  | 4 ----
 2 files changed, 13 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/sql.adoc b/docs/modules/ROOT/pages/reference/extensions/sql.adoc
index a8f5cb2984..04416f07cf 100644
--- a/docs/modules/ROOT/pages/reference/extensions/sql.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/sql.adoc
@@ -46,15 +46,6 @@ ifeval::[{doc-show-user-guide-link} == true]
 Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
 endif::[]
 
-[id="extensions-sql-camel-quarkus-limitations"]
-== Camel Quarkus limitations
-
-Oracle JDBC driver brings some GraalVM native-image configuration that breaks the serialization support in Camel Quarkus and Quarkus in general.
-See this https://github.com/quarkusio/quarkus/issues/20396[quarkus issue] for more details.
-
-xref:{cq-camel-components}::sql-component.adoc#_using_the_jdbc_based_aggregation_repository[Aggregation repository] does not work in native mode with Oracle db, because of this issue.
-
-
 [id="extensions-sql-additional-camel-quarkus-configuration"]
 == Additional Camel Quarkus configuration
 
diff --git a/extensions/sql/runtime/src/main/doc/limitations.adoc b/extensions/sql/runtime/src/main/doc/limitations.adoc
deleted file mode 100644
index 354a695d1e..0000000000
--- a/extensions/sql/runtime/src/main/doc/limitations.adoc
+++ /dev/null
@@ -1,4 +0,0 @@
-Oracle JDBC driver brings some GraalVM native-image configuration that breaks the serialization support in Camel Quarkus and Quarkus in general.
-See this https://github.com/quarkusio/quarkus/issues/20396[quarkus issue] for more details.
-
-xref:{cq-camel-components}::sql-component.adoc#_using_the_jdbc_based_aggregation_repository[Aggregation repository] does not work in native mode with Oracle db, because of this issue.
\ No newline at end of file


[camel-quarkus] 06/18: Add test for REST DSL returning CORS headers for OPTIONS request

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 702574794cff1bf6b72529a603bb12e042a2fb05
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Jan 25 10:19:22 2023 +0000

    Add test for REST DSL returning CORS headers for OPTIONS request
---
 .../camel/quarkus/component/rest/it/RestTest.java     | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java b/integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
index 7f9d59e49b..8414a4d1a9 100644
--- a/integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
+++ b/integration-tests/rest/src/test/java/org/apache/camel/quarkus/component/rest/it/RestTest.java
@@ -56,9 +56,11 @@ class RestTest {
                 .body(body)
                 .request(method, "/rest")
                 .then()
+                .header("Access-Control-Allow-Credentials", equalTo("true"))
                 .header("Access-Control-Allow-Headers", matchesPattern(".*Access-Control.*"))
-                .header("Access-Control-Allow-Methods", matchesPattern("GET, POST"))
-                .header("Access-Control-Allow-Credentials", equalTo("true"));
+                .header("Access-Control-Allow-Methods", equalTo("GET, POST"))
+                .header("Access-Control-Allow-Origin", equalTo("*"))
+                .header("Access-Control-Max-Age", equalTo("3600"));
 
         if (method.equals("HEAD")) {
             // Response body is ignored for HEAD so verify response headers
@@ -246,4 +248,17 @@ class RestTest {
             Files.deleteIfExists(csvFile);
         }
     }
+
+    @Test
+    public void corsOptionsRequest() {
+        RestAssured.given()
+                .options("/rest")
+                .then()
+                .header("Access-Control-Allow-Credentials", equalTo("true"))
+                .header("Access-Control-Allow-Headers", matchesPattern(".*Access-Control.*"))
+                .header("Access-Control-Allow-Methods", equalTo("GET, POST"))
+                .header("Access-Control-Allow-Origin", equalTo("*"))
+                .header("Access-Control-Max-Age", equalTo("3600"))
+                .statusCode(204);
+    }
 }


[camel-quarkus] 05/18: Telegram: Testing subscribing and unsubscribing to Webhook Fixes #3562

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 9d2adaadb8033620e8a448dd21a1219c8f18276b
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Thu Dec 1 09:25:06 2022 +0100

    Telegram: Testing subscribing and unsubscribing to Webhook
    Fixes #3562
---
 .../ROOT/pages/reference/extensions/telegram.adoc  | 19 +++++++++++++
 .../telegram/runtime/src/main/doc/usage.adoc       | 14 ++++++++++
 integration-tests/telegram/pom.xml                 |  9 +++----
 .../quarkus/component/telegram/it/Routes.java      | 31 ++++++++++++++++++++++
 .../mappings/telegramWebhook-register.json         | 21 +++++++++++++++
 .../mappings/telegramWebhook-unregister.json       | 21 +++++++++++++++
 6 files changed, 110 insertions(+), 5 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/telegram.adoc b/docs/modules/ROOT/pages/reference/extensions/telegram.adoc
index ecb36dad6e..e5cfef4607 100644
--- a/docs/modules/ROOT/pages/reference/extensions/telegram.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/telegram.adoc
@@ -45,6 +45,25 @@ ifeval::[{doc-show-user-guide-link} == true]
 Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
 endif::[]
 
+[id="extensions-telegram-usage"]
+== Usage
+[id="extensions-telegram-usage-webhook-mode"]
+== Webhook Mode
+
+The Telegram extension supports usage in the webhook mode.
+
+In order to enable webhook mode, users need first to add a REST implementation to their application.
+Maven users, for example, can add *camel-quarkus-rest* extension to their `pom.xml` file:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-rest</artifactId>
+</dependency>
+----
+
+
 [id="extensions-telegram-ssl-in-native-mode"]
 == SSL in native mode
 
diff --git a/extensions/telegram/runtime/src/main/doc/usage.adoc b/extensions/telegram/runtime/src/main/doc/usage.adoc
new file mode 100644
index 0000000000..e3960854be
--- /dev/null
+++ b/extensions/telegram/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,14 @@
+== Webhook Mode
+
+The Telegram extension supports usage in the webhook mode.
+
+In order to enable webhook mode, users need first to add a REST implementation to their application.
+Maven users, for example, can add *camel-quarkus-rest* extension to their `pom.xml` file:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-rest</artifactId>
+</dependency>
+----
\ No newline at end of file
diff --git a/integration-tests/telegram/pom.xml b/integration-tests/telegram/pom.xml
index 539c95eea1..99b9af6295 100644
--- a/integration-tests/telegram/pom.xml
+++ b/integration-tests/telegram/pom.xml
@@ -43,12 +43,12 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy-jackson</artifactId>
         </dependency>
-
-        <!-- To serve the mock Telegram API -->
+        <!-- Wehbook usage -->
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-platform-http</artifactId>
+            <artifactId>camel-quarkus-rest</artifactId>
         </dependency>
+        <!-- To serve the mock Telegram API -->
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-attachments</artifactId>
@@ -88,7 +88,6 @@
         </dependency>
     </dependencies>
 
-
     <profiles>
         <profile>
             <id>native</id>
@@ -141,7 +140,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-platform-http-deployment</artifactId>
+                    <artifactId>camel-quarkus-rest-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
diff --git a/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
new file mode 100644
index 0000000000..d7ee2b93f8
--- /dev/null
+++ b/integration-tests/telegram/src/main/java/org/apache/camel/quarkus/component/telegram/it/Routes.java
@@ -0,0 +1,31 @@
+/*
+ * 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.telegram.it;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class Routes extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("webhook:telegram:bots?webhookPath=/my-test&webhook-external-url=http://localhost:8080")
+                .log("webhook message : ${body}");
+    }
+}
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-register.json b/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-register.json
new file mode 100644
index 0000000000..9152c9ff70
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-register.json
@@ -0,0 +1,21 @@
+{
+  "id" : "70c0a770-2a98-4f46-ba01-8ba3a71d8e3d",
+  "name": "botfake-webhook",
+  "request": {
+    "url": "/botfake-token/setWebhook?url=http://localhost:8080/my-test",
+    "method": "GET"
+  },
+  "response": {
+    "status": 200,
+    "body": "{\"ok\":true,\"result\":true,\"description\":\"Webhook was set\"}",
+    "headers": {
+      "Server": "nginx/1.16.1",
+      "Date": "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type": "application/json",
+      "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid": "f47c81d1-def8-4246-b14f-2a0555829f7d",
+  "persistent": true,
+  "insertionIndex": 8
+}
\ No newline at end of file
diff --git a/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-unregister.json b/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-unregister.json
new file mode 100644
index 0000000000..f4e592e7f7
--- /dev/null
+++ b/integration-tests/telegram/src/test/resources/mappings/telegramWebhook-unregister.json
@@ -0,0 +1,21 @@
+{
+  "id" : "70c0a770-2a98-4f46-ba01-8ba3a71d8e3d",
+  "name": "botfake-delete-webhook",
+  "request": {
+    "url": "/botfake-token/deleteWebhook",
+    "method": "GET"
+  },
+  "response": {
+    "status": 200,
+    "body": "{\"ok\":true,\"result\":true,\"description\":\"Webhook was set\"}",
+    "headers": {
+      "Server": "nginx/1.16.1",
+      "Date": "Tue, 03 Nov 2020 12:26:06 GMT",
+      "Content-Type": "application/json",
+      "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload"
+    }
+  },
+  "uuid": "f47c81d1-def8-4246-b14f-2a0555829f7d",
+  "persistent": true,
+  "insertionIndex": 8
+}
\ No newline at end of file


[camel-quarkus] 10/18: Verify that the specific log message we're interested in is not present for RouteBuilderWarningWithoutProducedBuilderTest

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 4587f0d7204ba008ed6547f715db5658da9791de
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 30 11:04:53 2023 +0000

    Verify that the specific log message we're interested in is not present for RouteBuilderWarningWithoutProducedBuilderTest
---
 test-framework/junit5-extension-tests/pom.xml                      | 5 -----
 .../routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java   | 5 +----
 .../RouteBuilderWarningWithoutProducedBuilderTest.java             | 7 ++-----
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/test-framework/junit5-extension-tests/pom.xml b/test-framework/junit5-extension-tests/pom.xml
index 60c1531e42..c85445d6c2 100644
--- a/test-framework/junit5-extension-tests/pom.xml
+++ b/test-framework/junit5-extension-tests/pom.xml
@@ -65,10 +65,5 @@
             <artifactId>camel-quarkus-direct</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.awaitility</groupId>
-            <artifactId>awaitility</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 </project>
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
index 4401699ceb..b35276adcc 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithProducedBuilderTest.java
@@ -16,12 +16,9 @@
  */
 package org.apache.camel.quarkus.test.extensions.routeBuilder;
 
-import java.util.concurrent.TimeUnit;
-
 import io.quarkus.test.ContinuousTestingTestUtils;
 import io.quarkus.test.QuarkusDevModeTest;
 import org.apache.camel.quarkus.test.extensions.continousDev.HelloResource;
-import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -45,7 +42,7 @@ public class RouteBuilderWarningWithProducedBuilderTest {
         Assertions.assertEquals(1L, ts.getTestsPassed());
         Assertions.assertEquals(0L, ts.getTestsSkipped());
 
-        Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> TEST.getLogRecords().stream()
+        Assertions.assertTrue(TEST.getLogRecords().stream()
                 .anyMatch(logRecord -> logRecord.getMessage().contains("`RouteBuilder` detected")));
     }
 }
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
index dcd0a0e228..ba578bbe19 100644
--- a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/routeBuilder/RouteBuilderWarningWithoutProducedBuilderTest.java
@@ -16,12 +16,9 @@
  */
 package org.apache.camel.quarkus.test.extensions.routeBuilder;
 
-import java.util.concurrent.TimeUnit;
-
 import io.quarkus.test.ContinuousTestingTestUtils;
 import io.quarkus.test.QuarkusDevModeTest;
 import org.apache.camel.quarkus.test.extensions.continousDev.HelloResource;
-import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -45,7 +42,7 @@ public class RouteBuilderWarningWithoutProducedBuilderTest {
         Assertions.assertEquals(1L, ts.getTestsPassed());
         Assertions.assertEquals(0L, ts.getTestsSkipped());
 
-        Awaitility.await().pollDelay(10, TimeUnit.SECONDS).atMost(15, TimeUnit.SECONDS)
-                .until(() -> TEST.getLogRecords().isEmpty());
+        Assertions.assertFalse(TEST.getLogRecords().stream()
+                .anyMatch(logRecord -> logRecord.getMessage().contains("`RouteBuilder` detected")));
     }
 }


[camel-quarkus] 16/18: Simplify 'Other route DSLs' section in defining-camel-routes.adoc

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 33a921aaaa79ab95b7ac2b8b79c2b7271f7b3dc2
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Feb 2 14:36:52 2023 +0000

    Simplify 'Other route DSLs' section in defining-camel-routes.adoc
---
 .../ROOT/pages/user-guide/defining-camel-routes.adoc        | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

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 8a16ee8791..96ee7011d6 100644
--- a/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
+++ b/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
@@ -122,14 +122,11 @@ The route XML should be in the simplified version like:
 
 == Other route DSLs
 
-Since Camel Quarkus 1.8.0, you can also use
-xref:reference/extensions/java-joor-dsl.adoc[Java jOOR],
-xref:reference/extensions/groovy-dsl.adoc[Groovy],
-xref:reference/extensions/yaml-dsl.adoc[YAML],
-xref:reference/extensions/kotlin-dsl.adoc[Kotlin] or
-xref:reference/extensions/js-dsl.adoc[JavaScript] for defining Camel routes.
-
-Except for YAML, these DSLs are supported only in JVM mode, because they load and compile the routes at runtime.
+* xref:reference/extensions/java-joor-dsl.adoc[Java jOOR]
+* xref:reference/extensions/groovy-dsl.adoc[Groovy]
+* xref:reference/extensions/yaml-dsl.adoc[YAML]
+* xref:reference/extensions/kotlin-dsl.adoc[Kotlin]
+* xref:reference/extensions/js-dsl.adoc[JavaScript]
 
 == What's next?
 


[camel-quarkus] 02/18: Reenable Olingo4 native integration tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 3678cf2a3997f45e98d4da641c1c259fac8f5f80
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 9 13:30:02 2023 +0000

    Reenable Olingo4 native integration tests
---
 .../java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java   | 2 --
 1 file changed, 2 deletions(-)

diff --git a/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java
index b96805af13..179c163aab 100644
--- a/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java
+++ b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java
@@ -17,9 +17,7 @@
 package org.apache.camel.quarkus.component.olingo4.it;
 
 import io.quarkus.test.junit.QuarkusIntegrationTest;
-import org.junit.jupiter.api.Disabled;
 
-@Disabled("https://github.com/apache/camel-quarkus/issues/1972")
 @QuarkusIntegrationTest
 class Olingo4IT extends Olingo4Test {
 


[camel-quarkus] 15/18: Fix various documentation typos

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8c76bec471816c4b5d86b754b226609abb136271
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Feb 2 14:27:09 2023 +0000

    Fix various documentation typos
---
 docs/modules/ROOT/pages/contributor-guide/release-guide.adoc  | 2 +-
 docs/modules/ROOT/pages/migration-guide/2.11.0.adoc           | 2 +-
 docs/modules/ROOT/pages/reference/extensions/leveldb.adoc     | 4 ++--
 docs/modules/ROOT/pages/user-guide/configuration.adoc         | 2 +-
 docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc | 2 +-
 docs/modules/ROOT/pages/user-guide/native-mode.adoc           | 2 +-
 extensions/leveldb/runtime/src/main/doc/limitations.adoc      | 4 ++--
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docs/modules/ROOT/pages/contributor-guide/release-guide.adoc b/docs/modules/ROOT/pages/contributor-guide/release-guide.adoc
index 55c59a77d0..e9114a18dc 100644
--- a/docs/modules/ROOT/pages/contributor-guide/release-guide.adoc
+++ b/docs/modules/ROOT/pages/contributor-guide/release-guide.adoc
@@ -82,7 +82,7 @@ $ cd tooling/perf-regression
 $ java -jar target/quarkus-app/quarkus-run.jar -an 2.9.0 2.10.0
 ----
 
-After approximatively 1 hour, it should generate a report like below:
+After approximately 1 hour, it should generate a report like below:
 
 [source,shell]
 ----
diff --git a/docs/modules/ROOT/pages/migration-guide/2.11.0.adoc b/docs/modules/ROOT/pages/migration-guide/2.11.0.adoc
index 6c247cfdd1..d07ddc69ac 100644
--- a/docs/modules/ROOT/pages/migration-guide/2.11.0.adoc
+++ b/docs/modules/ROOT/pages/migration-guide/2.11.0.adoc
@@ -4,6 +4,6 @@ The following guide outlines how to adapt your code to changes that were made in
 
 == Changes to Quartz clustering support
 
-In previous releases the Camel Quarkus Quartz documention listed various means of configuring Quartz for clustering. This has now been simplified 
+In previous releases the Camel Quarkus Quartz documentation listed various means of configuring Quartz for clustering. This has now been simplified
 to a single set of instructions that leverages Quarkus Quartz. If you are using one of the previous methods of clustering, it is advised to update your 
 application to the new method documented in the xref:reference/extensions/quartz.adoc[Quartz extension guide].
diff --git a/docs/modules/ROOT/pages/reference/extensions/leveldb.adoc b/docs/modules/ROOT/pages/reference/extensions/leveldb.adoc
index 7ffb4e4fd7..cb419311b6 100644
--- a/docs/modules/ROOT/pages/reference/extensions/leveldb.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/leveldb.adoc
@@ -51,14 +51,14 @@ In native mode the extension uses a port of LevelDB written in Java (https://git
 which is within 10% of the performance of the C++ original. Please upvote https://github.com/apache/camel-quarkus/issues/1911[this issue]
 if you do not like the present state.
 
-Serialization is https://github.com/oracle/graal/issues/460[not supported] on GraalVM. Extension has to use serializationization based
+Serialization is https://github.com/oracle/graal/issues/460[not supported] on GraalVM. Extension has to use serialization based
 on Jackson. Aggregation repository in native has to be constructed in one of the following ways:
 
 * Use class `QuarkusLevelDBAggregationRepository` instead of `LevelDBAggregationRepository`.
 * Configure jackson serializer on `LevelDBAggregationRepository` by calling `repo.setSerializer(new JacksonLevelDBSerializer());`
 
 Jackson serializer has limitation towards binary content. If payload object contains binary data (does not concern payloads which are completely binary), Jackson serialization and deserialization won't work correctly.
-To avoid this, define your own jackson serializer/deserealizer via `Module` and provide it to the aggragation repository
+To avoid this, define your own jackson serializer/deserializer via `Module` and provide it to the aggregation repository
 (you can use for example the constructor of `QuarkusLevelDBAggregationRepository`).
 
 
diff --git a/docs/modules/ROOT/pages/user-guide/configuration.adoc b/docs/modules/ROOT/pages/user-guide/configuration.adoc
index 48e02b33f4..e5c2b9fbef 100644
--- a/docs/modules/ROOT/pages/user-guide/configuration.adoc
+++ b/docs/modules/ROOT/pages/user-guide/configuration.adoc
@@ -117,7 +117,7 @@ public class Configurations {
 In addition to support configuring Camel through properties, `camel-quarkus-core` allows you to use conventions to configure the Camel behavior.
 For example, if there is a single `ExchangeFormatter` instance in the CDI container, then it will automatically wire that bean to the `LogComponent`.
 
-Component options for which this is supported are maked as _Autowired_ on their documentation pages
+Component options for which this is supported are marked as _Autowired_ on their documentation pages
 - see e.g. the `exchangeFormatter` option on the xref:{cq-camel-components}::log-component.adoc#_component_option_exchangeFormatter[Log component] page.
 
 You can pass `autowiredEnabled=false` to disable it.
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 fc5b912228..8a16ee8791 100644
--- a/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
+++ b/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
@@ -6,7 +6,7 @@ Camel Quarkus supports several domain specific languages (DSLs) to define Camel
 
 Extending `org.apache.camel.builder.RouteBuilder` and using the fluent builder methods available there
 is the most common way of defining Camel Routes.
-Here is an example from the https://github.com/apache/camel-quarkus-examples/tree/main/timer-log[timer-log] quicksstart:
+Here is an example from the https://github.com/apache/camel-quarkus-examples/tree/main/timer-log[timer-log] quickstart:
 
 [source,java]
 ----
diff --git a/docs/modules/ROOT/pages/user-guide/native-mode.adoc b/docs/modules/ROOT/pages/user-guide/native-mode.adoc
index 0d0f50795d..4c0bda1a19 100644
--- a/docs/modules/ROOT/pages/user-guide/native-mode.adoc
+++ b/docs/modules/ROOT/pages/user-guide/native-mode.adoc
@@ -22,7 +22,7 @@ See also https://quarkus.io/guides/all-config#quarkus-core_quarkus.native.add-al
 == Locale
 
 By default, only the building JVM default locale is included in the native image.
-Quarkus provides a way to set the locale via `application.properties`, so that you do not need to rely on `LANG` and `LC_*` environement variables:
+Quarkus provides a way to set the locale via `application.properties`, so that you do not need to rely on `LANG` and `LC_*` environment variables:
 
 [source,properties]
 ----
diff --git a/extensions/leveldb/runtime/src/main/doc/limitations.adoc b/extensions/leveldb/runtime/src/main/doc/limitations.adoc
index 9b74c9980a..2c29c2b025 100644
--- a/extensions/leveldb/runtime/src/main/doc/limitations.adoc
+++ b/extensions/leveldb/runtime/src/main/doc/limitations.adoc
@@ -2,13 +2,13 @@ In native mode the extension uses a port of LevelDB written in Java (https://git
 which is within 10% of the performance of the C++ original. Please upvote https://github.com/apache/camel-quarkus/issues/1911[this issue]
 if you do not like the present state.
 
-Serialization is https://github.com/oracle/graal/issues/460[not supported] on GraalVM. Extension has to use serializationization based
+Serialization is https://github.com/oracle/graal/issues/460[not supported] on GraalVM. Extension has to use serialization based
 on Jackson. Aggregation repository in native has to be constructed in one of the following ways:
 
 * Use class `QuarkusLevelDBAggregationRepository` instead of `LevelDBAggregationRepository`.
 * Configure jackson serializer on `LevelDBAggregationRepository` by calling `repo.setSerializer(new JacksonLevelDBSerializer());`
 
 Jackson serializer has limitation towards binary content. If payload object contains binary data (does not concern payloads which are completely binary), Jackson serialization and deserialization won't work correctly.
-To avoid this, define your own jackson serializer/deserealizer via `Module` and provide it to the aggragation repository
+To avoid this, define your own jackson serializer/deserializer via `Module` and provide it to the aggregation repository
 (you can use for example the constructor of `QuarkusLevelDBAggregationRepository`).
 


[camel-quarkus] 08/18: Fix #4454 to set jms properties with ActiveMQ connections in native building (#4455)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 35ba1915454344a43b7debc1fd80252adc7e445b
Author: Zheng Feng <zh...@gmail.com>
AuthorDate: Mon Jan 30 10:43:21 2023 +0800

    Fix #4454 to set jms properties with ActiveMQ connections in native building (#4455)
---
 .../quarkus/component/activemq/deployment/ActiveMQProcessor.java      | 4 ++++
 .../camel/quarkus/component/activemq/it/ActiveMQTestResource.java     | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/extensions/activemq/deployment/src/main/java/org/apache/camel/quarkus/component/activemq/deployment/ActiveMQProcessor.java b/extensions/activemq/deployment/src/main/java/org/apache/camel/quarkus/component/activemq/deployment/ActiveMQProcessor.java
index 83335feb82..0885a13ba9 100644
--- a/extensions/activemq/deployment/src/main/java/org/apache/camel/quarkus/component/activemq/deployment/ActiveMQProcessor.java
+++ b/extensions/activemq/deployment/src/main/java/org/apache/camel/quarkus/component/activemq/deployment/ActiveMQProcessor.java
@@ -59,6 +59,10 @@ class ActiveMQProcessor {
         return new ReflectiveClassBuildItem(true, false,
                 "java.net.Socket",
                 "sun.security.ssl.SSLSocketImpl",
+                "org.apache.activemq.ActiveMQConnectionFactory",
+                "org.apache.activemq.ActiveMQPrefetchPolicy",
+                "org.apache.activemq.RedeliveryPolicy",
+                "org.apache.activemq.blob.BlobTransferPolicy",
                 "org.apache.activemq.command.ConsumerInfo",
                 "org.apache.activemq.pool.PooledConnectionFactory",
                 "org.apache.commons.pool2.impl.DefaultEvictionPolicy",
diff --git a/integration-tests/activemq/src/test/java/org/apache/camel/quarkus/component/activemq/it/ActiveMQTestResource.java b/integration-tests/activemq/src/test/java/org/apache/camel/quarkus/component/activemq/it/ActiveMQTestResource.java
index 17dd6eb0b0..1191898bfa 100644
--- a/integration-tests/activemq/src/test/java/org/apache/camel/quarkus/component/activemq/it/ActiveMQTestResource.java
+++ b/integration-tests/activemq/src/test/java/org/apache/camel/quarkus/component/activemq/it/ActiveMQTestResource.java
@@ -51,7 +51,9 @@ public class ActiveMQTestResource implements QuarkusTestResourceLifecycleManager
             return Collections.singletonMap(
                     "camel.component.activemq.broker-url",
                     String.format(
-                            "tcp://%s:%d?connectionTimeout=5000&tcpNoDelay=false&socket.OOBInline=false",
+                            "tcp://%s:%d?connectionTimeout=5000&tcpNoDelay=false&socket.OOBInline=false" +
+                                    "&jms.checkForDuplicates=false&jms.redeliveryPolicy.redeliveryDelay=1000" +
+                                    "&jms.prefetchPolicy.queuePrefetch=1000&jms.blobTransferPolicy.bufferSize=102400",
                             container.getHost(),
                             container.getMappedPort(TCP_PORT)));
         } catch (Exception e) {


[camel-quarkus] 13/18: Re-enable filter test #3584

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 64b9a6c6ceb18358473cb4549e815313da9fed73
Author: aldettinger <al...@gmail.com>
AuthorDate: Wed Feb 1 13:08:52 2023 +0100

    Re-enable filter test #3584
---
 .../test/java/org/apache/camel/quarkus/component/file/it/FileTest.java  | 2 --
 1 file changed, 2 deletions(-)

diff --git a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
index 8bd44c71e6..a28005535b 100644
--- a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
+++ b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
@@ -37,7 +37,6 @@ import io.restassured.response.ValidatableResponse;
 import org.apache.camel.quarkus.core.util.FileUtils;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.quarkus.component.file.it.FileResource.CONSUME_BATCH;
@@ -149,7 +148,6 @@ class FileTest {
                 equalTo(FILE_CONTENT_02));
     }
 
-    @Disabled("Disabling as an experiment in the context of CAMEL-QUARKUS-3584. Let's check whether filter and idempotent are sort of polluting each other.")
     @Test
     public void filter() throws IOException {
         String fileName = createFile(FILE_CONTENT_01, "/file/create/filter", null, "skip_" + UUID.randomUUID().toString());


[camel-quarkus] 17/18: Improve yaml-dsl documentation and add simple test scenarios

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit e8c1f6522badb1b1a47601e3bd28c25e35f7f94c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Feb 3 16:45:03 2023 +0000

    Improve yaml-dsl documentation and add simple test scenarios
    
    Fixes #4487
---
 .../ROOT/pages/reference/extensions/yaml-dsl.adoc  | 122 ++++++++++++++++++++-
 .../pages/user-guide/defining-camel-routes.adoc    |  72 ++++++++++++
 extensions-core/yaml-dsl/deployment/pom.xml        |  16 +++
 .../yaml/deployment/YamlDslClassicModeTest.java    |  85 ++++++++++++++
 .../src/test/resources/routes/routes.yaml          |  11 +-
 .../yaml-dsl/runtime/src/main/doc/usage.adoc       | 111 +++++++++++++++++++
 .../quarkus/dsl/yaml/YamlDslConfiguration.java     |   8 +-
 integration-tests/main-yaml/pom.xml                |  28 +----
 .../camel/quarkus/main/CoreMainYamlResource.java   |  23 +++-
 .../apache/camel/quarkus/main/CustomException.java |  29 +++++
 .../org/apache/camel/quarkus/main/ErrorBean.java   |  26 +++++
 .../apache/camel/quarkus/main/GreetingBean.java    |  32 ++++++
 .../src/main/resources/application.properties      |   2 +-
 .../src/main/resources/routes/my-rests.yaml        |  23 +++-
 .../src/main/resources/routes/my-routes.yaml       |  48 +++++++-
 .../routes/{my-rests.yaml => my-templates.yaml}    |  27 +++--
 .../camel/quarkus/main/CoreMainYamlTest.java       |  60 +++++++++-
 17 files changed, 669 insertions(+), 54 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
index ebabf902d0..444adae77e 100644
--- a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
@@ -44,6 +44,124 @@ ifeval::[{doc-show-user-guide-link} == true]
 Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
 endif::[]
 
+[id="extensions-yaml-dsl-usage"]
+== Usage
+[id="extensions-yaml-dsl-usage-native-mode"]
+=== Native mode
+
+The following constructs when defined within Camel YAML DSL markup, require you to register classes for reflection. Refer to the xref:user-guide/native-mode.adoc#reflection[Native mode] guide for details.
+
+[id="extensions-yaml-dsl-usage-bean-definitions"]
+==== Bean definitions
+
+The YAML DSL provides the capability to define beans as follows.
+
+[source,yaml]
+----
+- beans:
+    - name: "greetingBean"
+      type: "org.acme.GreetingBean"
+      properties:
+        greeting: "Hello World!"
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "timer:from-yaml?period=1000"
+      steps:
+        - to: "bean:greetingBean"
+----
+
+In this example, the `GreetingBean` class needs to be registered for reflection. This applies to any types that you refer to under the `beans` key in your YAML routes.
+
+[source,java]
+----
+@RegisterForReflection
+public class GreetingBean {
+}
+----
+
+[id="extensions-yaml-dsl-usage-exception-handling"]
+==== Exception handling
+
+Camel provides various methods of handling exceptions. Some of these require that any exception classes referenced in their DSL definitions are registered for reflection.
+
+`*on-exception*`
+
+[source,yaml]
+----
+- on-exception:
+    handled:
+      constant: "true"
+    exception:
+      - "org.acme.MyHandledException"
+    steps:
+      - transform:
+          constant: "Sorry something went wrong"
+----
+
+[source,java]
+----
+@RegisterForReflection
+public class MyHandledException {
+}
+----
+
+`*throw-exception*`
+
+[source,yaml]
+----
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "direct:start"
+      steps:
+        - choice:
+            when:
+              - simple: "${body} == 'bad value'"
+                steps:
+                  - throw-exception:
+                      exception-type: "org.acme.ForcedException"
+                      message: "Forced exception"
+            otherwise:
+              steps:
+                - to: "log:end"
+----
+
+[source,java]
+----
+@RegisterForReflection
+public class ForcedException {
+}
+----
+
+`*do-catch*`
+
+[source,yaml]
+----
+- route:
+    id: "my-yaml-route2"
+    from:
+      uri: "direct:tryCatch"
+      steps:
+        - do-try:
+            steps:
+              - to: "direct:readFile"
+            do-catch:
+              - exception:
+                  - "java.io.FileNotFoundException"
+                steps:
+                  - transform:
+                      constant: "do-catch caught an exception"
+----
+
+[source,java]
+----
+@RegisterForReflection(targets = FileNotFoundException.class)
+public class MyClass {
+}
+----
+
+
 [id="extensions-yaml-dsl-additional-camel-quarkus-configuration"]
 == Additional Camel Quarkus configuration
 
@@ -54,8 +172,8 @@ endif::[]
 
 |icon:lock[title=Fixed at build time] [[quarkus.camel.yaml.flow-mode]]`link:#quarkus.camel.yaml.flow-mode[quarkus.camel.yaml.flow-mode]`
 
-If `true` the YAML DSL support flow-mode which allow to write more concise routes as for EIPs that have their own output like filter, aggregate, split, etc. the `steps` element can be omitted an in that case, the next processing step is automatically wired to the EIP's outputs. 
-As example, a YAML DSL to process only the timer events from 5 to 10 would look like: `- from:
+If `true` the YAML DSL supports flow-mode. This allows you to write more concise routes for EIPs that have their own output like filter, aggregate, split, etc. the `steps` element can be omitted and in that case, the next processing step is automatically wired to the EIPs outputs. 
+For example, a YAML route to process only the timer events from 5 to 10 would look like: `- from:
     uri: "timer:tick"
     steps:
       - filter:
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 96ee7011d6..4d82d6e409 100644
--- a/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
+++ b/docs/modules/ROOT/pages/user-guide/defining-camel-routes.adoc
@@ -120,6 +120,78 @@ The route XML should be in the simplified version like:
 </routeTemplates>
 ----
 
+== YAML DSL
+
+To configure routes with YAML, you must add the `camel-quarkus-yaml-dsl` dependency to the classpath.
+
+With Camel Main, you can set a property that points to the location of YAML files containing routes, xref:manual::rest-dsl.adoc[REST DSL] and xref:manual::route-template.adoc[Route templates] definitions:
+
+[source,properties]
+----
+camel.main.routes-include-pattern = routes/routes.yaml, routes/rests.yaml, rests/route-template.yaml
+----
+
+.Route
+[source,yaml]
+----
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "timer:from-yaml?period=1000"
+      steps:
+        - set-body:
+            constant: "Hello YAML!"
+        - to: "log:from-yaml"
+----
+
+.Rest DSL
+
+[source,yaml]
+----
+- rest:
+    get:
+      - path: "/greeting"
+        to: "direct:greet"
+
+- route:
+    id: "rest-route"
+    from:
+      uri: "direct:greet"
+      steps:
+        - set-body:
+            constant: "Hello YAML!"
+----
+
+.Route Templates
+[source,yaml]
+----
+- route-template:
+    id: "myTemplate"
+    parameters:
+      - name: "name"
+      - name: "greeting"
+        defaultValue: "Hello"
+      - name: "myPeriod"
+        defaultValue: "3s"
+    from:
+      uri: "timer:{{name}}?period={{myPeriod}}"
+      steps:
+      - set-body:
+          expression:
+            simple: "{{greeting}} ${body}"
+      - log: "${body}"
+
+- templated-route:
+    route-template-ref: "myTemplate"
+    parameters:
+      - name: "name"
+        value: "tick"
+      - name: "greeting"
+        value: "Bonjour"
+      - name: "myPeriod"
+        value: "5s"
+----
+
 == Other route DSLs
 
 * xref:reference/extensions/java-joor-dsl.adoc[Java jOOR]
diff --git a/extensions-core/yaml-dsl/deployment/pom.xml b/extensions-core/yaml-dsl/deployment/pom.xml
index 9b1272e554..0bf1c6db9c 100644
--- a/extensions-core/yaml-dsl/deployment/pom.xml
+++ b/extensions-core/yaml-dsl/deployment/pom.xml
@@ -38,6 +38,22 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-yaml-dsl</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </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-mock</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/extensions-core/yaml-dsl/deployment/src/test/java/org/apache/camel/quarkus/dsl/yaml/deployment/YamlDslClassicModeTest.java b/extensions-core/yaml-dsl/deployment/src/test/java/org/apache/camel/quarkus/dsl/yaml/deployment/YamlDslClassicModeTest.java
new file mode 100644
index 0000000000..f9419867ab
--- /dev/null
+++ b/extensions-core/yaml-dsl/deployment/src/test/java/org/apache/camel/quarkus/dsl/yaml/deployment/YamlDslClassicModeTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.dsl.yaml.deployment;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Properties;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader;
+import org.apache.camel.dsl.yaml.common.YamlDeserializationMode;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+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.assertEquals;
+
+public class YamlDslClassicModeTest {
+    @RegisterExtension
+    static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
+            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+                    .addAsResource("routes/routes.yaml", "routes/routes.yaml")
+                    .addAsResource(applicationProperties(), "application.properties"));
+
+    @Inject
+    CamelContext context;
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    public static Asset applicationProperties() {
+        Writer writer = new StringWriter();
+
+        Properties props = new Properties();
+        props.put("camel.main.routes-include-pattern", "routes/routes.yaml");
+        props.put("quarkus.camel.yaml.flow-mode", "false");
+
+        try {
+            props.store(writer, "");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        return new StringAsset(writer.toString());
+    }
+
+    @Test
+    public void classicModeEnabled() {
+        String mode = context.getGlobalOptions().get(YamlRoutesBuilderLoader.DESERIALIZATION_MODE);
+        assertEquals(YamlDeserializationMode.CLASSIC.name(), mode);
+    }
+
+    @Test
+    public void classicModeYamlRoute() throws InterruptedException {
+        MockEndpoint endpoint = context.getEndpoint("mock:split", MockEndpoint.class);
+        endpoint.expectedBodiesReceived("foo", "bar", "cheese");
+
+        producerTemplate.sendBody("direct:classicMode", "foo,bar,cheese");
+
+        endpoint.assertIsSatisfied(5000);
+    }
+}
diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml b/extensions-core/yaml-dsl/deployment/src/test/resources/routes/routes.yaml
similarity index 84%
copy from integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml
copy to extensions-core/yaml-dsl/deployment/src/test/resources/routes/routes.yaml
index d0a6f533fd..8f46657270 100644
--- a/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml
+++ b/extensions-core/yaml-dsl/deployment/src/test/resources/routes/routes.yaml
@@ -18,8 +18,9 @@
 - route:
     id: "my-yaml-route"
     from:
-      uri: "timer:from-xml?period=3000"
-      steps:
-        - set-body:
-            constant: "Hello World!!!"
-        - to: "log:from-yaml"
+        uri: "direct:classicMode"
+        steps:
+          - split:
+              tokenize: ","
+              steps:
+                - to: "mock:split"
diff --git a/extensions-core/yaml-dsl/runtime/src/main/doc/usage.adoc b/extensions-core/yaml-dsl/runtime/src/main/doc/usage.adoc
new file mode 100644
index 0000000000..9aa928a93c
--- /dev/null
+++ b/extensions-core/yaml-dsl/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,111 @@
+=== Native mode
+
+The following constructs when defined within Camel YAML DSL markup, require you to register classes for reflection. Refer to the xref:user-guide/native-mode.adoc#reflection[Native mode] guide for details.
+
+==== Bean definitions
+
+The YAML DSL provides the capability to define beans as follows.
+
+[source,yaml]
+----
+- beans:
+    - name: "greetingBean"
+      type: "org.acme.GreetingBean"
+      properties:
+        greeting: "Hello World!"
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "timer:from-yaml?period=1000"
+      steps:
+        - to: "bean:greetingBean"
+----
+
+In this example, the `GreetingBean` class needs to be registered for reflection. This applies to any types that you refer to under the `beans` key in your YAML routes.
+
+[source,java]
+----
+@RegisterForReflection
+public class GreetingBean {
+}
+----
+
+==== Exception handling
+
+Camel provides various methods of handling exceptions. Some of these require that any exception classes referenced in their DSL definitions are registered for reflection.
+
+`*on-exception*`
+
+[source,yaml]
+----
+- on-exception:
+    handled:
+      constant: "true"
+    exception:
+      - "org.acme.MyHandledException"
+    steps:
+      - transform:
+          constant: "Sorry something went wrong"
+----
+
+[source,java]
+----
+@RegisterForReflection
+public class MyHandledException {
+}
+----
+
+`*throw-exception*`
+
+[source,yaml]
+----
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "direct:start"
+      steps:
+        - choice:
+            when:
+              - simple: "${body} == 'bad value'"
+                steps:
+                  - throw-exception:
+                      exception-type: "org.acme.ForcedException"
+                      message: "Forced exception"
+            otherwise:
+              steps:
+                - to: "log:end"
+----
+
+[source,java]
+----
+@RegisterForReflection
+public class ForcedException {
+}
+----
+
+`*do-catch*`
+
+[source,yaml]
+----
+- route:
+    id: "my-yaml-route2"
+    from:
+      uri: "direct:tryCatch"
+      steps:
+        - do-try:
+            steps:
+              - to: "direct:readFile"
+            do-catch:
+              - exception:
+                  - "java.io.FileNotFoundException"
+                steps:
+                  - transform:
+                      constant: "do-catch caught an exception"
+----
+
+[source,java]
+----
+@RegisterForReflection(targets = FileNotFoundException.class)
+public class MyClass {
+}
+----
diff --git a/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java b/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
index ec373bdfa8..ad7181959c 100644
--- a/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
+++ b/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
@@ -24,11 +24,11 @@ import io.quarkus.runtime.annotations.ConfigRoot;
 @ConfigRoot(name = "camel.yaml", phase = ConfigPhase.BUILD_TIME)
 public class YamlDslConfiguration {
     /**
-     * If {@code true} the YAML DSL support flow-mode which allow to write more concise routes as for EIPs that have
-     * their own output like filter, aggregate, split, etc. the {@code steps} element can be omitted an in that case,
-     * the next processing step is automatically wired to the EIP's outputs.
+     * If {@code true} the YAML DSL supports flow-mode. This allows you to write more concise routes for EIPs that have
+     * their own output like filter, aggregate, split, etc. the {@code steps} element can be omitted and in that case,
+     * the next processing step is automatically wired to the EIPs outputs.
      * <p/>
-     * As example, a YAML DSL to process only the timer events from 5 to 10 would look like:
+     * For example, a YAML route to process only the timer events from 5 to 10 would look like:
      *
      * <pre>
      * {@code
diff --git a/integration-tests/main-yaml/pom.xml b/integration-tests/main-yaml/pom.xml
index f072a1a911..5251bb13d8 100644
--- a/integration-tests/main-yaml/pom.xml
+++ b/integration-tests/main-yaml/pom.xml
@@ -49,7 +49,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-timer</artifactId>
+            <artifactId>camel-quarkus-bean</artifactId>
         </dependency>
 
         <dependency>
@@ -60,10 +60,7 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy-jsonb</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xpath</artifactId>
-        </dependency>
+
 
         <!-- test dependencies -->
         <dependency>
@@ -124,20 +121,7 @@
                 <!-- 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>
+                    <artifactId>camel-quarkus-bean-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
@@ -150,7 +134,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-rest-deployment</artifactId>
+                    <artifactId>camel-quarkus-direct-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
@@ -163,7 +147,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-timer-deployment</artifactId>
+                    <artifactId>camel-quarkus-log-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
@@ -176,7 +160,7 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xpath-deployment</artifactId>
+                    <artifactId>camel-quarkus-rest-deployment</artifactId>
                     <version>${project.version}</version>
                     <type>pom</type>
                     <scope>test</scope>
diff --git a/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java
index 7963a0f726..87d4bb129c 100644
--- a/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java
+++ b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java
@@ -26,19 +26,24 @@ import javax.json.JsonObject;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 
 import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader;
 import org.apache.camel.spi.RoutesBuilderLoader;
 
-@Path("/test")
+@Path("/main/yaml")
 @ApplicationScoped
 public class CoreMainYamlResource {
     @Inject
     CamelMain main;
 
-    @Path("/main/describe")
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/describe")
     @GET
     @Produces(MediaType.APPLICATION_JSON)
     @SuppressWarnings("unchecked")
@@ -63,4 +68,18 @@ public class CoreMainYamlResource {
                 .add("global-options", Json.createObjectBuilder((Map) main.getCamelContext().getGlobalOptions()).build())
                 .build();
     }
+
+    @Path("/greet")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String greet(@QueryParam("forceFailure") boolean forceFailure) {
+        return producerTemplate.requestBodyAndHeader("direct:start", null, "forceFailure", forceFailure, String.class);
+    }
+
+    @Path("/try/catch")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String tryCatch() {
+        return producerTemplate.requestBody("direct:tryCatch", null, String.class);
+    }
 }
diff --git a/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CustomException.java b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CustomException.java
new file mode 100644
index 0000000000..ea96c6b274
--- /dev/null
+++ b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CustomException.java
@@ -0,0 +1,29 @@
+/*
+ * 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.main;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class CustomException extends Exception {
+    public CustomException() {
+    }
+
+    public CustomException(String message) {
+        super(message);
+    }
+}
diff --git a/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/ErrorBean.java b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/ErrorBean.java
new file mode 100644
index 0000000000..a9fc6f4277
--- /dev/null
+++ b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/ErrorBean.java
@@ -0,0 +1,26 @@
+/*
+ * 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.main;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class ErrorBean {
+    public void throwException() throws CustomException {
+        throw new CustomException();
+    }
+}
diff --git a/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/GreetingBean.java b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/GreetingBean.java
new file mode 100644
index 0000000000..2e64ef8a8d
--- /dev/null
+++ b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/GreetingBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.main;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class GreetingBean {
+    String greeting;
+
+    public void setGreeting(String greeting) {
+        this.greeting = greeting;
+    }
+
+    public String greet() {
+        return greeting;
+    }
+}
diff --git a/integration-tests/main-yaml/src/main/resources/application.properties b/integration-tests/main-yaml/src/main/resources/application.properties
index 0030f2fc34..a9d2581270 100644
--- a/integration-tests/main-yaml/src/main/resources/application.properties
+++ b/integration-tests/main-yaml/src/main/resources/application.properties
@@ -18,4 +18,4 @@
 #
 # Main
 #
-camel.main.routes-include-pattern = classpath:routes/my-routes.yaml,classpath:routes/my-rests.yaml
+camel.main.routes-include-pattern = routes/my-routes.yaml,routes/my-rests.yaml,routes/my-templates.yaml
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 b248831808..bbb55ceefa 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
@@ -17,13 +17,28 @@
 
 - rest:
     get:
-      - path: "/greeting"
-        to: "direct:rest"
+      - path: "/rest"
+        to: "direct:echoMethodPath"
+    post:
+      - path: "/rest"
+        to: "direct:echoMethodPath"
+    patch:
+      - path: "/rest"
+        to: "direct:echoMethodPath"
+    put:
+      - path: "/rest"
+        to: "direct:echoMethodPath"
+    delete:
+      - path: "/rest"
+        to: "direct:echoMethodPath"
+    head:
+      - path: "/rest"
+        to: "direct:echoMethodPath"
 
 - route:
     id: "rest-route"
     from:
-      uri: "direct:rest"
+      uri: "direct:echoMethodPath"
       steps:
         - set-body:
-            constant: "Hello World!!!"
+            simple: "${header.CamelHttpMethod}: ${header.CamelHttpPath}"
diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml b/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml
index d0a6f533fd..00881b5386 100644
--- a/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml
+++ b/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml
@@ -15,11 +15,51 @@
 # limitations under the License.
 #
 
+- beans:
+    - name: "greetingBean"
+      type: "org.apache.camel.quarkus.main.GreetingBean"
+      properties:
+        greeting: "Hello World!"
+- beans:
+    - name: "errorBean"
+      type: "org.apache.camel.quarkus.main.ErrorBean"
+
+- on-exception:
+    handled:
+      constant: "true"
+    exception:
+      - "org.apache.camel.quarkus.main.CustomException"
+    steps:
+      - transform:
+          constant: "Sorry something went wrong"
+
 - route:
     id: "my-yaml-route"
     from:
-      uri: "timer:from-xml?period=3000"
+      uri: "direct:start"
+      steps:
+        - choice:
+            when:
+              - simple: "${header.forceFailure} == 'true'"
+                steps:
+                  - throw-exception:
+                      exception-type: "org.apache.camel.quarkus.main.CustomException"
+                      message: "Forced custom exception"
+            otherwise:
+              steps:
+                - to: "bean:greetingBean?method=greet"
+
+- route:
+    id: "my-yaml-route2"
+    from:
+      uri: "direct:tryCatch"
       steps:
-        - set-body:
-            constant: "Hello World!!!"
-        - to: "log:from-yaml"
+        - do-try:
+            steps:
+              - to: "bean:errorBean"
+            do-catch:
+              - exception:
+                  - "org.apache.camel.quarkus.main.CustomException"
+                steps:
+                  - transform:
+                      constant: "do-catch caught an exception"
diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml b/integration-tests/main-yaml/src/main/resources/routes/my-templates.yaml
similarity index 64%
copy from integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml
copy to integration-tests/main-yaml/src/main/resources/routes/my-templates.yaml
index b248831808..d68cff77f4 100644
--- a/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml
+++ b/integration-tests/main-yaml/src/main/resources/routes/my-templates.yaml
@@ -15,15 +15,24 @@
 # limitations under the License.
 #
 
-- rest:
-    get:
-      - path: "/greeting"
-        to: "direct:rest"
-
-- route:
-    id: "rest-route"
+- route-template:
+    id: "myTemplate"
+    parameters:
+      - name: "path"
+      - name: "method"
+      - name: "greeting"
     from:
-      uri: "direct:rest"
+      uri: "platform-http:{{path}}?httpMethodRestrict={{method}}"
       steps:
         - set-body:
-            constant: "Hello World!!!"
+            constant: "{{greeting}}"
+
+- templated-route:
+    route-template-ref: "myTemplate"
+    parameters:
+      - name: "path"
+        value: "/templated/greeting"
+      - name: "method"
+        value: "GET"
+      - name: "greeting"
+        value: "Hello World!"
diff --git a/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java
index 7e47d01898..c7f2742cf3 100644
--- a/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java
+++ b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java
@@ -23,9 +23,14 @@ import io.restassured.RestAssured;
 import io.restassured.path.json.JsonPath;
 import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader;
 import org.apache.camel.dsl.yaml.common.YamlDeserializationMode;
+import org.hamcrest.Matcher;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.emptyString;
+import static org.hamcrest.Matchers.is;
 
 @QuarkusTest
 public class CoreMainYamlTest {
@@ -33,7 +38,7 @@ public class CoreMainYamlTest {
     public void testMainInstanceWithYamlRoutes() {
         JsonPath p = RestAssured.given()
                 .accept(MediaType.APPLICATION_JSON)
-                .get("/test/main/describe")
+                .get("/main/yaml/describe")
                 .then()
                 .statusCode(200)
                 .extract()
@@ -49,4 +54,57 @@ public class CoreMainYamlTest {
         assertThat(p.getMap("global-options", String.class, String.class))
                 .containsEntry(YamlRoutesBuilderLoader.DESERIALIZATION_MODE, YamlDeserializationMode.FLOW.name());
     }
+
+    @Test
+    public void yamlRoute() {
+        RestAssured.get("/main/yaml/greet")
+                .then()
+                .statusCode(200)
+                .body(is("Hello World!"));
+
+        RestAssured.given()
+                .queryParam("forceFailure", "true")
+                .get("/main/yaml/greet")
+                .then()
+                .statusCode(200)
+                .body(is("Sorry something went wrong"));
+    }
+
+    @Test
+    public void tryCatchYamlRoute() {
+        RestAssured.given()
+                .get("/main/yaml/try/catch")
+                .then()
+                .statusCode(200)
+                .body(is("do-catch caught an exception"));
+    }
+
+    @ParameterizedTest
+    @ValueSource(strings = { "GET", "POST", "PATCH", "PUT", "DELETE", "HEAD" })
+    public void yamlRests(String method) {
+        Matcher<String> matcher;
+        if (method.equals("HEAD")) {
+            matcher = emptyString();
+        } else {
+            matcher = is(method + ": " + "/rest");
+        }
+
+        RestAssured.request(method, "/rest")
+                .then()
+                .statusCode(200)
+                .body(matcher);
+    }
+
+    @Test
+    public void yamlTemplate() {
+        RestAssured.get("/templated/greeting")
+                .then()
+                .statusCode(200)
+                .body(is("Hello World!"));
+
+        RestAssured.post("/templated/greeting")
+                .then()
+                .statusCode(404);
+    }
+
 }


[camel-quarkus] 01/18: DoBeforeEach does not work with Advice #4362

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 57f6c57e057481afd2c0f930f330d1fbf7bee214
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Tue Jan 3 16:12:34 2023 +0100

    DoBeforeEach does not work with Advice #4362
---
 docs/modules/ROOT/pages/user-guide/testing.adoc    |  4 +-
 .../ProducedRouteBuilderET.java}                   | 54 +++++++------
 .../ProducedRouteBuilderTest.java                  | 61 +++++++++++++++
 .../camel/quarkus/test/AfterAllCallback.java       |  2 +-
 .../camel/quarkus/test/AfterEachCallback.java      |  8 +-
 .../camel/quarkus/test/BeforeEachCallback.java     |  1 +
 .../quarkus/test/CamelQuarkusTestSupport.java      | 21 ++++++
 .../quarkus/test/junit5/CamelTestSupportTest.java  |  2 -
 .../junit5/patterns/IsMockEndpointsFileTest.java   |  2 -
 .../RouteBuilderConfigureExceptionTest.java        |  2 -
 .../AdviceInDoBeforeEachMethodsTest.java           | 88 ++++++++++++++++++++++
 11 files changed, 210 insertions(+), 35 deletions(-)

diff --git a/docs/modules/ROOT/pages/user-guide/testing.adoc b/docs/modules/ROOT/pages/user-guide/testing.adoc
index 6fa7b4e79a..c595e5596d 100644
--- a/docs/modules/ROOT/pages/user-guide/testing.adoc
+++ b/docs/modules/ROOT/pages/user-guide/testing.adoc
@@ -258,9 +258,9 @@ Be aware that execution of method `doAfterConstruct` differs from the execution
 * To force Quarkus JUnit Extension to restart the application (and thus also `CamelContext`) for a given test class, you need to assign a unique `@io.quarkus.test.junit.TestProfile` to that class. Check the https://quarkus.io/guides/getting-started-testing#testing_different_profiles[Quarkus documentation] for how you can do that. (Note that `https://quarkus.io/guides/getting-started-testing#quarkus-test-resource[@io.quarkus.test.common.QuarkusTestResource]` has a similar effect.)
 * Camel Quarkus executes the production of beans during the build phase. Because all the tests are
 build together, exclusion behavior is implemented into `CamelQuarkusTestSupport`. If a producer of the specific type and name is used in one tests, the instance will be the same for the rest of the tests.
-* JUnit Jupiter callbacks (`BeforeEachCallback`, `AfterEachCallback`, `AfterAllCallback`, `BeforeAllCallback`, `BeforeTestExecutionCallback` and `AfterTestExecutionCallback`) might not work correctly. See the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation].
+* JUnit Jupiter callbacks (`BeforeEachCallback`, `AfterEachCallback`, `AfterAllCallback`, `BeforeAllCallback`, `BeforeTestExecutionCallback` and `AfterTestExecutionCallback`) and JUnit Jupiter annotations (`@BeforeEach`, `@AfterEach`, `@AfterAll` and `@BeforeAll`) might not work correctly. See the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation].
 * If there is an unaffected route, when using advice with, it's important to execute method `CamelQuarkusTestSupport.startRouteDefinitions()` manually from the unit test after you are done doing all the advice with
-
+* Do not use `@Produces` with `RouteBuilder` use the overridden method `createRouteBuilder()` instead. `@Produces` with `RouteBuilder` might not work correctly.
 
 [source,java]
 ----
diff --git a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderET.java
similarity index 51%
copy from test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java
copy to test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderET.java
index cfb26bddca..184d46a2cb 100644
--- a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderET.java
@@ -14,43 +14,53 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.test.junit5.patterns;
+package org.apache.camel.quarkus.test.extensions.producedRouteBuilder;
+
+import javax.enterprise.inject.Produces;
 
 import io.quarkus.test.junit.QuarkusTest;
-import org.apache.camel.Predicate;
+import org.apache.camel.builder.AdviceWith;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.fail;
-
 @QuarkusTest
-public class RouteBuilderConfigureExceptionTest extends CamelQuarkusTestSupport {
+public class ProducedRouteBuilderET extends CamelQuarkusTestSupport {
 
-    private Predicate iAmNull;
-
-    @Override
     @BeforeEach
-    public void setUp() {
-        try {
-            super.setUp();
-            fail("Should have thrown exception");
-        } catch (Exception e) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testFoo() {
+    public void doSomethingBefore() throws Exception {
+        AdviceWith.adviceWith(this.context, "sampleRoute",
+                ProducedRouteBuilderET::enhanceRoute);
     }
 
-    @Override
-    protected RouteBuilder createRouteBuilder() {
+    @Produces
+    public RouteBuilder routes() {
         return new RouteBuilder() {
+            @Override
             public void configure() {
-                from("direct:start").choice().when(iAmNull).to("mock:dead");
+                from("direct:in").routeId("sampleRoute").to("file:target/data/RouteBuilderET?filename=hello_true.txt");
             }
         };
     }
+
+    @Test
+    public void firstTest() throws Exception {
+        Assertions.assertTrue(true);
+    }
+
+    @Test
+    public void secondTest() throws Exception {
+        Assertions.assertTrue(true);
+    }
+
+    private static void enhanceRoute(AdviceWithRouteBuilder route) {
+        route.replaceFromWith("direct:ftp");
+        route.interceptSendToEndpoint("file:.*samples.*")
+                .skipSendToOriginalEndpoint()
+                .to("mock:file:sample_requests");
+    }
+
 }
diff --git a/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderTest.java b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderTest.java
new file mode 100644
index 0000000000..17fa9029a2
--- /dev/null
+++ b/test-framework/junit5-extension-tests/src/test/java/org/apache/camel/quarkus/test/extensions/producedRouteBuilder/ProducedRouteBuilderTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.test.extensions.producedRouteBuilder;
+
+import java.util.function.Supplier;
+
+import io.quarkus.test.ContinuousTestingTestUtils;
+import io.quarkus.test.QuarkusDevModeTest;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+/**
+ * Test for https://github.com/apache/camel-quarkus/issues/4362
+ */
+public class ProducedRouteBuilderTest {
+
+    @RegisterExtension
+    static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
+            .setArchiveProducer(new Supplier<>() {
+                @Override
+                public JavaArchive get() {
+                    return ShrinkWrap.create(JavaArchive.class)
+                            .add(new StringAsset(
+                                    ContinuousTestingTestUtils.appProperties("camel-quarkus.junit5.message=Sheldon")),
+                                    "application.properties");
+                }
+            })
+            .setTestArchiveProducer(new Supplier<>() {
+                @Override
+                public JavaArchive get() {
+                    return ShrinkWrap.create(JavaArchive.class).addClasses(ProducedRouteBuilderET.class);
+                }
+            });
+
+    @Test
+    public void checkTests() {
+        ContinuousTestingTestUtils utils = new ContinuousTestingTestUtils();
+        ContinuousTestingTestUtils.TestStatus ts = utils.waitForNextCompletion();
+
+        Assertions.assertEquals(1L, ts.getTestsFailed());
+        Assertions.assertEquals(1L, ts.getTestsPassed());
+    }
+}
diff --git a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.java b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.java
index 011e008b70..f6cb1f84be 100644
--- a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.java
+++ b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.java
@@ -27,8 +27,8 @@ public class AfterAllCallback implements QuarkusTestAfterAllCallback {
             CamelQuarkusTestSupport testInstance = (CamelQuarkusTestSupport) context.getTestInstance();
 
             if (CallbackUtil.isPerClass(testInstance)) {
-                CallbackUtil.resetContext(testInstance);
                 testInstance.internalAfterAll(context);
+                CallbackUtil.resetContext(testInstance);
             }
 
             try {
diff --git a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterEachCallback.java b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterEachCallback.java
index dcf78de57c..eb4e43a089 100644
--- a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterEachCallback.java
+++ b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterEachCallback.java
@@ -26,15 +26,15 @@ public class AfterEachCallback implements QuarkusTestAfterEachCallback {
         if (context.getTestInstance() instanceof CamelQuarkusTestSupport) {
             CamelQuarkusTestSupport testInstance = (CamelQuarkusTestSupport) context.getTestInstance();
 
-            if (!CallbackUtil.isPerClass(testInstance)) {
-                CallbackUtil.resetContext(testInstance);
-            }
-
             try {
+                testInstance.tearDown();
                 testInstance.doAfterEach(context);
             } catch (Exception e) {
                 throw new RuntimeException(e);
+            }
 
+            if (!CallbackUtil.isPerClass(testInstance)) {
+                CallbackUtil.resetContext(testInstance);
             }
         }
     }
diff --git a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/BeforeEachCallback.java b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/BeforeEachCallback.java
index f7903726b0..93ac9e34e7 100644
--- a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/BeforeEachCallback.java
+++ b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/BeforeEachCallback.java
@@ -36,6 +36,7 @@ public class BeforeEachCallback implements QuarkusTestBeforeEachCallback {
             try {
                 testInstance.internalBeforeEach(mockContext);
                 testInstance.internalBeforeAll(mockContext);
+                testInstance.setUp();
                 testInstance.doBeforeEach(context);
             } catch (Exception e) {
                 throw new RuntimeException(e);
diff --git a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
index b0eccd5cb8..66276fa398 100644
--- a/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
+++ b/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java
@@ -219,6 +219,27 @@ public class CamelQuarkusTestSupport extends CamelTestSupport
         //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
     }
 
+    /**
+     * Method {@link CamelTestSupport#setUp()} is triggered via annotation {@link org.junit.jupiter.api.BeforeEach}.
+     * Its execution is disabled (by using overriding method without any annotation) and is executed from
+     * {@link BeforeEachCallback}
+     */
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /**
+     * Method {@link CamelTestSupport#tearDown()} is triggered via annotation
+     * {@link org.junit.jupiter.api.AfterEach}.
+     * Its execution is disabled (by using overriding method without any annotation) and is executed from
+     * {@link AfterEachCallback}
+     */
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
     /**
      * This method stops the Camel context. Be aware that on of the limitation that Quarkus brings is that context
      * can not be started (lifecycle f the context is bound to the application) .
diff --git a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/CamelTestSupportTest.java b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/CamelTestSupportTest.java
index 71caa86c36..7c5704eca8 100644
--- a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/CamelTestSupportTest.java
+++ b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/CamelTestSupportTest.java
@@ -22,7 +22,6 @@ import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -33,7 +32,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 public class CamelTestSupportTest extends CamelQuarkusTestSupport {
 
     @Override
-    @BeforeEach
     public void setUp() throws Exception {
         replaceRouteFromWith("routeId", "direct:start");
         super.setUp();
diff --git a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/IsMockEndpointsFileTest.java b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/IsMockEndpointsFileTest.java
index 3088f11e26..5629296622 100644
--- a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/IsMockEndpointsFileTest.java
+++ b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/IsMockEndpointsFileTest.java
@@ -21,7 +21,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
@@ -30,7 +29,6 @@ import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
 public class IsMockEndpointsFileTest extends CamelQuarkusTestSupport {
 
     @Override
-    @BeforeEach
     public void setUp() throws Exception {
         deleteDirectory("target/input");
         deleteDirectory("target/messages");
diff --git a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java
index cfb26bddca..263adf28f9 100644
--- a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java
+++ b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java
@@ -20,7 +20,6 @@ import io.quarkus.test.junit.QuarkusTest;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.fail;
@@ -31,7 +30,6 @@ public class RouteBuilderConfigureExceptionTest extends CamelQuarkusTestSupport
     private Predicate iAmNull;
 
     @Override
-    @BeforeEach
     public void setUp() {
         try {
             super.setUp();
diff --git a/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/userTestCases/AdviceInDoBeforeEachMethodsTest.java b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/userTestCases/AdviceInDoBeforeEachMethodsTest.java
new file mode 100644
index 0000000000..159d352c49
--- /dev/null
+++ b/test-framework/junit5/src/test/java/org/apache/camel/quarkus/test/userTestCases/AdviceInDoBeforeEachMethodsTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.test.userTestCases;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.AdviceWith;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test for https://github.com/apache/camel-quarkus/issues/4362
+ */
+@QuarkusTest
+@TestProfile(AdviceInDoBeforeEachMethodsTest.class)
+public class AdviceInDoBeforeEachMethodsTest extends CamelQuarkusTestSupport {
+
+    @Produce("direct:ftp")
+    protected ProducerTemplate template;
+
+    @Inject
+    protected CamelContext context;
+
+    @EndpointInject("mock:file:sample_requests")
+    protected MockEndpoint fileMock;
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                        .routeId("sampleRoute")
+                        .to("file:samples/");
+            }
+        };
+    }
+
+    @Override
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+        AdviceWith.adviceWith(this.context, "sampleRoute",
+                AdviceInDoBeforeEachMethodsTest::enhanceRoute);
+    }
+
+    @Test
+    void testConsumeFtpWriteToFileOne() throws Exception {
+        fileMock.message(0).body().isEqualTo("Hello World");
+        template.sendBody("direct:ftp", "Hello World");
+        fileMock.assertIsSatisfied();
+    }
+
+    @Test
+    void testConsumeFtpWriteToFileTwo() throws Exception {
+        fileMock.message(0).body().isEqualTo("Hello World");
+        template.sendBody("direct:ftp", "Hello World");
+        fileMock.assertIsSatisfied();
+    }
+
+    private static void enhanceRoute(AdviceWithRouteBuilder route) {
+        route.replaceFromWith("direct:ftp");
+        route.interceptSendToEndpoint("file:.*samples.*")
+                .skipSendToOriginalEndpoint()
+                .to("mock:file:sample_requests");
+    }
+}


[camel-quarkus] 18/18: Deprecate quarkus.camel.yaml.flow-mode

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 6f33c5bbf3b089a8b577db7907274232f6818ee8
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Feb 6 07:12:16 2023 +0000

    Deprecate quarkus.camel.yaml.flow-mode
    
    Fixes #4482
---
 .../ROOT/pages/reference/extensions/yaml-dsl.adoc  | 28 ----------------------
 .../quarkus/dsl/yaml/YamlDslConfiguration.java     |  1 +
 2 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
index 444adae77e..bb75fda1b7 100644
--- a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc
@@ -161,31 +161,3 @@ public class MyClass {
 }
 ----
 
-
-[id="extensions-yaml-dsl-additional-camel-quarkus-configuration"]
-== Additional Camel Quarkus configuration
-
-[width="100%",cols="80,5,15",options="header"]
-|===
-| Configuration property | Type | Default
-
-
-|icon:lock[title=Fixed at build time] [[quarkus.camel.yaml.flow-mode]]`link:#quarkus.camel.yaml.flow-mode[quarkus.camel.yaml.flow-mode]`
-
-If `true` the YAML DSL supports flow-mode. This allows you to write more concise routes for EIPs that have their own output like filter, aggregate, split, etc. the `steps` element can be omitted and in that case, the next processing step is automatically wired to the EIPs outputs. 
-For example, a YAML route to process only the timer events from 5 to 10 would look like: `- from:
-    uri: "timer:tick"
-    steps:
-      - filter:
-          simple: "$++{++exchangeProperty.CamelTimerCounter` range '5..10'" steps: - to: "direct:filtered" ++}++  With the flow mode enabled the same logic can be expressed in a more concise way: `- from:
-    uri: "kamelet:source"
-    steps:
-      - filter:
-          simple: "$++{++exchangeProperty.CamelTimerCounter` range '5..10'" - to: "kamelet:sink" ++}++
-| `boolean`
-| `true`
-|===
-
-[.configuration-legend]
-{doc-link-icon-lock}[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.
-
diff --git a/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java b/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
index ad7181959c..33d675cfd4 100644
--- a/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
+++ b/extensions-core/yaml-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/yaml/YamlDslConfiguration.java
@@ -57,6 +57,7 @@ public class YamlDslConfiguration {
      *
      *
      */
+    @Deprecated(forRemoval = true)
     @ConfigItem(defaultValue = "true")
     public boolean flowMode;
 }


[camel-quarkus] 04/18: Add platform-http test for retrieving an HTTP header with no value

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 2.13.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8a1f81d6064b654084eac349286775dbddfdb54e
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Jan 16 07:47:12 2023 +0000

    Add platform-http test for retrieving an HTTP header with no value
---
 .../platform/http/it/PlatformHttpRouteBuilder.java     | 11 +++++++++++
 .../component/http/server/it/PlatformHttpTest.java     | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)

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 2003c6e599..56290759f5 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
@@ -147,6 +147,17 @@ public class PlatformHttpRouteBuilder extends RouteBuilder {
                 .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
                 .setBody().constant("");
 
+        from("platform-http:/empty/header")
+                .process(exchange -> {
+                    Message message = exchange.getMessage();
+                    String header = message.getHeader("my-header", String.class);
+                    if (header != null) {
+                        message.setBody("Header length was " + header.length());
+                    } else {
+                        message.setBody("Header was not present");
+                    }
+                });
+
         // Path parameters
         rest()
                 .get("/platform-http/hello-by-name/{name}")
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 84d442b1b6..da6d35b9ec 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
@@ -361,6 +361,24 @@ class PlatformHttpTest {
                         "component", is(PlatformHttpComponent.class.getName()));
     }
 
+    @Test
+    public void emptyHeader() {
+        RestAssured.given()
+                .header("my-header", "")
+                .get("/empty/header")
+                .then()
+                .statusCode(200)
+                .body(equalTo("Header length was 0"));
+
+        // Verify that if the expected header is not found that we get the expected response
+        RestAssured.given()
+                .header("my-other-header", "")
+                .get("/empty/header")
+                .then()
+                .statusCode(200)
+                .body(equalTo("Header was not present"));
+    }
+
     private static Method[] httpMethods() {
         return Method.values();
     }