gnodet-bot commented on code in PR #28217:
URL: https://github.com/apache/camel/pull/28217#discussion_r4334686716


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -250,6 +250,16 @@ as the body, so `+${body}+` was the file found. A 
`fileName` that uses the file
 before. A `fileName` that read the file found through its headers, such as 
`${header.CamelFileName}`, must use the file
 functions instead (`${file:name}`).
 
+=== camel-google-mail, camel-google-drive, camel-google-calendar, 
camel-google-sheets - one API client per endpoint options
+
+The `google-mail`, `google-mail-stream`, `google-drive`, `google-calendar`, 
`google-calendar-stream`, `google-sheets` and
+`google-sheets-stream` components now create one API client per distinct set 
of the options the client is created from
+(`clientId`, `clientSecret`, `refreshToken`, `accessToken`, 
`serviceAccountKey`, `delegate`, `scopes` and
+`applicationName`, plus `emailAddress`, `p12FileName` and `user` on the two 
calendar components), instead of a single
+client per component. Endpoints configured with the same options keep sharing 
one client; endpoints configured with
+different options now get their own client, created from their own options. 
The `clientFactory` option of a
+`google-drive` endpoint is now used to create the client of that endpoint.

Review Comment:
   ⚠️ **Missing upgrade guide entry**: this section documents the 
per-endpoint-options change correctly, but omits a second behavioral change 
introduced by this PR for `google-mail-stream`: when neither `clientSecret` nor 
`serviceAccountKey` is configured, the old `getClient()` silently returned 
`null` (the `client` field stayed null and the caller received a null 
reference). The new `createClient()` now throws `IllegalArgumentException` 
immediately.
   
   This is the right behavior, but it is a breaking change for any 
misconfigured `google-mail-stream` endpoint that previously failed later (NPE 
at the first API call) rather than at startup. Consider adding:
   
   > In addition, `google-mail-stream` endpoints configured without credentials 
(no `clientSecret` or `serviceAccountKey`) now throw `IllegalArgumentException` 
in `getClient()` instead of returning `null`.



##########
components/camel-google/camel-google-calendar/src/test/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamClientPerEndpointOptionsTest.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.calendar.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.services.calendar.Calendar;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.google.calendar.GoogleCalendarClientFactory;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+class GoogleCalendarStreamClientPerEndpointOptionsTest {
+
+    private static final String OAUTH = 
"?clientId=id&clientSecret=secret&refreshToken=";
+
+    @Test
+    void shouldKeepOneClientPerDistinctOptions() throws Exception {

Review Comment:
   💡 **Missing test coverage for service-account credential differentiation**: 
the non-stream `GoogleCalendarClientPerEndpointOptionsTest` has a 
`shouldKeepOneClientPerDelegate` case that verifies two endpoints with 
different `delegate` values each get their own client. This stream test only 
covers the OAuth path.
   
   The stream components support service-account auth (the `clientKey` method 
correctly includes `serviceAccountKey` and `delegate`), but there is no test 
verifying that two `google-calendar-stream` endpoints with the same 
`serviceAccountKey` and different `delegate` values get distinct clients. The 
same gap exists in `GoogleCalendarStreamClientPerEndpointOptionsTest`, 
`GoogleMailStreamClientPerEndpointOptionsTest`, and 
`GoogleSheetsStreamClientPerEndpointOptionsTest`.



-- 
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