fr.myprysm.vertx:vertx-test

Myprysm Vert.x test helpers to fasten test writing

License

License

GroupId

GroupId

fr.myprysm.vertx
ArtifactId

ArtifactId

vertx-test
Last Version

Last Version

0.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

fr.myprysm.vertx:vertx-test
Myprysm Vert.x test helpers to fasten test writing

Download vertx-test

How to add to project

<!-- https://jarcasting.com/artifacts/fr.myprysm.vertx/vertx-test/ -->
<dependency>
    <groupId>fr.myprysm.vertx</groupId>
    <artifactId>vertx-test</artifactId>
    <version>0.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/fr.myprysm.vertx/vertx-test/
implementation 'fr.myprysm.vertx:vertx-test:0.1.3'
// https://jarcasting.com/artifacts/fr.myprysm.vertx/vertx-test/
implementation ("fr.myprysm.vertx:vertx-test:0.1.3")
'fr.myprysm.vertx:vertx-test:jar:0.1.3'
<dependency org="fr.myprysm.vertx" name="vertx-test" rev="0.1.3">
  <artifact name="vertx-test" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.myprysm.vertx', module='vertx-test', version='0.1.3')
)
libraryDependencies += "fr.myprysm.vertx" % "vertx-test" % "0.1.3"
[fr.myprysm.vertx/vertx-test "0.1.3"]

Dependencies

provided (15)

Group / Artifact Type Version
io.vertx : vertx-core jar
ch.qos.logback : logback-classic jar 1.2.3
io.vertx : vertx-junit5 jar 3.5.2
org.assertj : assertj-core jar 3.9.0
org.junit.jupiter : junit-jupiter-api jar 5.1.0
org.junit.jupiter : junit-jupiter-engine jar 5.1.0
org.junit.platform : junit-platform-engine jar 1.1.0
org.junit.platform : junit-platform-launcher jar 1.1.0
org.projectlombok : lombok jar 1.16.20
io.vertx : vertx-codegen jar
io.vertx : vertx-lang-kotlin jar
io.vertx : vertx-lang-groovy jar
io.vertx : vertx-lang-ruby jar
io.vertx : vertx-lang-ceylon jar
io.vertx : vertx-lang-js jar

Project Modules

There are no modules declared in this project.

Myprysm Vert.x Utils

A set of utilities to fasten Vert.x application development

Why

Vert.x is a powerful library, this is not a framework. It is not here to dictate your way of coding. This is good because you have to know the components you want to use in order to use them in the good way.

While this approach is really sane for application quality and performance (you know what you do, you start what you need), you still have to write that boilerplate code to validate options here, extract some data from JSON there, register your services and their proxies on the service discovery, binding web endpoints...

This set of utilities is here to save up some time by bringing some basic "features", "bundles" to achieve those repetitive tasks more efficiently.

RxJava on top of that coordinates the heart for blazingly fast asynchronous data streams. Please note that while you're not required to use those Reactive Streams you're strongly encouraged to get a look as once the step has been taken, code readability and stream coordination API will save you hours.

Lombok is also a cool tool when nicely integrated. You can write your Vert.x DataObject with it. Just keep in mind that you will have to write your own setters to generate the automatic AsciiDoc. See the dedicated paragraph.

NOTE that this is an opinionated way to build application with Vert.x, but

  • You're grown enough to take your own decisions
  • You know how annoying is to write/generate/arrange that boilerplate code but you still want to somehow stick to Vert.x principles without introducing a bunch of libraries

Components

Check individual docs for more details.

  • vertx-parent provides some preconfigured dependencies and plugins ready for activation.
  • vertx-test brings Vert.x + Junit5 along with helpers to assert async results quickly.
  • vertx-json is all about manipulating JSON trees + some additions for Jackson that original Vert.x did not include.
  • vertx-validation is a micro-framework for Vert.x Json API that describes the chain through a simple DSL using combinator pattern.
  • vertx-retrofit brings the amazing Retrofit with missing basic interceptors for common API Keys and Authorization headers
  • vertx-core is for configuration and component startup.
  • vertx-service starts your services and perform all the registrations (service discovery, health checks)
  • vertx-web starts your Endpoints (+Vert.x OpenAPI 3.0 support) and reduce the hassle of registering all the routes in a centralized class

Miscellaneous

Vert.x codegen support is enabled by default. All the languages but Scala (clash with one dependency) are generated.

Lombok support

The following Lombok annotations are enough to limit the hassle of writing DataObject

@Data
@NoArgsConstructor
@AllArgsConstructor
// Not required if you create your own setters for the doc 
// or if you don't care about using a fluent API
@Accessors(chain = true)
@DataObject(generateConverter = true)

The remaining work is to declare your attributes and the minimum copy constructor + JsonObject constructor + #toJson()method

    // ......
    public WebVerticleOptions(WebVerticleOptions other) {
        useOpenAPI3Router = other.useOpenAPI3Router;
        specs = other.specs;
        enableCors = other.enableCors;
        cors = other.cors;
        enableMetrics = other.enableMetrics;
        enableHealthChecks = other.enableHealthChecks;
        monitoringPath = other.monitoringPath;
    }

    // JsonObject constructor using Vert.x generated converter
    public WebVerticleOptions(JsonObject json) {
        WebVerticleOptionsConverter.fromJson(json, this);
    }
    
    // toJson using Vert.x generated converter
    public JsonObject toJson() {
        JsonObject json = obj();
        WebVerticleOptionsConverter.toJson(this, json);
        return json;
    }
    // ......

Versions

Version
0.1.3
0.1.2
0.1.1