ammachado opened a new pull request, #24257:
URL: https://github.com/apache/camel/pull/24257
# Description
Adds focused, offline unit tests for several `camel-jbang` CLI commands and
fixes two production bugs that were surfaced while writing the `infra` tests.
**Tests added**
- `DataWeaveLexerTest` / `DataWeaveParserTest`: tokenization and
recursive-descent parsing of the DataWeave 2.0 transform helper, covering the
ambiguous cases (negative number vs minus operator, the `---` header separator,
operator precedence, and graceful handling of unsupported and unbalanced input).
- `CatalogKameletTest`: the `sortRow` ordering logic of `catalog kamelet`
listing.
- `VersionSetTest`: persisting version/repo/runtime, `--reset`, and global
vs local config.
- `InfraGetTest` / `InfraPsTest`: pid-file discovery, filtering and parsing
for `infra get`/`infra ps`, driven through an isolated home directory.
**Bug fixes (each with a regression test)**
- `infra ps` dropped running services whose alias contains a hyphen (e.g.
`hive-mq`): the running alias was derived with `fileName.split("-")[1]`,
yielding `hive` and filtering the catalog row out. Regression:
`InfraPsTest.shouldListRunningHyphenatedService`.
- `infra ps`/`infra list` showed a truncated pid (e.g. `mq`) for hyphenated
services: `findPid` extracted the pid with `split("-")[2]`. Regression: the
same test asserts the full pid is shown, plus
`InfraGetTest.shouldParseHyphenatedServiceName`.
- Both fixes consolidate the `infra-<service>-<pid>.json` filename parsing
into the shared `InfraBaseCommand.serviceNameFromPidFile` / `pidFromPidFile`
helpers, now used by `findPids`, `findPid`, `InfraGet` and `InfraPs`.
**Test infrastructure**
- New `InfraCommandTestSupport` base (home-dir redirection + cleanup),
following the existing `ProcessCommandTestSupport` convention, shared by the
infra tests.
- `BaseConfigTestSupport` now also removes the global config file written
under `target`, and `VersionSetTest` reuses it instead of duplicating the
cleanup.
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4
uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for
the change (usually before you start working on it).
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful
subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally from root folder
and I have committed all auto-generated changes.
---
_Claude Code on behalf of Adriano Machado_
--
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]