davsclaus opened a new pull request, #30518: URL: https://github.com/apache/camel/pull/30518
[CAMEL-27307](https://issues.apache.org/jira/browse/CAMEL-27307) ### Problem `putMetricData` sends a body that is a `MetricDatum`, or a collection or an array of them. An empty collection or array gave an empty `metricData` list, and the producer called `putMetricData` with it. Against the Floci CloudWatch emulator the call succeeded and put nothing, so the message passed as if a data point had been put. What real AWS CloudWatch does with an empty `MetricData` was not checked; the API documents `MetricData` as required. ### Fix `Cw2Producer` now fails the exchange before the call, with an `IllegalArgumentException`: "The body is an empty collection: there is no MetricDatum to put" (or "an empty array"). The outcome no longer depends on the service. A collection with an element that is not a `MetricDatum` already failed the same way. The component doc ("The metric data of putMetricData") and the body type description mention the empty case. The catalog copies are synced. ### Tests `CwPutMetricDataTest` has 2 new tests: `emptyListFails` and `emptyArrayFails`. They check the message and that `putMetricData` is never called. Both fail without the fix, because nothing is thrown. All 28 unit tests of camel-aws2-cw pass with the fix; the integration tests were not run. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
