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

   Fixes [CAMEL-25889](https://issues.apache.org/jira/browse/CAMEL-25889).
   
   The `google-mail`, `google-mail-stream`, `google-drive`, `google-calendar`, 
`google-calendar-stream`, `google-sheets` and `google-sheets-stream` components 
kept a single API client per component: `getClient(configuration)` created it 
from the configuration of the first endpoint that asked for one and returned 
that same client to every later endpoint of the component, whatever the options 
of that endpoint were.
   
   ### Changes
   
   - Each of the seven components keeps one client per distinct set of the 
options the client is created from (`clientId`, `clientSecret`, `refreshToken`, 
`accessToken`, `serviceAccountKey`, `delegate`, `scopes`, `applicationName`, 
plus `emailAddress`, `p12FileName` and `user` on the two calendar components), 
in a `ConcurrentHashMap` populated with `computeIfAbsent` and cleared in 
`doStop()`. Endpoints with the same options keep sharing one client; endpoints 
with different options get their own. This is the pattern `camel-dhis2`, 
`camel-zendesk` and `camel-box` already use.
   - `google-drive`: the endpoint-level `clientFactory` option is now used to 
create the client of that endpoint (the component ignored it before, so the 
existing `CustomClientFactoryTest` only checked the getter). 
`GoogleDriveComponent` gained a `getClient(configuration, clientFactory)` 
overload; the one-argument method is unchanged.
   - `google-mail-stream`: when neither `clientSecret` nor `serviceAccountKey` 
is set, `getClient` now throws an `IllegalArgumentException` with the same 
message as the other components instead of returning `null`.
   - Tests: one `*ClientPerEndpointOptionsTest` per component with a recording 
fake client factory, no network. They check that endpoints with the same 
options share a client, that endpoints with different options (OAuth refresh 
token, service account `delegate`, Application Default Credentials vs explicit 
credentials on sheets) each get their own, and that the google-drive endpoint 
factory is used.
   - Upgrade guide note for 4.24.
   
   ### Checks
   
   - `mvn -DskipTests install` in the four modules, the new tests, and the full 
reactor build (`clean install -DskipTests -DskipITs`) with no regenerated-file 
drift.
   
   _Claude Code on behalf of oscerd_
   
   🤖 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