Skip to content

support Vert.x 5.2.0: implement MongoClient.ping() - #36

Merged
basalt79 merged 1 commit into
mainfrom
feature/vertx-5.2.0-ping
Sep 18, 2026
Merged

basalt79 merged 1 commit into
mainfrom
feature/vertx-5.2.0-ping

Conversation

@basalt79

Copy link
Copy Markdown
Member

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.

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.
@basalt79
basalt79 requested a review from zyclonite September 18, 2026 11:02
@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.17%. Comparing base (3f83d4e) to head (a4ce9ed).

Files with missing lines Patch % Lines
...rc/main/java/com/noenv/wiremongo/mapping/Ping.java 83.33% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DemonicTutor DemonicTutor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@basalt79
basalt79 merged commit 716e55e into main Sep 18, 2026
4 checks passed
@zyclonite
zyclonite deleted the feature/vertx-5.2.0-ping branch September 18, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants