davsclaus opened a new pull request, #29856:
URL: https://github.com/apache/camel/pull/29856

   ## Description
   
   [CAMEL-26927](https://issues.apache.org/jira/browse/CAMEL-26927)
   
   The WordPress endpoints kept their client in 
`WordpressServiceProvider.getInstance()`, one instance that every endpoint set 
up again with its own `url`, `apiVersion`, `user` and `password` when it was 
created. The producers and consumers took their services from that instance. 
When a Camel application had more than one WordPress endpoint with different 
options, for example a consumer without a user next to a producer with a user 
(as in the component docs), or endpoints for two sites, every producer and 
consumer used the options of the endpoint that was created last.
   
   ### Change
   
   - `WordpressServiceProvider.create(WordpressAPIConfiguration)` creates a 
provider for one site.
   - `WordpressEndpoint.getServiceProvider()` creates the endpoint's own 
provider (lazily) from the endpoint options. The endpoint no longer initialises 
`WordpressServiceProvider.getInstance()`.
   - The post and user producers and consumers, and the authentication warning 
of the producer, use the provider of their endpoint.
   - `WordpressServiceProvider.getInstance()` and its `init(...)` methods are 
deprecated. The provider fields are `volatile`, and the services map is 
immutable.
   - The module's test support and the disabled adapter ITs use `create(...)` 
instead of the deprecated singleton.
   - Upgrade guide notes for 4.24, and for 4.22.3 and 4.18.6 (backported).
   
   ### Tests
   
   New `WordpressEndpointsUseTheirOwnSiteTest`, with two local WordPress sites 
that record each request with its user:
   
   - `testProducersUseTheirOwnSite` and 
`testProducersUseTheirOwnSiteInReverseCreationOrder`: two endpoints for two 
sites with different users, both created before their producers. Each site 
receives only the post of its own endpoint, with that endpoint's user.
   - `testConsumerWithoutUserSendsNoCredentials`: one site, a consumer endpoint 
without a user created before a producer endpoint with a user. The consumer's 
polls carry no `Authorization` header, and the producer's post carries its user.
   
   All three fail without the change in `src/main`. `mvn verify` in 
`components/camel-wordpress`: 36 tests pass (12 skipped, the disabled adapter 
ITs).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 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]

Reply via email to