CAMEL-24307: camel-aws2-rekognition - throw when pojoRequest=true and the body is the wrong type - #25243
Conversation
… the body is the wrong type Child of CAMEL-24261. Rekognition2Producer's 27 operations only acted when the body was the matching request type under pojoRequest=true; any other body silently fell through with no AWS call and no error. Add the missing else that throws IllegalArgumentException naming the required type, consistent with CAMEL-23462. A parameterized test covers all 27 operations; verified to fail (silent no-op) before the fix. The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
gnodet
left a comment
There was a problem hiding this comment.
Clean, well-structured PR. The pattern is identical to the merged sibling PRs in the CAMEL-24261 series (camel-aws2-timestream, camel-aws2-redshift, camel-aws2-step-functions, etc.). All 27 operations in the Rekognition2Operations enum have a corresponding else throw with IllegalArgumentException in the producer and a matching entry in the parameterized test.
Key observations:
- Test uses
@ParameterizedTest+@CsvSourcewith AssertJ'sassertThatThrownBy— clean and well-structured - New test method is package-private (JUnit 5 convention ✓)
- All operations consistently covered in both production code and test
- CI checks pass
LGTM ✅
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Child of CAMEL-24261 (completing CAMEL-23462 across the AWS2 producers).
Problem
With
pojoRequest=true,Rekognition2Producer's 27 operations only acted whenthe body was the matching request type; any other body fell through the
instanceofwith noelse, so no AWS call was made, no response was set, andthe original body was returned with no error.
Fix
Each branch now throws
IllegalArgumentExceptionnaming the required requesttype, e.g.
"detectText operation requires DetectTextRequest in POJO mode".Tests
A
@ParameterizedTestcovers all 27 operations, sending a wrong-typed body topojoRequest=trueroutes and asserting each message. Verified to fail (silentno-op) before the fix — with the
detectTextelse removed, exactly that casereports "Expecting code to raise a throwable". Class 54/54 green. Hermetic unit
tests, region-free — no localstack or real AWS.
Docs / backport
The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Main only, matching
the CAMEL-23462 precedent (behaviour change, shipped in a minor, not backported).
Claude Code on behalf of oscerd