davsclaus opened a new pull request, #29920:
URL: https://github.com/apache/camel/pull/29920

   Item 1 of [CAMEL-26933](https://issues.apache.org/jira/browse/CAMEL-26933).
   
   ## Problem
   
   `camel export` from the launcher never exports the Citrus tests. 
`CliExportContext` takes the exporters from `PluginHelper.getActivePlugins`, 
which reads only `~/.camel-jbang-plugins.json`. The launcher embeds the test 
plugin and calls `plugin.customize` (`CamelLauncherMain`) 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, and 
`camel-jbang-test.adoc` says they are.
   
   On the launcher from main, with `hello.yaml` and `test/hello.citrus.it.yaml`:
   
   ```
   $ camel export hello.yaml test/hello.citrus.it.yaml --gav=com.acme:hello:1.0 
--runtime=camel-main --dir=out
                                      # exit 0, out/src/test: 0 files
   ```
   
   ## Change
   
   - `CamelJBangMain.getEmbeddedPlugins(target)` (new, none by default): the 
plugins built into the CLI that contribute to a command.
   - `CamelLauncherMain` returns its embedded plugins whose `PluginType` lists 
the command in `appliesTo`. Today that is the test plugin for `export`.
   - `CliExportContext` adds them to the plugins of the plugin configuration, 
unless the configuration has the same plugin (after `camel plugin add test`), 
so an exporter does not run twice.
   
   After, on the launcher built from this branch:
   
   ```
   $ camel export hello.yaml test/hello.citrus.it.yaml --gav=com.acme:hello:1.0 
--runtime=camel-main --dir=out
   out/src/test/resources/hello.citrus.it.yaml
   out/src/test/java/com/acme/hello/HelloCitrusIT.java
   ```
   
   ## Tests
   
   - `CliExportContextEmbeddedPluginsTest`: the export has the exporter of an 
embedded plugin; without embedded plugins, only those of the configuration.
   - `CamelLauncherMainEmbeddedPluginsTest`: the launcher's test plugin 
contributes to export with its exporter, and to run nothing.
   - End to end with the launcher distribution built from this branch, as above.
   - camel-jbang-run: 303 tests pass. camel-jbang-core: 3004 + 259 pass 
(`DependencyUpdateTest` failed once and passed on the rerun, as on other 
branches). camel-launcher: 416 pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to