allthingssecurity commented on code in PR #27206:
URL: https://github.com/apache/camel/pull/27206#discussion_r4165000073
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ExportTest.java:
##########
@@ -393,6 +394,29 @@ public void shouldExportOfficialKamelet(RuntimeType rt)
throws Exception {
Assertions.assertTrue(f.exists());
}
+ @ParameterizedTest
+ @MethodSource("runtimeProvider")
+ public void shouldExportKameletUsedByJavaRouteWithKnownImport(RuntimeType
rt) throws Exception {
+ // The known-import preprocessor must make the Java route compilable
before the kamelet is loaded.
+ Assumptions.assumeTrue(rt != RuntimeType.springBoot ||
Runtime.version().feature() >= 21,
+ "Spring Boot 4 requires JDK 21+");
+ Export command = createCommand(rt,
+ new String[] { "src/test/resources/JacksonKameletRoute.java"
});
Review Comment:
This is why CI is still red. Without extra args, `createCommand` ends with
`CommandLine.populateCommand(command, args)` on an empty array. picocli then
re-applies the `defaultValue` of every option not on that command line, so
`--dir` goes back to `.` (and `--quiet` to `false`). The CI output for this
test shows `Exporting as Quarkus project to: .` (and the same for Spring Boot
and Main), so `readMavenModel()` finds no `pom.xml` in `workingDir`. I checked
the reset with picocli 4.7.7 directly: after a second `populateCommand` with no
args, `--dir` is `.` again, while `--runtime` (which has no `defaultValue`) is
kept. The other tests in this class pass the three options again for this
reason:
```suggestion
Export command = createCommand(rt,
new String[] { "src/test/resources/JacksonKameletRoute.java"
},
"--gav=examples:route:1.0.0", "--dir=" + workingDir,
"--quiet");
```
Heads-up if you ran this test locally: the export to `.` copies with
`REPLACE_EXISTING`, so it overwrites `dsl/camel-jbang/camel-jbang-core/pom.xml`
and adds the exported files to the module. `git status` there is worth a look
before the next push.
On @davsclaus's second question (does the test fail on main without the
properties line?): `camel-kamelet-main` has a compile dependency on
`camel-jackson`, so `jackson-annotations` is already on this module's test
classpath. Once CI is green, it would be good to run the test once with the new
`known-third-party-libraries.properties` line removed, to confirm it still
guards the fix.
_Claude Code on behalf of allthingssecurity_
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]