-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing: allow bytecode transformations in QuarkusComponentTest
This commit refactors `QuarkusComponentTestExtension` to do the same class loader dance `QuarkusTestExtension` does. The test instance is created in a new, per-test class loader, and all test method invocations are forwarded to it. The new class loader is dropped at the end of the test. A stack of test instances is maintained to support `@Nested` tests. Supporting programmatically or declaratively defined config properties, programmatically configured mocks or "simplified" interceptor methods required inventing rather creative protocols for exchanging information between the two class loaders: 1. For configuration, the map of config properties and the ordinal are passed from the original CL to the extra CL verbatim, because those are basic Java types that never exist in the extra CL. 2. For mocks, the mock creation functions are registered in both CLs under deterministic keys, so registration in one CL always matches registration in the other CL. 3. For interceptor methods, we collect all the necessary information in the original CL as a data structure composed solely from basic Java types, transfer that to the extra CL, and finish registration there.
- Loading branch information
Showing
9 changed files
with
856 additions
and
363 deletions.
There are no files selected for viewing
This file contains 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
16 changes: 12 additions & 4 deletions
16
integration-tests/devmode/src/test/java/io/quarkus/test/component/ComponentFoo.java
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.