allthingssecurity opened a new pull request, #28426: URL: https://github.com/apache/camel/pull/28426
# Description [CAMEL-25898](https://issues.apache.org/jira/browse/CAMEL-25898) The IBM COS producer took the bucket of each operation from the `CamelIBMCOSBucketName` header before the bucket of its endpoint, and the consumer sets that header to the bucket it consumed an object from. A route from one bucket to another (`from("ibm-cos://source...").to("ibm-cos://target...")`) therefore stored every object back in `source`, under the same key, and with the default `deleteAfterRead=true` the consumer then deleted it there: the object ended up in neither bucket, and the exchange completed without an error. camel-aws2-s3, camel-minio and camel-google-storage fixed the same thing in 4.10 (CAMEL-21680, CAMEL-21678, CAMEL-21682) with a separate producer header. This PR does the same for camel-ibm-cos: - `IBMCOSProducer.determineBucketName` reads the new `CamelIBMCOSOverrideBucketName` header (`IBMCOSConstants.OVERRIDE_BUCKET_NAME`), else the bucket of the endpoint. This applies to every producer operation, as in camel-aws2-s3. - `CamelIBMCOSBucketName` is now documented as a consumer header (label `consumer`). - The `createBucket` example of the component page and `IBMCOSProducerAdditionalOperationsIT` use the new header. - Generated files: the component JSON and its catalog copy, the catalog copy of the component page, and the header names of the endpoint DSL (`iBMCOSOverrideBucketName()`). - Upgrade note in the 4.24 guide, marked as a breaking change: a route that sets `CamelIBMCOSBucketName` to choose the bucket of a producer operation must set `CamelIBMCOSOverrideBucketName` instead. Tests: - New `IBMCOSProducerBucketHeaderTest` (2 tests). `consumedObjectIsStoredInTheBucketOfTheProducerEndpoint` runs the real consumer against the module's in-process fake S3 server (bucket `source`) and a recording client for the producer endpoint `ibm-cos://target`; on main it fails with `expected: <[target/a.txt]> but was: <[source/a.txt]>`. `overrideBucketNameHeaderSelectsTheBucket` checks that without a header the endpoint bucket is used and that the override header selects another one; on main it fails with `expected: <[target/b.txt, other/c.txt]> but was: <[target/b.txt, target/c.txt]>`. - camel-ibm-cos unit tests: 8 run, 0 failures, 0 errors, 0 skipped. What was not run: the ITs (they need IBM Cloud credentials); the full root build. The endpoint DSL file was edited by hand in the generator's format (one Javadoc and one new method); the component JSON was regenerated by the module build. Not changed: camel-aws2-s3-vectors has the same pattern (its consumer sets `CamelAwsS3VectorsVectorBucketName` and `CamelAwsS3VectorsVectorIndexName`, which its producer reads before the endpoint values); I can file a follow-up JIRA for it. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-25898](https://issues.apache.org/jira/browse/CAMEL-25898). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built and tested camel-ibm-cos, including the formatter and import-sort plugins, and updated the catalog copies and the endpoint DSL. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
