CAMEL-24303: camel-aws2-redshift - throw when pojoRequest=true and the body is the wrong type - #25227
Conversation
…e body is the wrong type Child of CAMEL-24261. RedshiftData2Producer's ten operations (listDatabases, listSchemas, listStatements, listTables, describeTable, executeStatement, batchExecuteStatement, cancelStatement, describeStatement, getStatementResult) 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 ten 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:
|
gnodet
left a comment
There was a problem hiding this comment.
Clean, well-tested change that adds pojoRequest type-checking to all 10 RedshiftData2Producer operations, following the same pattern already approved in sibling PRs (aws2-ec2 #25215, aws2-polly #25199, aws2-timestream #25220).
Highlights:
- All 10 operations (listDatabases, listSchemas, listStatements, listTables, describeTable, executeStatement, batchExecuteStatement, cancelStatement, describeStatement, getStatementResult) have the else-throw block added.
- Test coverage via parameterized
@CsvSourceentries matches 1:1 with the route definitions. - Test class and methods correctly drop
publicmodifier per project conventions, and use AssertJ assertions. - CI passes with all builds green.
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
|
🧪 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).
|
Child of CAMEL-24261 (completing CAMEL-23462 across the AWS2 producers).
Problem
With
pojoRequest=true,RedshiftData2Producer's ten 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.
"executeStatement operation requires ExecuteStatementRequest in POJO mode".Tests
A
@ParameterizedTestcovers all ten operations, sending a wrong-typed body topojoRequest=trueroutes and asserting each message. Verified to fail (silentno-op) before the fix — with the
executeStatementelse removed, exactly thatcase reports "Expecting code to raise a throwable". Class 20/20 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