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

   Third batch of 
[CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688) (test coverage 
of the CLI commands): commands that work on the project and the catalog, picked 
from a JaCoCo run of camel-jbang-core (line coverage before: `update run` 0-5%, 
`dependency copy` 13%, `doc` 33%, `init` 39%, `get error` 41%).
   
   ### Tests
   - `UpdateRunTest` (new): the Maven command `camel update run` runs for Camel 
Main (the rewrite plugin with the latest recipe, or every recipe), Spring Boot, 
`--dryRun`, `--debug`, extra recipes, and Quarkus (the stream of the Camel 
version), the exit code of Maven, and the errors. Nothing is downloaded and 
Maven is not run: `UpdateRun` has a project directory, `createDownloader()` and 
`executeCommand()` a test replaces.
   - `DependencyCopyTest` (new): the JARs copied (each dependency resolves to a 
JAR of its own through a spy of the downloader), an earlier copy, a dependency 
that cannot be resolved, and the output directory.
   - `ListErrorTest` (now AssertJ, 15 tests): the filters, `--limit`, `--last` 
with two integrations, `--show`, `--diagram` without history, and the option 
errors.
   - `InitTest`: Java in `src/main/java` and in `src/main/javafx`, XML, the 
three Kamelet templates, a Pipe, `--clean-dir`, an unsupported file type, 
`--from-kamelet` without a Kamelet file.
   - `CatalogDocTest`: EIPs (text, `eip:`, `--url`, JSON, suggestions), a data 
format, a language, `--filter`, and `main`.
   
   ### Bugs the tests found
   - **`camel dependency copy`** deleted the whole `--output-directory` before 
it copied, so `--output-directory=.` deleted the project; it now deletes the 
JARs an earlier copy left there, and keeps the other files. It exited with `0` 
when a dependency could not be resolved or copied (now `1`), and went on when 
`--output-directory` is a file (now `2`).
   - **`camel update run`**: `--runtime=quarkus --download=false` without 
`--quarkusMavenPluginVersion` failed with an `IllegalStateException` (exit 
`70`, with a stack trace) that told to set `--quarkus-version`, which this 
command does not have; now a usage error that names the option. A version 
without upgrade recipes failed with a `NullPointerException`; now exit `1` and 
the missing recipes. Without a `pom.xml`, the error told to run `camel upgrade 
run`.
   - **`camel get error`**: `--last` ("the newest error") sorted by pid and 
took the first row, so with several integrations it showed the newest error of 
the one with the lowest pid; it now sorts by time. An `--ago` that is not a 
duration was ignored (every error shown), and a `--handled` that is not `true` 
or `false` filtered out every error; both are usage errors now, checked before 
the integrations are read. The errors of `--diagram` went to stdout; they go to 
stderr (and a graphical `--theme` without terminal graphics exits with `2`).
   - **`camel init`** of a Java file directly in `src/main/java` failed with a 
`StringIndexOutOfBoundsException`, and a folder such as `src/main/javafx/demo` 
gave the package `x.demo`; the package is now the folders after the 
`src/main/java` folders.
   - **`camel doc`** documented an EIP with `--json` (the documentation of the 
MCP tool `camel_catalog_doc`), but as text said `Camel resource: split not 
found`. It documents EIPs now (name, description, options and the link to the 
website), with the prefix `eip:` for an EIP with the name of a component, such 
as `eip:log`. The getting started page has an example.
   
   The user-visible changes are in the 4.24 upgrade guide (not the new EIP 
documentation, which is a feature).
   
   ### Not in this PR
   - The next batch: `cmd history` and `restart`.
   - `camel init` overwrites an existing file without asking (as before).
   
   `mvn test` of camel-jbang-core: all tests pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My
   


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