Eclipse Vert.x 3.5.1 released!
We have just released Vert.x 3.5.1!
Fixes first!
As usual this release fixes bugs reported in 3.5.0, see the release notes.
JUnit 5 support
This release introduces the new vertx-junit5 module.
JUnit 5 is a rewrite of the famous Java testing framework that brings new interesting features, including:
- nested tests,
- the ability to give a human-readable description of tests and test cases (and yes, even use emojis),
- a modular extension mechanism that is more powerful than the JUnit 4 runner mechanism (@RunWith annotation),
- conditional test execution,
- parameterized tests, including from sources such as CSV data,
- the support of Java 8 lambda expressions in the reworked built-in assertions API,
- support for running tests previously written for JUnit 4.
Suppose that we have a SampleVerticle
verticle that exposes a HTTP server on port 11981.
Here is how we can test its deployment as well as the result of 10 concurrent HTTP requests:
The test method above benefits from the injection of a working Vertx
context, a VertxTestContext
for dealing with
asynchronous operations, and the guarantee that the execution time is bound by a timeout which can optionally be configured
using a @Timeout
annotation.
The test succeeds when all checkpoints have been flagged.
Note that vertx-junit5
is agnostic of the assertions library being used: you may opt for the built-in JUnit 5 assertions
or use a 3rd-party library such as AssertJ as we did in the example above.
You can checkout the source on GitHub, read the manual and learn from the examples.
Web API Contract enhancements
The package vertx-web-api-contract
includes a variety of fixes, from schema $ref
to
revamped documentation. You can give a look at list of all
fixes/improvements here and all
breaking changes here.
From 3.5.1 to load the openapi spec and instantiate the Router you should use new method OpenAPI3RouterFactory.create()
that replaces old methods createRouterFactoryFromFile()
and createRouterFactoryFromURL()
. This new method accepts
relative paths, absolute paths, local URL with file://
and remote URL with http://
. Note that if you want refeer to
a file relative to your jar’s root, you can simply use a relative path and the parser will look out the jar and into the
jar for the spec.
From 3.5.1 all settings about OpenAPI3RouterFactory
behaviours during router generation are inglobed in a new object called
RouterFactoryOptions
. From
this object you can:
- Configure if you want to mount a default validation failure handler and which one
(methods
setMountValidationFailureHandler(boolean)
andsetValidationFailureHandler(Handler)
) - Configure if you want to mount a default 501 not implemented handler and which one
(methods
setMountNotImplementedFailureHandler(boolean)
andsetNotImplementedFailureHandler(Handler)
) - Configure if you want to mount
ResponseContentTypeHandler
automatically (methodsetMountResponseContentTypeHandler(boolean)
) - Configure if you want to fail during router generation when security handlers are not configured
(method
setRequireSecurityHandlers(boolean)
)
After initialization of route, you can mount the RouterFactoryOptions
object with method routerFactory.setOptions()
when you want before calling getRouter()
.
RxJava deprecation removal
It is important to know that 3.5.x will be the last release with the legacy xyzObservable()
methods:
has been replaced since Vert.x 3.4 by:
The xyzObservable()
deprecated methods will be removed in Vert.x 3.6.
Wrap up
Vert.x 3.5.1 release notes and breaking changes:
- https://github.com/vert-x3/wiki/wiki/3.5.1-Release-Notes
- https://github.com/vert-x3/wiki/wiki/3.5.1-Breaking-Changes
The event bus client using the SockJS bridge are available from NPM, Bower and as a WebJar:
- https://www.npmjs.com/package/vertx3-eventbus-client
- https://github.com/vert-x3/vertx-bus-bower
- http://www.webjars.org/
Docker images are also available on the Docker Hub. The Vert.x distribution is also available from SDKMan and HomeBrew.
The artifacts have been deployed to Maven Central and you can get the distribution on Bintray.
Happy coding !