The project is a polygon for learning the art of building and testing an API.
Using the well-known ope service LUCHTMEETNET 2020 OPENAPI, I have launched the stateless service that aggregates the data, produced by LuchtmeeNet open API.
The website Luchtmeetnet is an initiative of the Ministry of Infrastructure and the Environment, the National Institute of Public Health and the Environment (RIVM), GGD Amsterdam, EPA for the greater Rotterdam area (DCMR), the Province of Limburg, EPA's middle and western Brabant (OMWB) and EPA region Arnhem (ODRA). The website displays the measured air quality on several measuring stations in the Netherlands and the calculated air quality maps. This API grants direct access to detailed information of the stations and the measurements made there.
Luchtmeetnet service is providing paged data over many pollutants measured by many stations every hour. My motivation is to aggregate the measurements and provide the snapshots that are helpful if you want some practical answers about the quality of air you are breathing, or if you want to know the trends of air contamination in your region.
- Java JDK 8+/Kotlin as main execution environment;
- Vert.X - Polyglot lightweight asynchronous event-driven platform that runs the stateless services;
- Gradle 6 as main build tool;
- Vert.X Unit and JUnit 4 as testing framework
You need to have Java 8 SDK set up.
This project was created in IntelliJ Community edition.
This project uses Gradle Wrapper. Switch to the project root directory and use one the following commands. Build the project:
$./gradlew build
Run the Vert.X server in development mode
$./gradlew run
Each data service is shipped with integration tests. Current framework of integration tests is built with Apache Http Client, Vert.X Unit and Junit. Integration tests of air quality monitor API are also armed with Test Retry Gradle Plugin. They are integrated with CircleCI platform.
The synchronous HTTP client is to be replaced either with REST Assured or with Vert.X Async Http client
Run integration tests using command:
$./gradlew test
Build a fat Jar and run in production mode using command
$./gradlew shadowJar
$java -jar build/libs/app-shadow.jar
OpenAPI is available: airrotterdam-api