davsclaus opened a new pull request, #30347: URL: https://github.com/apache/camel/pull/30347
## Backport of #30212 Backport of #30212 (CAMEL-27052: camel-jaxb - the part class and namespace headers are used only when allowPartClassFromHeader is enabled) onto `camel-4.18.x`, for 4.18.6. JIRA: [CAMEL-27052](https://issues.apache.org/jira/browse/CAMEL-27052) **Original PR:** #30212 - CAMEL-27052: camel-jaxb - the part class and namespace headers are used only when allowPartClassFromHeader is enabled **Original author:** @davsclaus **Target branch:** `camel-4.18.x` ### Straight or adapted Adapted. Two commits: 1. A cherry-pick (`-x`) of 17c24197597b (CAMEL-24164, #24813: camel-jaxb - Fix CamelJaxbPartClass header state pollution), which is on `main` and `camel-4.22.x` but not on `camel-4.18.x`. Without it, a `CamelJaxbPartClass` header changes the part class of the data format itself for later messages. #30212 builds on that code and test. The only change is in the test: it uses `org.apache.camel.test.junit5.CamelTestSupport`, because `camel-4.18.x` has no `camel-test-junit6`. 2. A cherry-pick (`-x`) of the squash commit f8036a4c9354 of #30212, with these changes for `camel-4.18.x`: - `RestBindingAdviceFactory` and `rest-dsl-binding.adoc` are left out. On `camel-4.18.x` the Rest DSL binding creates its own data formats and does not take options from the data format configured on the CamelContext. There is no `NOT_INHERITED_OPTIONS` there, so the binding never inherits `allowPartClassFromHeader`. The doc page with the paragraph that lists those options does not exist on this branch. - `JaxbRestBindingPartClassTest` is left out. The test does not exist on `camel-4.18.x`, because it belongs to the binding inheritance described above. - The model `JaxbDataFormat` takes the option description from the setter Javadoc instead of `@Metadata(description = ...)`. That is how the other options on this branch are documented. - In the tests, `org.apache.camel.test.junit6.CamelTestSupport` is replaced by `org.apache.camel.test.junit5.CamelTestSupport` (`JaxbPartClassHeaderOptionTest`, `SoapUnMarshalTest`). - In `jaxb-dataformat.adoc`, the sentence before the example names the `CamelJaxbPartNamespace` header, as on `main`, so that it matches the new example. - The upgrade-guide entry is not in this PR. The upgrade guides for all versions live on `main`, and the 4.18.6 entry goes into `camel-4x-upgrade-guide-4_18.adoc` in a separate doc PR. - The generated files (data format and model metadata, catalog, XML/YAML DSL parsers and schemas) were regenerated by building `camel-4.18.x`. None were copied from `main`. Everything else applies as on `main`: - the new `allowPartClassFromHeader` option (default `false`) in the model, builder, reifier and `JaxbDataFormat` - the new `jaxb-dataformat.adoc` section - the new `JaxbPartClassHeaderOptionTest` - the existing tests that set the headers now enable the option: the camel-jaxb tests, the camel-jetty and camel-servlet REST tests (with `dataFormatProperty("xml.out.allowPartClassFromHeader", "true")`), and camel-soap `SoapUnMarshalTest` Behaviour change on this maintenance line: routes that set `CamelJaxbPartClass` or `CamelJaxbPartNamespace` themselves must enable `allowPartClassFromHeader`. With REST binding, use `xml.out.allowPartClassFromHeader` for a REST service and `xml.in.allowPartClassFromHeader` for the `rest` producer. ### Tests These tests were run on this branch with JDK 21: the camel-jaxb module tests, `SoapUnMarshalTest` in camel-soap, and the `RestJetty*Test` and `RestServlet*Test` tests in camel-jetty and camel-servlet. _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]
