Skip to content

CAMEL-23688: camel-jbang - add unit tests for action reader CLI commands#24189

Open
ammachado wants to merge 1 commit into
apache:mainfrom
ammachado:CAMEL-23688
Open

CAMEL-23688: camel-jbang - add unit tests for action reader CLI commands#24189
ammachado wants to merge 1 commit into
apache:mainfrom
ammachado:CAMEL-23688

Conversation

@ammachado

@ammachado ammachado commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #24188 (action-writer command tests, merged), continuing the CAMEL-23688 effort to build a regression safety net around the camel-jbang CLI action commands before refactoring.

This batch covers the request/response "reader" commands: those that write an action request to <pid>-action.json, then poll <pid>-output.json for the running Camel's response and render it to the console.

New test infrastructure (ActionCommandTestSupport): callWithResponse(command, response) runs a reader command end to end. It starts a background "responder" thread that waits (via Awaitility) for the command to write its action request, then writes the simulated output file.

Commands covered (one *Test each, all in commands/action/):

Command Action verb Kind
CamelGCAction gc fire-and-forget writer
CamelRouteDumpAction route-dump reader
CamelBeanDump bean reader
CamelThreadDump thread-dump reader
CamelSourceTop top-processors reader
RouteControllerAction route-controller reader

Each test asserts both the action-request payload the command writes and the rendered console output from a simulated response, plus a no-match path (no running process resolved). Process discovery is mocked with a static ProcessHandle mock, matching the existing tests in this package.

This is a test-only change: no production code is touched and there is no user-visible behavior change.

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • 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

Adds unit tests for the request/response "reader" action commands, building
on the action-writer tests from the previous batch. A new
ActionCommandTestSupport.callWithResponse helper spins a background responder
thread that, once the command has written its action request, simulates the
running Camel writing the output file (driven by Awaitility, no Thread.sleep).

Covers: gc, route-dump, bean, thread-dump, top-processors (source) and
route-controller. Each test asserts both the action-request payload the
command writes and the rendered console output, plus a no-match path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ammachado ammachado marked this pull request as ready for review June 22, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant