[ 
https://issues.apache.org/jira/browse/CAMEL-20837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930482#comment-17930482
 ] 

Suzanne Becker edited comment on CAMEL-20837 at 2/25/25 11:59 PM:
------------------------------------------------------------------

Hi, I have some tests that currently override 
`CamelTestSupport.startCamelContext()` in order to create a resource which 
needs access to the context before the context is started. The reason this 
resource needs access to the context is in order to disable auto-startup on 
certain routes, which is related the behavior I'm testing. 

`startCamelContext()` was deprecated in Camel 4.7 but no suggested replacement 
was provided. How can I set up my test to get access to the context before it's 
started? 


was (Author: JIRAUSER284121):
Hi, I have some tests that currently override 
`CamelTestSupport.startCamelContext()` in order to create a resource which 
needs access to the context before the context is started. The reason this 
resource needs access to the context is in order to disable auto startup on 
certain routes, which is the behavior I'm testing. 

`startCamelContext()` was deprecated in Camel 4.7 but no suggested replacement 
was provided. How can I set up my test to get access to the context before it's 
started? 

> camel-test: implement extensions for CamelTestSupport
> -----------------------------------------------------
>
>                 Key: CAMEL-20837
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20837
>             Project: Camel
>          Issue Type: Task
>          Components: camel-test
>    Affects Versions: 4.7.0, 4.8.0
>            Reporter: Otavio Rodolfo Piske
>            Assignee: Otavio Rodolfo Piske
>            Priority: Major
>             Fix For: 4.9.0
>
>
> Over the course of years, multiple additions and changes to the 
> CamelTestSupport class have made it extremely fragile, tightly coupled and 
> hard to maintain.
> Among the problems of this class:
>  * Mixing up being responsibilities
>  ** It is both a JUnit 5 extension and *also* a base test class
>  *** Which leads to multiple ways to setup and tear down the test (either via 
> extension methods or via setup/tearDown methods + the setup/tearDown from the 
> tests itself)
>  ** In addition to being also a JUnit 5 extension and a base test class ... 
> it is ALSO a BreakPoint.
>  ** And a utility class that provides helper methods (i.e.: providing utility 
> methods for useful operations - send/receive requests)
>  ** And also a test configuration class in itself (i.e.: allowing tests to 
> configure themselves by overriding methods)
>  * Over-complexity
>  ** the code tries to handle different lifecycle supported by JUnit 
>  ** along with concurrency
>  ** as well as setting up and managing the CamelContext
>  * Mix up assertions with assumptions
>  * Little control about the initialization order of the extension (itself ?) 
> via JUnit's Order annotation
>  * Three ways to manage JMX: useJMX, enableJMX, disableJMX.
>  
> To make things even worse, the wide open interfaces provided by this [class 
> have leaked to other 
> projects|https://github.com/apache/camel-quarkus/blob/main/test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java]
>  (such as Camel Quarkus).
>  
> The work on this ticket is related to transforming the 
> ContextLifecycleManagers into full-blown JUnit extensions. As this is a 
> breaking change in a few aspects, this work is planned for 4.9.0 (or whatever 
> is the next release after the next LTS).
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to