Claus Ibsen created CAMEL-26852:
-----------------------------------
Summary: camel-jbang - upgrade to Citrus 5.2.0 and run its aesh
commands in the test plugin
Key: CAMEL-26852
URL: https://issues.apache.org/jira/browse/CAMEL-26852
Project: Camel
Issue Type: Task
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.24.0
Upgrade Citrus to 5.2.0 when it is released. Citrus 5.2.0 defines its CLI
commands with aesh instead of picocli (citrusframework/citrus#1574, PR #1764),
so the Camel CLI test plugin must be ported to aesh as part of the upgrade, the
last step of the picocli -> aesh switch of CAMEL-23810.
h3. Today (after CAMEL-23810, PR #29621)
The Camel CLI is on aesh, but Citrus 5.1 commands are picocli. As a stop-gap,
{{camel test}} is one aesh command with {{disableParsing = true}} that hands
its command line to picocli and the Citrus commands. Because of that, the
generated docs of the {{camel test}} sub-commands have no options, and picocli
is still shipped inside the test plugin.
h3. Where to change
* {{parent/pom.xml}}: {{citrus-version}} 5.1.0 -> 5.2.0. The property is also
used by {{components/camel-test/camel-test-citrus}},
{{dsl/camel-jbang/camel-jbang-core}} and {{dsl/camel-jbang/camel-jbang-mcp}}:
check that they still build against 5.2.0.
*
{{dsl/camel-jbang/camel-jbang-plugin-test/src/main/java/org/apache/camel/dsl/jbang/core/commands/test/}}:
** {{TestPlugin.citrus(CamelJBangMain)}} builds a picocli {{CommandLine}} with
the Citrus commands (init, inspect, run, ps/ls, agent start/run/stop). Replace
it by mounting the Citrus aesh commands in the {{CommandTree}} in
{{TestPlugin.customize}}: {{commandLine.addSubcommand("test", new
CommandTree(...).addSubcommand("run", new CommandTree(new Run(citrus))) ...)}},
with {{ls}} as an alias of {{ps}}.
** {{TestCommand}} (the {{disableParsing}} stop-gap) goes away, or becomes the
plain group command.
** {{TestInit}} extends the Citrus init command: port it to the aesh
annotations.
** The class loader and the system properties that the picocli
{{IExecutionStrategy}} of Citrus sets up must now be set up around the run of
the Citrus command (for example in the group command, or a wrapper around
{{CommandTree.execute}}).
** The Citrus {{Agent}} is an aesh group command: add its sub-commands to the
{{CommandTree}} explicitly, or they are missing from the docs and the camel
shell tooltips.
* Remove picocli: the {{picocli-version}} property in {{parent/pom.xml}}
(unused already, kept for this), and the {{info.picocli}} exclusion in
{{dsl/camel-jbang/camel-jbang-it/pom.xml}}.
* Regenerate and commit: the commands metadata JSON of the test plugin, the
pages
{{docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-test-*.adoc}}
(they get their option tables back), and the CLI goldens if they change
({{-Dcamel.golden.update=true}} in camel-jbang-core).
h3. Check
{{camel test init}}, {{camel test run}} of a {{*.citrus.it.yaml}}, {{camel test
ps}}/{{ls}}, {{camel test agent start/run/stop}}, {{camel test run --help}},
the tests of camel-jbang-plugin-test and camel-test-citrus.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)