CAMEL-24302: camel-aws2-timestream - throw when pojoRequest=true and the body is the wrong type - #25220
Conversation
…the body is the wrong type Child of CAMEL-24261. Both timestream producers 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: * Timestream2WriteProducer - 16 operations * Timestream2QueryProducer - 10 operations A parameterized test in each producer's test class covers every operation; 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, mechanical addition of else { throw IllegalArgumentException } to all 26 pojo-mode operations across both Timestream producers (10 query, 16 write), with comprehensive parameterized tests covering every operation. Follows the exact same pattern as the already-approved sibling PRs (#25199, #25210, #25215).
Key observations:
- All 26 operations (10 in
QueryProducer, 16 inWriteProducer) correctly covered by newelsebranches - Error message format consistent with the CAMEL-24261 series
- Tests use
@ParameterizedTestwith@CsvSourceand AssertJassertThatThrownBy— follows project conventions - New test method is package-private — follows JUnit 5 conventions
- Pre-existing pojo routes correctly reused without duplication
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, both timestream producers only acted when the body wasthe matching request type; any other body fell through the
instanceofwith noelse, so no AWS call was made, no response was set, and the original body wasreturned with no error. This covers 26 operations:
Timestream2WriteProducer— 16 (databases, tables, batch-load tasks, writeRecords, describeEndpoints)Timestream2QueryProducer— 10 (scheduled queries, prepareQuery, query, cancelQuery, describeEndpoints)Fix
Each branch now throws
IllegalArgumentExceptionnaming the required requesttype, e.g.
"writeRecords operation requires WriteRecordsRequest in POJO mode".Tests
A
@ParameterizedTestin each producer's test class covers every operation,sending a wrong-typed body to
pojoRequest=trueroutes and asserting eachmessage. Verified to fail (silent no-op) before the fix — with
writeRecords(write) and
cancelQuery(query) elses removed, exactly those cases report"Expecting code to raise a throwable". Write 33/33, Query 21/21 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