rschlegel-cc opened a new issue #1981:
URL: https://github.com/apache/camel-quarkus/issues/1981


   camel-quarkus seems to be lacking a way for dealing with mocks for external 
endpoints in tests: we have Camel routes and use them in Quarkus. For testing, 
@QuarkusTest works really well and provides us with a CamelContext and 
everything else we need. 
   
   Things get tricky though when we want to mock external endpoints within 
existing routes, e.g. a call to an external HTTP service. This can be done 
using AdviceWithRouteBuilder and mockEndpointsAndSkip or more elaborate 
interceptors, but it modifies the CamelContext. Therefore tests are no longer 
independent and may fail or succeed depending on the execution order. 
   
   Using CamelTestSupport fixes this, as the CamelContext is recreated between 
tests but using a different CamelContext than the one created by QuarkusTest 
seems like a bad idea. It also seems to cause issues for certain routes, as the 
context might not contain everything that is needed, so I would assume that 
mixing CamelTestSupport and @QuarkusTest should be avoided. 
   
   To get a better idea of how this could be done I also looked at the Spring 
integration and saw that there are annotations that help with endpoint mocking 
and dealing with dirty contexts. Does something comparable (or plans for it) 
exist for camel-quarkus? If not, are there examples/best practices for dealing 
with scenarios like this? 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.

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


Reply via email to