test(eventhubs): modernize EventContextTest Mockito setup#48637
Open
j7nw4r wants to merge 1 commit into
Open
Conversation
a68fa9c to
1abecdb
Compare
Member
Author
|
/azp run java - pullrequest |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where checkpoint offsets were not persisted because EventContext.updateCheckpointAsync() only populated the deprecated Checkpoint.offset (Long) while BlobCheckpointStore.updateCheckpoint() persisted Checkpoint.offsetString, resulting in null offset metadata in blob checkpoints.
Changes:
- Propagates
EventData.getOffsetString()into theCheckpointcreated byEventContext.updateCheckpointAsync(). - Updates
BlobCheckpointStore.updateCheckpoint()to preferoffsetStringand fall back to the deprecatedoffset(Long) whenoffsetStringis missing. - Adds regression/unit tests and changelog entries for both the Event Hubs client and the blob checkpoint store.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventContext.java | Populate Checkpoint.offsetString during checkpoint updates. |
| sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventContextTest.java | New regression test asserting offsetString is set on checkpoint updates. |
| sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md | Documents the bug fix in the Event Hubs library. |
| sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobCheckpointStore.java | Adds offsetString/offset fallback behavior and updates validation message. |
| sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobCheckpointStoreTests.java | Adds tests covering fallback/preference behavior for offset metadata writing. |
| sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md | Documents the bug fix in the blob checkpoint store library. |
1dd9843 to
914779c
Compare
Member
Author
|
/azp run java - pullrequest |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - pullrequest |
|
Azure Pipelines successfully started running 1 pipeline(s). |
914779c to
a8aa8be
Compare
Replace deprecated MockitoAnnotations.initMocks(this) with openMocks(this) and close the returned AutoCloseable in @AfterEach. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a8aa8be to
d7f07cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces deprecated
MockitoAnnotations.initMocks(this)withopenMocks(this)inEventContextTest, and closes the returnedAutoCloseablein@AfterEach.The original
EventContext.updateCheckpointAsync()offsetStringfix this branch started as has since landed on main via #49076, so this PR is now just the leftover Mockito API cleanup from review.