Claus Ibsen created CAMEL-26933:
-----------------------------------
Summary: camel-jbang - plugins and launcher: export skips the
Citrus tests, test init overwrites a test, generate rest writes broken routes,
and camel.bat has LF line endings
Key: CAMEL-26933
URL: https://issues.apache.org/jira/browse/CAMEL-26933
Project: Camel
Issue Type: Bug
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.24.0
Found by a scan of the Camel CLI on 2026-11-13, with the unpacked
4.24.0-SNAPSHOT camel-launcher on macOS (JDK 25). *(exp)* means reproduced by
experiment, *(read)* means traced in the code. Paths are relative to
{{dsl/camel-jbang/}}, and line numbers are from main at that time. Earlier
findings of this kind: CAMEL-26901, CAMEL-26911 to CAMEL-26914.
h3. 1. camel export from the launcher never exports the Citrus tests (exp, high)
{{CliExportContext.java:62}} takes the exporters from
{{PluginHelper.getActivePlugins}}, which reads only
{{~/.camel-jbang-plugins.json}}. The launcher embeds the test plugin and calls
{{plugin.customize}} ({{CamelLauncherMain.java:41-47,80-86}}) without
registering it, so {{TestPluginExporter}} never runs: the export exits 0 and
{{src/test}} is missing. After {{camel plugin add test}} the tests are
exported. {{camel-jbang-test.adoc}} says they are. Register the embedded
plugins and add a launcher IT.
h3. 2. camel test init overwrites an existing test (exp, high)
{{TestInit}} (extends Citrus {{Init}}) has no existence check and no
{{--force}}: running it again silently replaces an edited test. {{camel init}}
refuses with "use --force".
h3. 3. camel generate rest --routes writes routes that neither validate nor run
(exp, high)
{{CodeRestGenerator.java:121-124}}: with the module's own petstore spec,
{{camel validate yaml}} reports 19 errors (no {{steps}}, {{description}} under
{{from}}) and {{camel run}} exits 70 with "Route updatePet has no output
processors". The flow in {{camel-jbang-projects.adoc:410}} is broken. Add a
placeholder step and validate the output in a test.
h3. 4. camel generate rest --dto (exp)
* With the default runtime (quarkus) the DTOs import {{javax.validation}},
{{javax.annotation.Generated}} and {{JsonNullable}} and do not compile
({{useJakartaEe=false}} is hard-coded, lines 190-213). With spring-boot they
still import {{io.swagger.v3.oas.annotations}}.
* The OpenAPI Generator banner is printed on stdout after the REST DSL, so {{>
rest.xml}} is not valid XML.
* {{--openapi-version}} is never read, a URL input is rejected as missing, and
the DTOs go to the working directory whatever {{--output}} says.
h3. 5. camel validate exit codes (exp)
* {{validate yaml nope.yaml}} reports a validation error with exit 1
({{YamlValidateCommand.java:84}}); properties and source exit 66.
* {{validate source notes.txt}} prints "Validation success (files:0)" and exits
0 ({{SourceValidateCommand.java:68-99}}); {{validate normalize notes.txt}}
exits 0 with no output.
* {{validate yaml --camel-version=9.9.9}} exits 70 with a trace.
* {{validate normalize}} drops the comments of a route file without saying so;
yaml and source word the same errors differently; {{validate yaml
application.yaml}} says "Skipping non-YAML file"; {{validate properties}} has
no {{--camel-version}}/{{--runtime}}.
h3. 6. camel generate schema --verbose writes its progress into the JSON (exp)
{{CodeSchemaGenerator}} prints the verbose lines with {{printer().println}}, so
{{> s.json}} starts with "Generating JSON Schema...". The class Javadoc lists
exit codes 1/2/3/4 (the code uses 70), its example class does not exist, and
{{camel-jbang-projects.adoc:423}} says the schema is saved to a file when it
goes to stdout.
h3. 7. camel edit completion can lose text (read)
{{CamelNanoLspEditor.insertHelp}}: without a textEdit it drops the rest of the
line (around 160-167); the multi-line branch (141-158) indexes the new text
with positions of the old one and can throw; {{getLeft()}} is called without
{{isLeft()}}. The module has no tests.
h3. 8. Two Citrus tests with the same base name export as one JUnit class (exp)
{{TestPluginExporter.java:170-195}}: {{order.citrus.it.yaml}} and
{{order.citrus.it.xml}} give one {{OrderCitrusIT}}, and the xml test never
runs. {{readTestSource}} replaces every {{../}} with {{camel/}}, also inside
code and URLs.
h3. 9. camel.bat (read + exp)
* It ships with LF line endings: no {{.gitattributes}} entry and no
{{<lineEnding>crlf</lineEnding>}} in {{launcher-content.xml}}. cmd.exe can miss
{{goto}}/{{call :label}} targets in LF files that cross a 512-byte block, and
the 7.4 KB script has many. The Windows tests run on a checkout where autocrlf
may convert it.
* {{:tryJavaParseVersion}} rejects {{26-ea}}, which {{camel.sh}} accepts.
h3. 10. Smaller
* {{camel test}}: a missing file exits 1 with a stack trace (not 66); {{test ps
--json}} is unknown; {{test run}} writes ANSI codes into redirected output;
usage errors are in picocli format.
* {{camel plugin list}} shows {{edit}} as "Bundled" (the launcher downloads it
on first use), leaves out {{self-update}}, and {{--json}} says "available" for
both; {{plugin get}} with nothing prints nothing.
* {{self-update --check}} refuses on a zip install (read-only check) and exits
0 whether or not an update exists; no {{--json}}.
* {{camel-jbang-main/dist/CamelJBang.java}} (the {{camel@apache/camel}} alias)
still defaults to 4.22.0.
* {{SelfUpdateCommand}} uses a fully qualified {{java.io.IOException}} and
comments refer to an internal plan; {{PluginHelper.loadPluginFromService}}
swallows the version check error, so a too-new plugin is silently not loaded;
{{TestInit}} replaces a placeholder that is not in the template;
{{EditCommand.filePath}} is dead; {{JBangDevConsole}} reports the cached JBang
version under the launcher.
* The update notice goes to stderr before every command, also when stderr is
not a terminal.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)