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

   Part of [CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688): 
tests for the CLI commands and helpers that had none, after the CLI overhaul of 
[CAMEL-25388](https://issues.apache.org/jira/browse/CAMEL-25388). The focus is 
the core commands; the tests found the bugs below, which this PR fixes.
   
   ### New tests
   - `CamelLogActionTest`: `camel log` without following: all lines, `--tail`, 
`--grep` (ignoring case, only the message), `--find`, `--since` in seconds or 
with a unit, `--startup`, `--timestamp=false`, `--prefix=true`, a log named 
after the integration.
   - `CamelTraceActionTest`: `camel trace` status (table and JSON, started, 
standby, stopped), start and stop send the action, clear empties the trace file.
   - `CamelSendActionResultTest`: `camel cmd send`: the message it sends 
(endpoint, body, headers, the 5 second minimum of the poll timeout), the exit 
code of a failed (1) and timed out (124) exchange, `--reply-file`, a body from 
a file, a header without a value (2).
   - `EvalExpressionResultTest`: `camel eval expression` in a running 
integration: what it sends, the result, a failed evaluation (1, the stack trace 
on stderr), a header without a value (2).
   - `CamelSqlQueryActionTest`: `camel cmd sql`: the query it sends, the table 
of the rows, the update count, a failed query (1).
   - `CamelHeapHistogramTest`: `camel cmd heap-histogram`: largest first, 
sorted by instances or name, `--filter` (a name, `non-jdk`), `--top`.
   - `ListDataSourceTest`, `ListSqlTraceTest`: `camel get datasource` and 
`camel get sql-trace` (JSON, table, nothing to list).
   - `InfraRunSelectionTest`: `camel infra run` with a service or an 
implementation that is not in the catalog (3), a malformed `--property` (2).
   - `InfraStopTest`: `camel infra stop` by name, all, by pid, JSON, not 
running (3), a service whose process is gone (3, and its files are removed).
   - `JolokiaTest`: no match and several matches exit 3.
   - `ProcessHelperTest`: the name of an integration: the main class, the route 
files of `camel run`, the context name, a Spring Boot or Quarkus app started by 
Maven.
   - `UserConfigDefaultsTest`: `camel config set` values are the defaults of 
the options: for every command or one, the command line wins, `#option` 
placeholders, the local file before the global one, not for the plugin commands.
   - `VersionHelperTest`, `GitHubHelperTest`, `CamelMemoryLeakTest`, 
`CamelHeapDumpTest`, `CamelSourceActionRoutesTest`, and new cases in 
`ActionClientTest`, `ConfigSetTest`, `DependencyListTest`.
   
   ### Bugs fixed
   - `camel cmd send --reply` failed with a `ClassCastException` when the 
exchange failed with an exception without a message, such as a 
`NullPointerException` (the answer then has the reply message as a JSON object).
   - `camel get source` failed (NPE) for routes without a source location, such 
as routes added by a `RouteBuilder`, and for an answer without routes.
   - Versions were compared as padded text: `3.27.3.1` came after `3.27.4` (the 
Quarkus platform versions have four parts, and the Quarkus export checks the 
platform version), and `4.24.10-SNAPSHOT` came after `4.24.10` while 
`4.24.0-SNAPSHOT` came before `4.24.0`. They now compare part by part as 
numbers, and a `-SNAPSHOT` always comes before its release, as in Maven.
   - `camel jolokia` exited `1` for a name that matches no integration or 
several (the second printed on stdout); it exits `3`, as `camel hawtio` does.
   - `camel config set =value` stored a value with an empty key; a parameter 
without a key or a value exits `2` with the error on stderr, and no longer 
creates the configuration file.
   - `camel dependency list` with an unknown `--output` exits `2` (and the 
message lists `jbang`).
   - `camel cmd memory-leak --min-size=10B`, and a value that is not a size, 
silently turned the filter off: `10B` is 10 bytes, and a value that is not a 
size exits `2` before the integration is contacted.
   - `camel run` of a GitHub repository or a gist skipped `.camel.xml` files.
   - `camel cmd heap-dump` printed the size with the decimal separator of the 
locale.
   
   ### Docs
   - 4.24 upgrade guide: "exit codes of config set, dependency list, jolokia 
and cmd memory-leak".
   
   ### Tests
   - Each fix has a test that fails without it.
   - `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