A Spring Boot REST API for libraries and their books, with a large JUnit 5 and Karate test suite and a Jenkins pipeline that tests, measures coverage, runs SonarQube analysis, builds a Docker image and deploys a local container.
MSc coursework (Microservices Architecture, Technological University of the Shannon). It deploys to a local Docker container only.
- A layered REST API with separate request and response objects, mappers and shared validation.
- 13 endpoints, including paginated and sorted lists and filters by publication and acquisition date.
- 165 JUnit 5 tests across controllers, repositories, services and integration, plus 21 Karate API scenarios.
- A seven-stage Jenkins pipeline: preflight checks, build and test, coverage and SonarQube analysis, packaging, Docker image, and a local deploy with a retried health check.
- JaCoCo cannot yet read Java 25 classes, so a separate Java 21 build profile measures coverage and enforces a 60% line-coverage rule.
The problem
A coursework REST API for managing libraries and their books. The focus was a clean layered backend together with an automated pipeline for building, testing, checking quality and deploying.
What was built
- Create, read, update and delete for libraries and books. A library has many books, and deleting a library deletes its books.
- 13 REST endpoints, including filters by publication-date and acquisition-date range.
- Pagination and sorting, validation of incoming requests, and structured JSON errors from one central handler.
- An in-memory H2 database created from a schema file, with sample data.
Engineering details
-
Tests. 165 JUnit 5 tests cover:
- controller slices
- repositories
- services and mappers
- an ordered end-to-end integration suite
A Karate runner starts the app on a random port and runs 21 API scenarios.
-
Pipeline. A Jenkins pipeline runs on every GitHub push:
- Checks that the tools, credentials and plugins it needs are present.
- Builds and tests on Java 25.
- Measures coverage and runs SonarQube analysis on Java 21.
- Packages the JAR.
- Builds a Docker image.
- Replaces the local container, then retries a health check until the new version answers.
-
Supply chain. The build overrides vulnerable transitive dependency versions.
Limitations
- The pipeline targets a local Jenkins on Windows, and “deploy” means a container on the same machine.
- The API has no authentication.
- Data lives in memory and resets on restart.