Repository navigation
support Vert.x 5.2.0: implement MongoClient.ping() - #36
Merged
Merged
Conversation
Vert.x 5.2.0 adds a new abstract method to io.vertx.ext.mongo.MongoClient: Future<@nullable JsonObject> ping(); WireMongoClient implements that interface, so the build fails against 5.2.0 until the method is provided. Implement it as a regular mockable command rather than an UnsupportedOperationException, so that callers can stub ping() like any other command. Wired in at the usual five points, modelled on the no-argument getCollections and the JsonObject-returning runCommand: - command/PingCommand.java - CommandBase with method name "ping" - mapping/Ping.java - MappingBase<JsonObject, PingCommand, Ping>, defensive copy of the response in returns() - mapping/Mapping.java - "ping" case in the JSON mapping dispatch - WireMongoCommands.java - ping() stub factory - WireMongoClient.java - the MongoClient.ping() override No wiremongo-mocks/ping.json fixture is added on purpose. TestBase loads that directory globally in @BeforeClass, and because ping takes no arguments its mapping matches unconditionally, so a fixture there would intercept every ping call in the whole suite. The JSON dispatch path is covered directly via Mapping.create() instead. stack.version is bumped to 5.2.0 because the new method cannot compile against 5.1.x. The artifact version deliberately stays on 5.1.9-SNAPSHOT; the release version bump belongs to the release commit.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
============================================
+ Coverage 84.12% 84.17% +0.04%
- Complexity 868 876 +8
============================================
Files 138 140 +2
Lines 1550 1561 +11
Branches 103 103
============================================
+ Hits 1304 1314 +10
Misses 129 129
- Partials 117 118 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Vert.x 5.2.0 adds a new abstract method to io.vertx.ext.mongo.MongoClient:
Future<@nullable JsonObject> ping();
WireMongoClient implements that interface, so the build fails against 5.2.0 until the method is provided. Implement it as a regular mockable command rather than an UnsupportedOperationException, so that callers can stub ping() like any other command.
Wired in at the usual five points, modelled on the no-argument getCollections and the JsonObject-returning runCommand:
defensive copy of the response in returns()
No wiremongo-mocks/ping.json fixture is added on purpose. TestBase loads that directory globally in @BeforeClass, and because ping takes no arguments its mapping matches unconditionally, so a fixture there would intercept every ping call in the whole suite. The JSON dispatch path is covered directly via Mapping.create() instead.
stack.version is bumped to 5.2.0 because the new method cannot compile against 5.1.x. The artifact version deliberately stays on 5.1.9-SNAPSHOT; the release version bump belongs to the release commit.