CAMEL-17690: camel-test-main - Annotation based testing #7041
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for https://issues.apache.org/jira/browse/CAMEL-17690
Motivation
It is already possible to test a Camel main application by extending the base class
CamelMainTestSupport
but we would like to go even further by proposing an approach based on annotations likeSpringBootTest
Modifications
CamelMainTest
to configure and trigger the Camel Main test extension which supports out of the box:advices
mockEndpointsAndSkip
andmockEndpoints
-> attributes of the same nameproperties
propertyPlaceholderFileName
andpropertyPlaceholderLocations
respectivelymainClass
configurationClasses
Configure
to mark all the methods to call to configure the Camel Main ApplicationReplaceInRegistry
to mark all the methods / fields whose return value / value should replace the beans with the same name and same typeAdviceRouteMapping
to define a mapping between a route and the route builder to call to advice the routeDebuggerCallback
to implement in order to enable the debug mode