CAMEL-22891: refactoring IT using JUnit#1677
Merged
Croway merged 1 commit intoapache:mainfrom Feb 25, 2026
Merged
Conversation
oscerd
approved these changes
Feb 25, 2026
Contributor
|
please move the non test classes under |
4fef43b to
3614ed1
Compare
Croway
reviewed
Feb 25, 2026
|
|
||
| == Adding a new starter test | ||
|
|
||
| For most starters, create a class with no body: |
Contributor
There was a problem hiding this comment.
is there some automation that create ITs? I remember I saw something in the past, some .sh but I might be wrong
Contributor
Author
There was a problem hiding this comment.
there is not an automation currently, but this is useful to start implementing new tests, so I added a maven execution that is more portable than a bash script
mvn -Pgenerate -Dstarter=my-component -pl tests/camel-itest-spring-boot
3614ed1 to
119be6a
Compare
Contributor
Author
done |
119be6a to
9338583
Compare
9338583 to
59204cb
Compare
Contributor
|
merging, let's check https://ci-builds.apache.org/job/Camel/job/Camel-Spring-Boot%20Daily%20JDK17/ tomorrow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactors completely the integration tests moving from arquillian to junit, instead of creating the application to test at runtime using shrinkwrap, it uses the maven archetype. Following a part of the included readme file, to overview the steps of each test
. Archetype generation -- The
ArchetypeGenerationExtensionJUnit 6 extension generates a minimal Spring Boot project fromcamel-archetype-spring-boot. The generated project is then customized: test-scoped dependencies and the democamel-stream-starterare removed, the starter under test is added, and any extra dependencies orapplication.propertiesentries from the test config are applied.. Compilation -- The generated project is compiled via
mvn compile dependency:build-classpath, which also writes the full runtime classpath to a file for the next step.. Classloader isolation -- A child
URLClassLoaderis created with the compiled classes and all resolved dependency JARs, parented by the test classloader. Onlycamel-apiandspring-contextlive on the parent classloader so that assertion types (CamelContext,Component,DataFormat,Language,CamelClusterService) are shared.. Spring Boot startup --
SpringApplicationis loaded from the child classloader and started via reflection. ADefaultResourceLoaderpointing at the child classloader ensures the generated project'sapplication.propertiesis picked up. By default, the embedded web server is disabled (spring.main.web-application-type=none). WhenwebRequiredis set totrue, the web stack is kept and the server binds to a random port (server.port=0) to avoid conflicts during parallel execution.