You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/06/13 12:49:59 UTC

[GitHub] [camel-quarkus] JiriOndrusek opened a new pull request, #3847: CamelTestSupport style of testing #3511

JiriOndrusek opened a new pull request, #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847

   fixes https://github.com/apache/camel-quarkus/issues/3511
   
   This is a draft with a simple POC to start a discussion about camel way of testing in camel-quarkus.
   
   I tried to add a functionality of `CamelTestSupport` into the camel-quarkus.
   I created our own annotation `CamelQuarkusTest`, which should be helpful for creating some Processors to enhance test functionality, but in this POC it is unused.
   
   I copied all tests from the [camel git repo](https://github.com/apache/camel/tree/camel-3.17.0/core/camel-core/src/test/java/org/apache/camel/processor/interceptor), which should cover bigger part of  the required functionality.
   
   As you can see in the draft, each test has to be annotated with `@CamelQuarkusTest` and should extend `CamelQuarkusTestSupport`.
   
   There are a few limitations:
   * Quarkus runs all test within the smallest number of restarting quarkus engine (which means that quarkius starts before all tests and finishes after all the tests), therefore Camel context is created and started at the beginning of the lifecycle. Therefore tests has to be aware, that the context could be modified by the other tests (and reset mock endpoints for example or take care of it globally). To avoid this behavior, the simplest (but not performance wise) solution is to add annotation `@TestProfile`, which instructs Quarkus to restart the engine before running the test.
   * The fact that the camel context is already started, limits several usecases, which requires context restart (like debugger).
   * JUnit5 is not aware of quarkus's classloader and context, therefore all code (like junit5's callback after/before *) has to be rewritten into the Quarkus's [callbacks](https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback) (see for example `BeforeEachCallback`. added by this draft)
   * Properties override does not work, but it has to be investigated further whether this functionality should work in camel-quarkus (Test `UseOverridePropertiesWithPropertiesComponentTest`)
   * I enhanced a `Injectionpointsprocessor` to detect duplications of the synthetic beans, produced by tests. This code is just a "basic" POC to show theway of proper solution. (We can not register synthetic beans for each tests, becauseall of them are part of the context and there can be no duplicated beans. It is not possible to produce different beans with the same name)
   
   
   Some little changes has to be done also on camel side (to allow overriding of some test methods). For the POC, following changes are necessaery: https://github.com/apache/camel/compare/camel-3.17.0...JiriOndrusek:camel-quarkus-test-support
   
   
   WDYT? @ppalaga @jamesnetherton @zhfeng @aldettinger 
   
   I thinng that this "feature" is quite complicated and should be discussed. In this POC I tried to show one possible way of resolving some problems. From my POV similar approach should work and should be helpful for users. In case we can add the full stop and start capabilty of the camel context, this would help this case a lot. Even without it, users should be able to use a big part of the functionality of camel test support. In case that tests are written safely, there might not be necessary to use `@TestProfile` and therefore avoid the performance issues.
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r917806795


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1156350759

   @jamesnetherton  I reworked the draft and put the sources into `test-framework/junit5`.
   
   It's possible to *not* use `@TestProfile`. I managed to limit the number of `@TestProfile` annotations to 2 in the selected tests subset
   
   * The main problem is caused by not stopping/starting the camel context after each test. I'll try to dig into the conf. option mentioned by @zhfeng.
   (for example following interceptor [InterceptSendToMockEndpointStrategy](https://github.com/apache/camel/blob/main/components/camel-mock/src/main/java/org/apache/camel/component/mock/InterceptSendToMockEndpointStrategy.java) is not unregistered after the use, thus affecting following tests.)
   
   I'm not sure how find all features which may be affected but not-restarting came context. Therefore introducing this functionality for the test would be 100% covering solution (in comparison to clear the context in quarkus test callbacks)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1164349671

   @aldettinger Thanks for your comment!
   
   > There is excludeTestSyntheticBeanDuplicities in InjectionPointProcesor. Is it useful to run it when not testing ? Would there be a way to do this step only in test mode ? if make sense
   
   I'll look into that in case it is possible to exclude duplications for the beans extendsing `CamelQuarkusTestSupport`, it would be great (or if the code could help me inn my code)
   
   > Is there a mix in the current test of the PR ? e.g. AzureStorageBlobProcessor is modified
   
   It shouldn't be. It is probably a result of the bad rebasing on my side. I will remove all unnecessary changes before making the PR final.
   
   > Naming is hard :) test-framework/junit5, if we implement pure annotation based tests in the future, it might also be called junit5 ?
   
   It could make sense to change the name of this module to `jvm-came-support` (or similar) to pinpoint tha fact, that it adds support of `CamelTestSupport`
   
   > The PR suggest that UseOverrideProperties is finally working ?
   
   Yes.
   
   > Would we gain value by adding a test like [RouteBuilderConfigureExceptionTest](https://github.com/apache/camel/blob/main/components/camel-test/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java)
   
   I'll look into that.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1211687520

   @JiriOndrusek Are we done with changes now?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941337085


##########
poms/bom/pom.xml:
##########
@@ -1849,6 +1849,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-directvm</artifactId>
+                <version>${camel.version}</version>
+            </dependency>

Review Comment:
   Our BOM flattener takes care that we manage all camel artifacts that we depend on directly or transitively. The flattener can add it automatically. camel-test-junit5 depends on it. That's why it was added to the BOM.
   
   But still the question is whether we can exclude camel-directvm without any damage for end users?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922074188


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(

Review Comment:
   I add a text into the `UnsupportedOperationException`, which is thrown in case that context is re-started with `CamelQuarkusTestSupport`. This will make the exception understandable for users. @ppalaga What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1191129352

   New module `junit5-extension-tests` was added. This modue contains a test which covers continuous testing (also covers the use case when all camel component are in test scope)`
   
   I noticed that methods `afterAll`, `afterEach`, `afterTestExecution`, `beforeAll` and `beforeEach` are not executed (intentionally) and therefore I prepared methods `doAfterAll`, `doAfterConstruct`, `doAfterEach`, `doBeforeEach` and `doBeforeAll, which are called from quarkus callbacks (see https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]). I also put a line into the doc describing the change.
   
   I put `final` to all not used methods (`afterAll`, `afterEach`, `afterTestExecution`, `beforeAll` and `beforeEach`). Now it is not possible to override this methods. (Without `final`, the code would seem correct but it wouldn't be executed.) @jamesnetherton,  @zbendhiba  what do you think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916825761


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   From my PoV it would be nice to have this method final. (The whole CQ testing is based on the fact that context is created with the quarkus engine. Code in this PR changes the behavior of the method to use this context)
   **BUT** I have seen (and used) code like this:
   
   ```
       @Override
       protected CamelContext createCamelContext() throws Exception {
           CamelContext context = super.createCamelContext();
           //do something with context
           return context;
       }
   ```
   
   The whole point of this PR is to make transfer from the `CamelTestSupport` way of testing to CQ. Making this method final would make it harder in similar cases.  Therefore I vote for **NOT** making this method final.
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154831387

   @zhfeng Thanks for pointing to the config! I'll try to integrate it into the PoC


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154933979

   > would it make sense to add `-jvm`
   
   I'd prefer to not add suffixes to the artifact ids and cover native not being supported with documentation and / or code that can detect that scenario.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r938639850


##########
poms/bom/pom.xml:
##########
@@ -1849,6 +1849,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-directvm</artifactId>
+                <version>${camel.version}</version>
+            </dependency>

Review Comment:
   I see that this is a transitive of camel-test-junit5, but I still wonder whether it is really needed on Camel Quarkus?
   IIRC, we agreed recently not to port camel-directvm to CQ. But when it soaks to end user tests in this way, it might awake a false impression that it is supported on CQ. Would it perhaps be possible to exclude camel-directvm from camel-test-junit5? I would not mind filing a follow up for this if nobody knows the answer from top of her head.



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>

Review Comment:
   Is slf4j-api really needed? I have not found any use of it.



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>

Review Comment:
   Why not `<scope>test</scope>`?



##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloET.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+
+@QuarkusTest
+public class HelloET extends CamelQuarkusTestSupport {
+
+    @Test
+    public void hello1Test() throws Exception {
+        Files.createDirectories(testDirectory());
+        Path testFile = testFile("hello.txt");
+        Files.write(testFile, "Hello ".getBytes());

Review Comment:
   ```suggestion
           Files.write(testFile, "Hello ".getBytes(StandardEncodings.UTF_8));
   ```



##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>

Review Comment:
   Could we perhaps use the same logging facade as quarkus-junit5? I guess it is jboss logging.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport

Review Comment:
   Please add some class level JavaDoc: what is this class for? What are the differences and gotchas against CamelTestSupport?



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle

Review Comment:
   JavaDoc
   



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {

Review Comment:
   JavaDoc
   



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }

Review Comment:
   Is this method really needed?



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }
+
+    @Override
+    protected void startCamelContext() {
+        //context has already started
+    }

Review Comment:
   JavaDoc? Should be final?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>

Review Comment:
   Why not `<scope>test</scope>`?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>

Review Comment:
   This is a transitive of camel-quarkus-junit5. Can we perhaps remove it?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>

Review Comment:
   Why not `<scope>test</scope>`?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>

Review Comment:
   This seems to be a transitive of other deps here. Could we perhaps remove it?



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)

Review Comment:
   Why is this not a proper method level JavaDoc `Does nothing. All necessary tasks are performed in <className>.beforeEach()` ? End users might be interested in this info. 



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }

Review Comment:
   JavaDoc? Shouldn't be final?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-file</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>

Review Comment:
   If all deps here are moved to `<scope>test</scope>`, we could perhaps move all the stuff from here to `camel-quarkus-junit5` and perhaps also eliminate camel-quarkus-test-framework? Less modules would be better, I think.
   
   Hm... now seeing that there are other tests in camel-quarkus-junit5. But still, maybe the deps here and there are similar enough?



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>

Review Comment:
   Are we using this somewhere?



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)

Review Comment:
   Please transform this to a method level JavaDoc.



##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>

Review Comment:
   It looks like this module is not executed anywhere on GH actions? 
   We need to add something like
   
   ```
         - name: cd test-framework/junit5-extension-tests && mvn test
           run: |
             cd test-framework/junit5-extension-tests
             ../mvnw ${MAVEN_ARGS} ${BRANCH_OPTIONS} \
               -Dformatter.skip -Dimpsort.skip -Denforcer.skip -Dcamel-quarkus.update-extension-doc-page.skip \
               test
   ```
   before this line https://github.com/apache/camel-quarkus/blob/main/.github/workflows/ci-build.yaml#L240



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {

Review Comment:
   JavaDoc



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback

Review Comment:
   JavaDoc



##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>

Review Comment:
   Uh, oh, does this really have to be a runtime dep? I'd be fine with having it with `<scope>test</scope>` for our own testing, but I do not think we should pass it to end users. They should choose their own assertion lib.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {

Review Comment:
   JavaDoc



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {

Review Comment:
   JavaDoc
   



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {

Review Comment:
   JavaDoc
   



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus

Review Comment:
   JavaDoc: should user's override this? At which time is it called? Any example of an intended use?



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {

Review Comment:
   I think this one should be final with JavaDoc:
   
   ```
   This method is not called on Camel Quarkus because the `CamelRegistry` is created and owned by Quarkus CDI container. If you need to customize the registry upon creation, you may want to override {@link #createCamelContext()} in the following way:
   
       @Override
       protected CamelContext createCamelContext() throws Exception {
           CamelContext ctx = super.createCamelContext();
           Registry registry = ctx.getRegistry();
           // do something with the registry...
           return ctx;
       }
   
   ```



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {

Review Comment:
   JavaDoc



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   Good point! 
   Unluckily, it looks like CamelTestSupport does not offer any dedicated way to customize the context instance upon creation. 
   So we are rather forced to keep the method non-final so that end users can customize the context as they need.
   
   At the same time, I'd vote for the following:
   
   * Add a piece of JavaDoc to the method saying something like 
   
   ```
   Feel free to override this method for the sake of customizing the instance returned by this implementation. Do not create your own CamelContext instance, because there needs to exist just a single instance owned by Quarkus CDI container. There are checks in place that will make your tests fail if you do otherwise.
   ```
   
   * Add some checks asserting that `CamelTestSupport.context == CamelQuarkusTestSupport.context`. E.g. in 
     * override of `context()` method 
     * override of `bindToRegistry()`
     * override of `postProcessTest()`



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }
+
+    @Override
+    protected void startCamelContext() {
+        //context has already started
+    }
+
+    boolean isWasUsedRouteBuilder() {
+        return wasUsedRouteBuilder;
+    }

Review Comment:
   Is this method needed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] osmman commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
osmman commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r938735447


##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloResource.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;

Review Comment:
   It looks like a typo in package name `apachecamel`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940986448


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   I implemented the above suggestion from @ppalaga 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916814996


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.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.test;
+
+import io.quarkus.test.junit.callback.QuarkusTestAfterAllCallback;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+
+public class AfterAllCallback implements QuarkusTestAfterAllCallback {
+
+    @Override
+    public void afterAll(QuarkusTestContext context) {
+        CamelQuarkusTestSupport testInstance = (CamelQuarkusTestSupport) context.getTestInstance();

Review Comment:
   Fixed. This was the reason of failed `rest-json` test.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessaryu code was moved into quarkus's callback

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r923015532


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(
+                "In case that the test based on CamelQuarkusTestSupport throws this exception, " +
+                        "be aware that re-starting of context is not possible. " +
+                        "(See https://camel.apache.org/camel-quarkus/2.10.x/user-guide/testing.html)");

Review Comment:
   We need to be a bit careful about linking to docs because 2.10.x is not LTS and will get removed at some point.
   
   Personally, I would just throw a plain `UnsupportedOperationException` without the message.
   
   We could add some notes into the docs about the registry. E.g if you need to bind beans to it, then you can: 
   
   * Use CDI producers
   * Use the Camel `@BindToRegistry` annotation
   * `@Inject` the `Registry` into the test
   * `@Inject` the `CamelContext` into the test and get a handle on the registry from it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] essobedo commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
essobedo commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1153937591

   Just to let you know that in case of `camel-test-main`, we propose an implementation that is purely annotation based to avoid extending any classes like in SpringBoot more details in https://issues.apache.org/jira/browse/CAMEL-17690 / https://github.com/apache/camel/pull/7041


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] essobedo commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
essobedo commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154006124

   
   > @essobedo  My POC aims to help users migrating the old tests extending `CamelTestSupport`. 
   
   @JiriOndrusek I see it makes sense indeed. It was just in case it could be helpful to know sorry for the noice 😄 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940950732


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {

Review Comment:
   done



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940949748


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] osmman commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
osmman commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r938735447


##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloResource.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;

Review Comment:
   It looks like a typo in package name. I guess it should be `org.apache.camel`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940954618


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1185457648

   > > I left some more feedback.
   > > One other observation - I couldn't get a simple `CamelQuarkusTestSupport` test to work in a project where there is an existing `RouteBuilder` impl.
   > > E.g I amended the `rest-json` example on the `camel-quarkus-main` branch of `camel-quarkus-examples`, added `camel-quarkus-junit5` and a simple test. The test just seems to hang and do nothing.
   > 
   > Something that came to my mind, we may also want to check there's no regression for the [continuous testing](https://quarkus.io/guides/continuous-testing) in dev mode.
   
   @zbendhiba I tried the continuous testing on https://github.com/apache/camel-quarkus-examples/tree/main/rest-json, I works.
   But I'm not sure how to cover it via JUnit test in the module. It doesn't seem possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r926332951


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(
+                "In case that the test based on CamelQuarkusTestSupport throws this exception, " +
+                        "be aware that re-starting of context is not possible. " +
+                        "(See https://camel.apache.org/camel-quarkus/2.10.x/user-guide/testing.html)");

Review Comment:
   I removed the link and kept the rest, as we discussed,



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922069440


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.
+* Camel Quarkus lifecycle does not allow to start/stop Camel context. Context is started before execution of the first test and closed after the finish of the last one. Test has to be written with consideration with this limitation. If it is not possible to write a test with such limitation, `@TestProfile` has to be used. Test profile forces quarkus to restart its engine, therefore it creates a new Camel context (see the https://quarkus.io/guides/getting-started-testing#testing_different_profiles/[documentation] about this feature).

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r932102234


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/TestConfigSourceFactory.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.common.MapBackedConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class TestConfigSourceFactory implements ConfigSourceFactory {

Review Comment:
   > achieve the same output as is with default `CamelTestSupport`
   
   How is the output in `CamelTestSupport` different on vanilla Camel to that of Camel Quarkus? Isn't the same log content being produced on all platforms from `CamelTestSupport`?
   
   How the logs are formatted is governed by the log framework configuration. AFAIK, camel makes no assumptions about this.
   
   I see it as more critical that the test user experience is the same as in Camel. The formatting of the logs is not so important IMO.
   
   Or am I misunderstanding something?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916830546


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   I'll try to use similar code with `super.createCamelContext()` in CQ, whether it behaves in the way as before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1161846240

   @jamesnetherton The selection of tests, which are currently in the draft, works -> all of them are successful.
   There are several "problems to be solved":
   
   - I have to change detection of synthetic bean removal, because it doesn't consider  parents - it should be easy
   - There is a test asserting number of  calls of some callbacks (they are different in 'perClass' vs 'perMethod' mode) - refactor is not finished
   - I have to configure logging to mimic the behavior of camel
   - Probably more small issues to be covered
   
   I'm leveraging the fact, that I can "suspend" and "resume" camel context. If context is suspended, camel skips several configurations (like start of the routes) because camel "thinks" that context is not started. I can then resume context and make it work even when context was in reality not stopped.
   
   I know that this is still a PoC, but it seems promising. I personally think that i need to run more tests using  `CamelQuarkusTestSupport` to be sure it works and covers all we need. 
   
   I plan to create copies of "an interesting tests" from camel (usually core ones), which could "break" this feature - to see how stable it is.
   Do you have any better idea how to cover all we need? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r920039028


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.
+* Camel Quarkus lifecycle does not allow to start/stop Camel context. Context is started before execution of the first test and closed after the finish of the last one. Test has to be written with consideration with this limitation. If it is not possible to write a test with such limitation, `@TestProfile` has to be used. Test profile forces quarkus to restart its engine, therefore it creates a new Camel context (see the https://quarkus.io/guides/getting-started-testing#testing_different_profiles/[documentation] about this feature).

Review Comment:
   ```suggestion
   * Camel Quarkus does not support stopping and re-starting the same `CamelContext` instance within the life cycle of a single application. You will be able to call `CamelContext.stop()`, but `CamelContext.start()` won't work.
   * Starting and stopping `CamelContext` in Camel Quarkus is generally bound to starting and stopping the application and this holds also when testing. 
   * Starting and stopping the application under test (and thus also `CamelContext`) is under full control of Quarkus JUnit Extension. It prefers keeping the application up and running unless it is told to do otherwise.
   * Hence normally the application under test is started only once for all test classes of the given Maven/Gradle module.
   * 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] 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.)
   ```



##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.

Review Comment:
   ```suggestion
   * The test class has to be annotated with `@io.quarkus.test.junit.QuarkusTest` and has to extend `org.apache.camel.quarkus.test.CamelQuarkusTestSupport`.
   ```



##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.
+* Camel Quarkus lifecycle does not allow to start/stop Camel context. Context is started before execution of the first test and closed after the finish of the last one. Test has to be written with consideration with this limitation. If it is not possible to write a test with such limitation, `@TestProfile` has to be used. Test profile forces quarkus to restart its engine, therefore it creates a new Camel context (see the https://quarkus.io/guides/getting-started-testing#testing_different_profiles/[documentation] about this feature).
+The `CamelQuarkusTestSupport` implements `QuarkusTestProfile`, therefore the test class could be used as a value for `@TestProfile`.
+*  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.
+
+[source,java]
+----
+@QuarkusTest
+@TestProfile(SimpleTest.class) //necessary only if "newly created" context is required for the test (worse performance)
+public class SimpleTest extends CamelQuarkusTestSupport {
+    ...
+}
+----
+

Review Comment:
   Did we say somewhere that they need to add camel-quarkus-junit5 preferably in test scope to be able to use CamelQuarkusTestSupport?



##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.

Review Comment:
   Is this really relevant for end users? They are not supposed to use org.junit.jupiter.api.extension.BeforeEachCallback. That one is for JUnit 5 extension developers, no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r905035507


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,20 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== Testing with `CamelTestSupport` in JVM mode

Review Comment:
   @ppalaga I added a chapter about jvm testing. Fro my PoV I'd like to add a list of features, which are supported (and covered by junit tests)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r905902556


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,20 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== Testing with `CamelTestSupport` in JVM mode

Review Comment:
   The title is a bit misleading IMO, because CamelTestSupport does not work on Quarkus. 
   
   How about "`CamelTestSupport` style of testing" or "Testing with `CamelQuarkusTestSupport` in JVM mode"? 
   
   Also in the introductory sentence, I think it would be good to give some context by including link to the page where CamelTestSupport is documented. E.g. 
   
   > If you used plain Camel before, you may know `https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport]` already. Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940956175


##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940955915


##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940963869


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-file</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>

Review Comment:
   @ppalaga The intention od this module is to contain extension test (for example continuos dev). The rest of the test is in the main module `junit5`. Therefore the dependencies required by both modules could (and are) a little bit different. I would say to keep them as they are. What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940963869


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-file</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>

Review Comment:
   @ppalaga The intention od this module is o contain extension test (for example continuos dev). The rest of the test is n the maon module `junit5`. Therefor the dependencies required by both module could (and are) a little bit different. I would say to keep them as they are. What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941328229


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-file</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>

Review Comment:
   +1 if you see a reason.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1211690904

   > @JiriOndrusek Are we done with changes now?
   
   Yes, the last 2 changes was the fix pointed by my last comment. Sorry for not stating clearly, that work is finished.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1216238482

   Many thanks @JiriOndrusek for the great work !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922070988


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.
+* Camel Quarkus lifecycle does not allow to start/stop Camel context. Context is started before execution of the first test and closed after the finish of the last one. Test has to be written with consideration with this limitation. If it is not possible to write a test with such limitation, `@TestProfile` has to be used. Test profile forces quarkus to restart its engine, therefore it creates a new Camel context (see the https://quarkus.io/guides/getting-started-testing#testing_different_profiles/[documentation] about this feature).
+The `CamelQuarkusTestSupport` implements `QuarkusTestProfile`, therefore the test class could be used as a value for `@TestProfile`.
+*  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.
+
+[source,java]
+----
+@QuarkusTest
+@TestProfile(SimpleTest.class) //necessary only if "newly created" context is required for the test (worse performance)
+public class SimpleTest extends CamelQuarkusTestSupport {
+    ...
+}
+----
+

Review Comment:
   I added this information into the doc before list of limitations.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922068713


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1177323272

   3.18.0 has been merged to `main` now so you can target that branch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1180259464

   There is a problem with the file for logging. This PR configures the logger in the same wa as camel does for `CamelTestSupport`, but there seems to be an error on quarkus, which puts the majority of the log into `target/quarkus.log`. See my [comment](https://github.com/quarkusio/quarkus/issues/25424#issuecomment-1180255696) to the ticket.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r917851145


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   I'd vote for it to be final, but I don't have strong opinion on it.
   IMHO, there's a migration anyway from `CamelTestSupport` to `CamelQuarkusTestSupport`, and we could document that users would want either to delete the method or keep only the part they'd want to configure the context. 
   I'm wondering if certain other methods here should be final too, example `startCamelContext`, `beforeAll`, `stopCamelContext`... 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r932112711


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/TestConfigSourceFactory.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.common.MapBackedConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class TestConfigSourceFactory implements ConfigSourceFactory {

Review Comment:
   I'm sorry I overlooked the location of log configuration in `camel-test` module. My advice doesn't make sense, therefore the whole class as you suggested is pointless. (I thought that the camel-test-junit5 also defines default log configuration, therefore the class. Because it is not correct, the class shouldn't be part of the PR. It will be removed)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r932117299


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/TestConfigSourceFactory.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.common.MapBackedConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class TestConfigSourceFactory implements ConfigSourceFactory {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940951103


##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloResource.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940952545


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940955565


##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloET.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+
+@QuarkusTest
+public class HelloET extends CamelQuarkusTestSupport {
+
+    @Test
+    public void hello1Test() throws Exception {
+        Files.createDirectories(testDirectory());
+        Path testFile = testFile("hello.txt");
+        Files.write(testFile, "Hello ".getBytes());

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940952762


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940953662


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940962221


##########
poms/bom/pom.xml:
##########
@@ -1849,6 +1849,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-directvm</artifactId>
+                <version>${camel.version}</version>
+            </dependency>

Review Comment:
   @ppalaga  I'm not sure, how this dependency got there. It was not part of my code, perhaps some wrong rebasing put it there. I can see this dependency here: https://github.com/apache/camel-quarkus/blob/main/poms/bom/pom.xml#L1933-L1937



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941359508


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-file</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>

Review Comment:
   thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1177391341

   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1161904146

   Is there already a piece of user guide that would sketch how to use this? I have not seen it in this PR, but maybe I have just overseen it because there are many files.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
aldettinger commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1181371859

   In my opinion, that totally makes sense. Camel has been there for a long
   time and there are large camel-test bases out there.
   Offering something to simplify the migration path from camel 2.x to
   camel-quarkus is a good value, even if there are manual steps involved.
   
   On Tue, Jul 12, 2022 at 8:23 AM JiriOndrusek ***@***.***>
   wrote:
   
   > I meant this PoC like a first step in recommended migration of the tests.
   > If user has a lot of tests based on CamelTestSupport and would like to
   > try the CQ in no time. It should be nice to replace CamelTestSupport with
   > CamelQuarkusTestSupport, annotate test classes with @QuarkusTest and be
   > able to run those tests in JVM.
   >
   > This PoC is not meant to bring a better approach of testing (like
   > apache/camel#7041 <https://github.com/apache/camel/pull/7041> in Camel).
   >
   > I can imagine that there will be another step, which would allow users to
   > migrate their tests into the newer way of testing. And in that time,
   > CamelQuarkusTestSupport should reflect that. Migration quide (from the CamelQuarkusTestSupport
   > into the new way of testing) should be provided.
   >
   > @zbendhiba <https://github.com/zbendhiba> , @aldettinger
   > <https://github.com/aldettinger> what do you think about this approach?
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1181364093>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AFJABNJQZ24MN5KJLA4MRE3VTUFPHANCNFSM5YUDV7TQ>
   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940949180


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {

Review Comment:
   done



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940948926


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)

Review Comment:
   doe



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941232418


##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-bean</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-management</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <runOrder>alphabetical</runOrder>

Review Comment:
   @ppalaga There are 2 tests, which asserts whether methods like `afterAll` was called (and the number of their executions) . In camel component code the test starts runnable and logs an error if there is a problem after a while  (see [test](https://github.com/apache/camel/blob/main/components/camel-test/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/CreateCamelContextPerTestTrueTest.java#L113)
   Unfortunately there is no way how to fail a test with such failure.
   
   I kept the same code in our tests 
   + and I created second test, which is alphabetically after the first one (`CallbacksPerTestFalse01Test` and `CallbacksPerTestFalse02Test`). The second test verifies the tmp files (files in /target/) and fails in case that there is a problem. For that purpose I configured `maven-surefire-plugin` to use alphabetical order of test classes. I know that this is not standard approach, so I'm pointing at it, whether it is acceptable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940954272


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940946730


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r923015532


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(
+                "In case that the test based on CamelQuarkusTestSupport throws this exception, " +
+                        "be aware that re-starting of context is not possible. " +
+                        "(See https://camel.apache.org/camel-quarkus/2.10.x/user-guide/testing.html)");

Review Comment:
   We need to be a bit careful about linking to docs because 2.10.x is not LTS and will get removed at some point.
   
   Personally, I would just throw a plain `UnsupportedOperationException` without the message.
   
   We could add some notes into the docs about the registry. E.g if you need to bind beans to it, then you can: 
   
   * Use CDI producers
   * Use the Camel `@BindToRegistry` annotation
   * `@Inject` the `Registry` 
   * `@Inject` the `CamelContext` into the test and get a handle on the registry from it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga merged pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga merged PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r932094759


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/TestConfigSourceFactory.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.common.MapBackedConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class TestConfigSourceFactory implements ConfigSourceFactory {

Review Comment:
   @jamesnetherton  I agree, as a compromise I suggest to remove this class and add a example of configuration into the doc for the users, who would like to achieve the same output as is with default `CamelTestSupport`. Do you agree?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916819176


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport

Review Comment:
   Throwing the `UnsupportedOperationException` sounds good.
   Even if anyone override this method in `CamelQuarkusTestSupport`, it won't do anything. The only call od this method is from `createCamelContext`, which is overriden.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zhfeng commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154856015

   @JiriOndrusek But I'm not very sure that the option is effect since we have no any test for bootstrap options. :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154925283

   @jamesnetherton creating a `test-framework/junit5` sounds nice. I' refactor the draft to do it (I used  `integration-tests-support/test-support-jvm)`.
   Just an idea,because we aim the functionality for the JVM only, would it make sense to add `-jvm` to the module?
   (I'm not sure in what time-frame we can make it work in native)
   
   Using annotation driven tests seems to be nice. I still think that this mid-step (supporting old testing approaches for migration of tests) makes sense.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1180351721

   I agree that it would make sense to make several methods `final`.
   @zbendhiba I have an idea, what about creation of the `callback` methods. Something like `onContext/RegistryCreation`-> methods could be deprecated to show the intention to make initial migration easier. (and be creating of those methods, we will use `final` for the internal code). Those deprecated callbacks will be removed in the next version -> but it may help users with their migration.
   
   The only aspect we have to take into consideration, if making them final is not too strict for the users (and therefore migration is still easy enough)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1181364093

   I meant this PoC like a first step in recommended migration of the tests. If user has a lot of tests based on `CamelTestSupport` and would like to try the CQ in no time. It should be nice to replace `CamelTestSupport` with `CamelQuarkusTestSupport`, annotate test classes with `@QuarkusTest` and be able to run those tests in JVM.
   
   This PoC is not meant to bring a better approach of testing (like https://github.com/apache/camel/pull/7041 in Camel). 
   
   I can imagine that there will be another step, which would allow users to migrate their tests into the newer way of testing. And in that time, `CamelQuarkusTestSupport` should reflect that. Migration quide (from the `CamelQuarkusTestSupport into the new way of testing) should be provided.`
   
   @zbendhiba , @aldettinger  what do you think about this approach?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1181617301

   @JiriOndrusek Thanks for clarifying this. Maybe we could figure out how to explain this also in the documentation. 
   Having an automatic way of migrating `CamelTestSupport` tests to the new `CamelQuarkusTestSupport`, would indeed bring much value to the users that use Camel from a long time.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1153975565

   @essobedo Thanks for showing me the latest approach used in camel. My POC aims to help users migrating the old tests extending `CamelTestSupport`. I'll look into the feature you shared to me tomorrow to see wether it covers also this feature. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zhfeng commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154801804

   >The fact that the camel context is already started, limits several usecases, which requires context restart (like debugger).
   
   I think we have an option to disable the autoStart? 
   https://github.com/apache/camel-quarkus/blob/f8604b517d78eaf7754cfd21c098ad57049791b0/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java#L75-L82


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1162686025

   > s there already a piece of user guide that would sketch how to use this? I have not seen it in this PR, but maybe I have just overseen it because there are many files.
   
   Missing doc is another issue here, I forgot to write it into my comment. Thanks for noticing.
   
   I'll write the documentation. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1164429878

   I went through the tests in https://github.com/apache/camel/tree/main/components/camel-test and i think that all "relevant" tests are already part of this PR (description of modules follows):
   
   * `'camel-test-cdi`  and `camel-test-cdi-junit5`: Tests in both modules do not extends `CamlTestSupport`, therefore it doesn't make sense to test them with this feature.
   
   * `camel-main-junit5`: This module is about starting Camel in standalone mode, it can make sense to test it on Camel Quarkus, but it is not part of the ticket and probably doesn't need to be part of the initial implementation.
   
   * `camel-test-spring` and  `camel-test-spring-junit5`: Does not make sense to run on quarkus
   * `camel-test-junit5`: Tests are part of this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940958872


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }
+
+    @Override
+    protected void startCamelContext() {
+        //context has already started
+    }
+
+    boolean isWasUsedRouteBuilder() {
+        return wasUsedRouteBuilder;
+    }

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940959194


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }
+
+    @Override
+    protected void startCamelContext() {
+        //context has already started
+    }

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941366306


##########
poms/bom/pom.xml:
##########
@@ -1849,6 +1849,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-directvm</artifactId>
+                <version>${camel.version}</version>
+            </dependency>

Review Comment:
   I excluded `camel-directvm` from `junit5` module - it doesn't case any problem.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940949415


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback

Review Comment:
   done



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940958159


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940957551


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1182918055

   > I left some more feedback.
   > 
   > One other observation - I couldn't get a simple `CamelQuarkusTestSupport` test to work in a project where there is an existing `RouteBuilder` impl.
   > 
   > E.g I amended the `rest-json` example on the `camel-quarkus-main` branch of `camel-quarkus-examples`, added `camel-quarkus-junit5` and a simple test. The test just seems to hang and do nothing.
   
   
   Something that came to my mind, we may also want to check there's no regression for the [continuous testing](https://quarkus.io/guides/continuous-testing) in dev mode.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922075156


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(
+                "In case that the test based on CamelQuarkusTestSupport throws this exception, " +
+                        "be aware that re-starting of context is not possible. " +
+                        "(See https://camel.apache.org/camel-quarkus/2.10.x/user-guide/testing.html)");

Review Comment:
   I add a text into the `UnsupportedOperationException`, which is thrown in case that context is re-started with `CamelQuarkusTestSupport`. This will make the exception understandable for users. @ppalaga What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r905906678


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,20 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== Testing with `CamelTestSupport` in JVM mode

Review Comment:
   Makes sense, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1154871438

   I think we should create a new top level module for this stuff. I see `integration-tests-support` as an internal thing to support our project and not something that we put into the hands of our users.
   
   So maybe we do like Quarkus does and have `test-framework` module where we can build up a set of testing libraries. So initially something like `test-framework/junit5`. Which would give us an artifact named similar to the plain Camel equivalent `org.apache.camel.quarkus:camel-quarkus-junit5`.
   
   
   Agree with @essobedo that annotation driven tests would be good to have eventually. The more consistency we have with the other Camel runtimes, the better it is for our users. But lets take things one step at a time....
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zbendhiba commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1191150916

   > > > I left some more feedback.
   > > > One other observation - I couldn't get a simple `CamelQuarkusTestSupport` test to work in a project where there is an existing `RouteBuilder` impl.
   > > > E.g I amended the `rest-json` example on the `camel-quarkus-main` branch of `camel-quarkus-examples`, added `camel-quarkus-junit5` and a simple test. The test just seems to hang and do nothing.
   > > 
   > > 
   > > Something that came to my mind, we may also want to check there's no regression for the [continuous testing](https://quarkus.io/guides/continuous-testing) in dev mode.
   > 
   > @zbendhiba I tried the continuous testing on https://github.com/apache/camel-quarkus-examples/tree/main/rest-json, Ii works. But I'm not sure how to cover it via JUnit test in the module. It doesn't seem possible.
   
   @JiriOndrusek  I just wanted to know if it still works fine. I don't think we can do a Unit test. Many tanks !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940954929


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940968086


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>

Review Comment:
   @ppalaga shouldn't be the command more like  ` cd test-framework && mvn test` instead of ` cd test-framework/junit5-extension-tests && mvn test` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941133675


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>

Review Comment:
   I kept it `cd test-framework && mvn test` and I can see successful run in the current CI job `@github-actions
   Camel Quarkus CI / functional-extension-tests-and-docs (pull_request) Successful in 8m`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1208238586

   Majority of the issues is fixed, I'll close appropriate conversations tomorrow morning.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1209284443

   I found a small difference between `CaqmelTestSupport` and `CamelQuarkusTestSupport`. 
   CameTestSupport offers a method `beforeAll` -> which execution depends on `@TestInstance(TestInstance.Lifecycle.PER_CLASS)` vs `@TestInstance(TestInstance.Lifecycle.PER_METHOD)`
   I debugged the tests and discovered, that
   
   -  with `Lifecycle.PER_CLASS` is executed **1** time.
   -  with `Lifecycle.PER_METHOD` is executed **0** time.
   
   The closest method to use with similar use-case in camel-QuarkusTestSupport`` is `doAfterConstruct`. But it is called in different way:
   
   -  With `Lifecycle.PER_CLASS` is executed **1** time.
   -  With `Lifecycle.PER_METHOD` is executed **3** time.
   
   I'll  add the difference into the documentation. I just wanted to point it out. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1158873197

   Change in Camel `main` is prepared as https://github.com/apache/camel/pull/7813


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1201204398

   I know that this PR brings a lot of changes, but from my PoV it is ready to merge.
   I'd like to ask for some (at least partial) approvals here.
   (I'm mentioning everyone who commented it this PR)
   @jamesnetherton  @aldettinger @zbendhiba @ppalaga @zhfeng 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940958388


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940955225


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+    <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5-internal</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-rest-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>

Review Comment:
   removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
aldettinger commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1164170050

   @JiriOndrusek Thanks for investing time on this subject. It's great to see that moving ahead step by step :+1: 
   
   Please find few raw comments below:
    + There is `excludeTestSyntheticBeanDuplicities` in `InjectionPointProcesor`. Is it useful to run it when not testing ? Would there be  a way to do this step only in test mode ? if make sense
   + Is there a mix in the current test of the PR ? e.g. AzureStorageBlobProcessor is modified
   + Naming is hard :) `test-framework/junit5`,  if we implement pure annotation based tests in the future, it might also be called junit5 ?
    + The PR suggest that `UseOverrideProperties` is finally working ?
    + Would we gain value by adding a test like [RouteBuilderConfigureExceptionTest](https://github.com/apache/camel/blob/main/components/camel-test/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteBuilderConfigureExceptionTest.java)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1183034006

   @JiriOndrusek sounds good, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r931982602


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/TestConfigSourceFactory.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.common.MapBackedConfigSource;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class TestConfigSourceFactory implements ConfigSourceFactory {

Review Comment:
   Thinking again about logging. We should remove this class.
   
   Logging should be left to the user to configure. This configuration only applies to the internal testing of the Camel main project. See [here](https://github.com/apache/camel/blob/main/components/camel-test/camel-test-junit5/src/test/resources/log4j2.properties#L20-L22). Users are free to configure things however they wish in their application.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r923015532


##########
extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java:
##########
@@ -81,7 +81,10 @@ public String getVersion() {
     @Override
     protected Registry createRegistry() {
         // Registry creation is done at build time
-        throw new UnsupportedOperationException();
+        throw new UnsupportedOperationException(
+                "In case that the test based on CamelQuarkusTestSupport throws this exception, " +
+                        "be aware that re-starting of context is not possible. " +
+                        "(See https://camel.apache.org/camel-quarkus/2.10.x/user-guide/testing.html)");

Review Comment:
   We need to be a bit careful about linking to docs because 2.10.x is not LTS and will get removed at some point.
   
   Personally, I would just throw a plain `UnsupportedOperationException` without the message.
   
   We could add some notes into the docs about the registry. E.g if you need to bind beans to it, then you can: 
   
   * Use CDI producers
   * Use the Camel `@BindToRegistry` annotation
   * `@Inject` the `CamelContext` into the test and get a handle on the registry from it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1186846399

   > It doesn't seem possible
   
   Some examples of testing continuous testing in dev mode here:
   
   https://github.com/quarkusio/quarkus/search?q=ContinuousTestingTestUtils


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1186895685

   > 
   
   Thanks for the link, I'll try to use the same approach to cover this test-case in via junit test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1206336013

   @ppalaga Thanks for the above comments. I'll incorporate it into the PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r941329682


##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-test-framework</artifactId>
+        <version>2.12.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-junit5-extension-tests</artifactId>

Review Comment:
   Indeed, there are tests in both submodules of test-framework. I have not realized that when writing that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1161936703

   > I plan to create copies of "an interesting tests" from camel (usually core ones), which could "break" this feature - to see how stable it is.
   
   That seems like a decent approach to me. I'm guessing you've already done this, but there are a bunch of test framework tests in Camel that we could probably take inspiration from in these modules:
   
   https://github.com/apache/camel/tree/main/components/camel-test
   
   BTW if you want the CI build to stay stable, I'd avoid `camel-main` as the target branch since it's volatile and often broken. If you only need a small change made in Camel 3.18, then it might be easier to temporarily copy that code here until the release is available.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r922072029


##########
docs/modules/ROOT/pages/user-guide/testing.adoc:
##########
@@ -226,3 +226,27 @@ class MyTest {
 ----
 
 More examples of WireMock usage can be found in the Camel Quarkus integration test source tree such as https://github.com/apache/camel-quarkus/tree/main/integration-tests/geocoder[Geocoder].
+
+== `CamelTestSupport` style of testing
+
+If you used plain Camel before, you may know https://camel.apache.org/components/latest/others/test-junit5.html[CamelTestSupport] already.
+Unfortunately the Camel variant won't work on Quarkus and so we prepared a replacement called `CamelQuarkusTestSupport`, which can be used in JVM mode.
+
+There are several limitations:
+
+* Test has to be annotated by `@QuarkusTest` and has to extend `CamelQuarkusTestSupport`.
+* Quarkus runs tests in a custom classloader which JUnit is not aware of (see the https://quarkus.io/guides/getting-started-testing#applying-interceptors-to-tests[documentation]). If JUnit's callback (i.e. `org.junit.jupiter.api.extension.BeforeEachCallback`) is used, it may not work as expected. Use the quarkus callbacks instead (see the https://quarkus.io/guides/getting-started-testing#enrichment-via-quarkustestcallback[documentation]) or use annotations like `@org.junit.jupiter.api.BeforeEach`.

Review Comment:
   I changed text to 
   
   ```
   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].
   ```
   
   , which should warn the users to be cautious about callbacks.
   @ppalaga Do you agree?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940958632


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {
+        throw new UnsupportedOperationException("won't be executed.");
+    }
+
+    @Override
+    public final void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public final void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+        try {
+            doPostTearDown();
+            cleanupResources();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    @Override
+    public final void afterEach(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    public final void afterTestExecution(ExtensionContext context) throws Exception {
+        //in camel-quarkus, junit5 uses different classloader, necessary code was moved into quarkus's callback
+    }
+
+    @Override
+    protected void stopCamelContext() throws Exception {
+        //context is started and stopped via quarkus lifecycle
+    }
+
+    @Override
+    protected void doQuarkusCheck() {
+        //can run on Quarkus
+    }
+
+    void internalBeforeAll(ExtensionContext context) {
+        super.beforeAll(context);
+    }
+
+    void internalBeforeEach(ExtensionContext context) throws Exception {
+        super.beforeEach(context);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        if (context.getRoutes().isEmpty()) {
+            wasUsedRouteBuilder = super.isUseRouteBuilder();
+            return wasUsedRouteBuilder;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void doSetUp() throws Exception {
+        context.getManagementStrategy();
+        if (!initialized) {
+            super.doSetUp();
+            initialized = true;
+        }
+    }
+
+    @Override
+    protected void doPreSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).suspend();
+        }
+        super.doPreSetup();
+    }
+
+    @Override
+    protected void doPostSetup() throws Exception {
+        if (isUseAdviceWith() || isUseDebugger()) {
+            ((FastCamelContext) context).resume();
+            if (isUseDebugger()) {
+                ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+                List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+                //addition causes removal -> it starts routes, which were added during setUp, when context was suspended
+                mcc.addRouteDefinitions(rdfs);
+            }
+        }
+        super.doPostSetup();
+    }
+
+    RoutesBuilder getRouteBuilder() throws Exception {
+        return createRouteBuilder();
+    }
+
+    @Override
+    protected void doStopCamelContext(CamelContext context, Service camelContextService) {
+        //don't stop
+    }

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r940957013


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    //Flag, whether routes was created by test's route builder and therefore should be stopped smd removed based on lifecycle
+    private boolean wasUsedRouteBuilder;
+
+    @Inject
+    protected CamelContext context;
+
+    //------------------------ quarkus callbacks ---------------
+    protected void doAfterAll(QuarkusTestContext context) throws Exception {
+    }
+
+    protected void doAfterEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    protected void doAfterConstruct() throws Exception {
+    }
+
+    protected void doBeforeEach(QuarkusTestMethodContext context) throws Exception {
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    protected Registry createCamelRegistry() {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#issuecomment-1208991625

   I closed appropriate conversations and kept 3 opened - with my questions. 
   @ppalaga  There is one comment, which I cannot resolve (there are co options in UI to make a comment or to resolve). It is fixed.
   
   >Add some checks asserting that CamelTestSupport.context == CamelQuarkusTestSupport.context. E.g. in
   override of context() method
   override of bindToRegistry()
   override of postProcessTest()


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916591978


##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return this.context;
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessaryu code was moved into quarkus's callback

Review Comment:
   Typo `necessaryu` (also repeated in other methods below).



##########
test-framework/junit5/src/main/resources/application.properties:
##########
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# no console logging
+quarkus.log.console.enable=false

Review Comment:
   Not sure embedding `application.properties` is a good idea.
   
   We're effectively forcing some (potentially undesirable) conventions on user applications.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.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.test;
+
+import io.quarkus.test.junit.callback.QuarkusTestAfterAllCallback;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+
+public class AfterAllCallback implements QuarkusTestAfterAllCallback {
+
+    @Override
+    public void afterAll(QuarkusTestContext context) {
+        CamelQuarkusTestSupport testInstance = (CamelQuarkusTestSupport) context.getTestInstance();

Review Comment:
   We need to check whether the test instance really is `CamelQuarkusTestSupport`. Otherwise it's impossible to write any `@QuarkusTest` annotated tests without extending `CamelQuarkusTestSupport`.
   
   The same applies to the other callbacks.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+        implements QuarkusTestProfile {
+
+    private boolean initialized;
+
+    @Inject
+    protected CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {

Review Comment:
   Question for everyone. Should we make this `final`? If you're free to create your own `CamelContext`, then the tests are a bit meaningless on CQ IMO.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport

Review Comment:
   I wonder if we should override `createCamelRegistry` and throw `UnsupportedOperationException`?
   
   I think there is the potential to screw things up if we enable the default registry to be replaced.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916826829


##########
test-framework/junit5/src/main/resources/application.properties:
##########
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# no console logging
+quarkus.log.console.enable=false

Review Comment:
   I'll try to set similar behavior without using `application.properties`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] JiriOndrusek commented on a diff in pull request #3847: CamelTestSupport style of testing #3511

Posted by GitBox <gi...@apache.org>.
JiriOndrusek commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r917806967


##########
test-framework/junit5/src/main/resources/application.properties:
##########
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# no console logging
+quarkus.log.console.enable=false

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org