CAMEL-23688: camel-jbang - add unit tests for more action reader CLI commands#24199
Merged
Conversation
…commands Batch C of the action-command regression net. Adds unit tests for the remaining CLI commands whose behavior a unit test can deterministically reach: the output.json round-trip readers and the named-pid request path of the send/receive/route-structure commands. New tests: CamelBrowseAction, CamelSpanAction, CamelRouteTopologyAction, CamelLoadAction, CamelStubAction, CamelHistoryAction, CamelSendAction, CamelReceiveAction, CamelRouteStructureAction. CamelHistoryAction reads a pre-existing <pid>-history.json instead of the action/output round trip, so a writeMessageHistoryFile helper is added to ActionCommandTestSupport and the test drives it via callWithSingleProcess. The send/receive/route-structure commands are covered only on their named-pid branch; their no-pid branches spawn a background Camel and are out of scope for unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
davsclaus
approved these changes
Jun 23, 2026
davsclaus
left a comment
Contributor
There was a problem hiding this comment.
Good batch of test additions — clean, well-structured, and consistent with the patterns from Batches A and B.
Highlights:
- All 8 new test classes follow the established
ActionCommandTestSupportharness correctly - No
Thread.sleep— reuses the Awaitility-basedcallWithResponseresponder - Proper scope boundaries documented (e.g.,
CamelRouteStructureActionTestexplains why the no-match fallback path is out of scope for unit tests) writeMessageHistoryFilehelper is well-documented and follows the existingwriteStatusFilepattern- Fixtures are realistic with appropriate JSON fields matching production expectations
Minor (non-blocking): CamelHistoryActionTest.singleTraceLine() and CamelSendActionTest.sentResponse() use System.currentTimeMillis() to populate fixture timestamps — a fixed constant (e.g., 1_700_000_000_000L) would be slightly more deterministic, but since the production code just formats whatever timestamp it receives, this is fine as-is.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Address review feedback on PR apache#24199: replace System.currentTimeMillis() in the CamelHistoryActionTest and CamelSendActionTest fixtures with a fixed FIXED_TIMESTAMP constant for fully deterministic test data. The timestamps are not asserted on, so this is behavior-preserving. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Batch C of the regression test coverage for the camel-jbang CLI
action/commands (CAMEL-23688), building on the merged Batch A (#24188) and Batch B (#24189). The JIRA asks for a regression safety net around these commands ahead of a planned refactor.This batch adds unit tests for the remaining action commands whose behavior a unit test can deterministically reach, all in
dsl/camel-jbang/camel-jbang-core:Output.json round-trip readers (delete the stale
<pid>-output.json, write<pid>-action.json, then poll for the response):CamelBrowseActionTest,CamelSpanActionTest,CamelRouteTopologyActionTest,CamelLoadActionTest,CamelStubActionTestNamed-pid request path of commands that otherwise spawn a background Camel:
CamelSendActionTest,CamelReceiveActionTest,CamelRouteStructureActionTest— only the branch that targets an already-running integration is covered; the no-pid branches spawn a Camel viaRunand are out of scope for unit tests.Message-history reader:
CamelHistoryActionTest—CamelHistoryActionreads a pre-existing<pid>-history.jsonrather than the action/output round trip, so awriteMessageHistoryFilehelper is added toActionCommandTestSupportand the test drives it viacallWithSingleProcess.Each test asserts intent (the
actiondiscriminator written to the action file and a specific rendered substring from the fixture), plus the no-match exit behavior, rather than merely checking a non-null result or exit code.No production code is changed; this is test-only. The existing
callWithResponseresponder-thread harness (added in Batch B) is reused unchanged for the round-trip readers.Verification: the full
commands/actionpackage passes (130 tests, 0 failures, 0 errors);mvn formatter:format impsort:sortis clean.Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.Claude Code on behalf of Adriano Machado