Commit 4864a79
authored
RewriteTest: framework-agnostic ExecutionContext customizer registry (#7559)
* RewriteTest: framework-agnostic ExecutionContext customizer registry
Adds `RewriteTest.defaultExecutionContextCustomizers`, a `Map<Class<?>, Consumer<ExecutionContext>>`
applied to the context built by `defaultExecutionContext`. Test framework integrations
(JUnit, TestNG, Spock, …) can register a customizer keyed by their own class without
`rewrite-test` taking a dependency on any framework; `putIfAbsent` makes registration
naturally idempotent.
First consumer: a JUnit Jupiter `BeforeAllCallback` in rewrite-gradle's test sources,
auto-detected via service loader, that loads `~/.m2/settings.xml` into the ExecutionContext.
Recipes resolving Maven artifacts during rewrite-gradle tests then honor any configured
mirror, sidestepping Maven Central rate limits (HTTP 404 + Retry-After) under parallel load.
Gradle does not normally read the user's Maven settings, so this opt-in lives entirely in
test sources of openrewrite/rewrite — not in any published API surface.
* ci: configure ~/.m2/settings.xml mirror to avoid Maven Central rate limits
Inlines the build job that previously delegated to openrewrite/gh-automation's
reusable ci-gradle workflow, and adds an `s4u/maven-settings-action` step that
writes a `~/.m2/settings.xml` with a wildcard mirror pointing at Moderne's
Artifactory cache. The MavenSettingsAutoLoadingExtension introduced earlier in
this PR loads that file into the test ExecutionContext, so recipes resolving
Maven artifacts during rewrite-gradle tests no longer hit Maven Central directly
and avoid the HTTP 404 + Retry-After throttling that's been failing CI under
parallel load.
The reusable workflow had no hook to inject extra setup steps, and inlining
keeps everything in this PR. Functionality (build, scheduled-failure Slack
notification, snapshot publish on main) is preserved.
* Revert "ci: configure ~/.m2/settings.xml mirror to avoid Maven Central rate limits"
This reverts commit a4ba99a.
* ci: configure Maven mirror via gh-automation composite actions
Switches from the gh-automation reusable workflow (`ci-gradle.yml`) to its
finer-grained composite-action form, so we can inject `s4u/maven-settings-action`
between `setup` and `build`. The action writes a `~/.m2/settings.xml` whose
wildcard mirror points at Moderne's Artifactory cache; the
MavenSettingsAutoLoadingExtension introduced earlier in this PR loads it into
the test ExecutionContext, avoiding Maven Central's HTTP 404 + Retry-After
throttling under parallel test load.
The composite actions land in openrewrite/gh-automation#94.
* ci: add Apache 2.0 header to junit-platform.properties for licenseTest1 parent 6025024 commit 4864a79
5 files changed
Lines changed: 126 additions & 15 deletions
File tree
- .github/workflows
- rewrite-gradle/src/test
- java/org/openrewrite/gradle
- resources
- META-INF/services
- rewrite-test/src/main/java/org/openrewrite/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
54 | 67 | | |
55 | 68 | | |
56 | 69 | | |
| |||
696 | 709 | | |
697 | 710 | | |
698 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
699 | 715 | | |
700 | 716 | | |
701 | 717 | | |
| |||
0 commit comments