gnodet opened a new pull request, #31288: URL: https://github.com/apache/camel/pull/31288
## Summary Fixes three independent bugs in `camel-google-calendar` (stream component) and one in the non-stream component. ## Root Cause **Bug 1 — Stream re-delivery every poll** (`GoogleCalendarStreamConsumer`): The paging loop only followed page tokens when `considerLastUpdate=true`; otherwise a single page was read per poll and the `updatedMin` cursor was never sent to the API, so the same events reappeared on every poll. The in-memory deduplication via `selectUndeliveredAndMoveCursor` could not compensate because events before the cursor timestamp were not filtered by the API. **Bug 2 — P12 credentials rejected** (`GoogleCalendarStreamComponent`, `GoogleCalendarComponent`): The `getClient()` branch for P12 authentication (`emailAddress` + `p12FileName`) was never reached: the guard required `clientId` + `clientSecret` to be present, and without them the method fell through to an `IllegalArgumentException`. Same bug present in the non-stream component. **Bug 3 — `getServiceUrl()` returns `"calendar-stream:null:primary"`** (`GoogleCalendarStreamEndpoint`): `ObjectHelper.isNotEmpty(booleanExpression)` was used where `booleanExpression` was itself the result of `&&`-ing two `isNotEmpty()` calls. `ObjectHelper.isNotEmpty(Boolean.TRUE)` is always `true`, so the guard never filtered the unset-user case. ## Fix 1. **Consumer**: always send `updatedMin` from the cursor when it is set; always follow page tokens until exhausted (regardless of `considerLastUpdate`). Updated the stale `setMaxResults` Javadoc. 2. **Components**: add a P12 branch (`emailAddress != null && p12FileName != null`) before the `serviceAccountKey` branch in both `GoogleCalendarStreamComponent` and `GoogleCalendarComponent`. Updated the `IllegalArgumentException` message to list all three auth paths. 3. **Endpoint**: replace the doubly-nested `ObjectHelper.isNotEmpty(booleanExpression)` with direct checks on the two string fields. ## Tests - `GoogleCalendarStreamConsumerPaginationTest.withoutConsiderLastUpdateStillPagesAndDeduplicates` — proves paging and cursor deduplication work without `considerLastUpdate` - `GoogleCalendarStreamClientPerEndpointOptionsTest.shouldCreateClientWithP12Credentials` — proves stream P12 path dispatches correctly - `GoogleCalendarClientPerEndpointOptionsTest.shouldCreateClientWithP12Credentials` — same for non-stream - `GoogleCalendarStreamEndpointServiceUrlTest` (new class, 3 tests) — proves `getServiceUrl()` returns `null` without user, correct string with both fields set Fixes CAMEL-27972 --- _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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]
