Skip to content

DenktMit-eG/spring-test-initializers

Repository files navigation

DenktMit eG :: Testsupport :: Spring Test Initializers

The DenktMit eG spring testsupport repository contains useful bits and pieces we continuously reuse in our Spring based development

This project provides Spring test context initializer useful for managing container provided external services.

The initializers

PostgresInitializer

KeycloakInitializer

Local development

Please note, that any paths used in this documentation are relative to this projects root directory

Requirements

The following runtimes and tools are required to build and run this software:

Requirements Version Installation
Docker latest See Docker
Docker-Compose 2.x (2.21.0) See Docker
Java JDK 17.x (currently 17.0.8.1) See Eclipse Temurin JDK
Maven 3.x (currently 3.9.5) See Apache Maven

Notice, that instead of installing Maven, you can also make use of the Maven wrapper provided within this repository. Wherever you see a global maven action call like mvn install, you can use ./mvnw clean install instead.

Build and run the application

Basically you will have to ensure, that you service dependencies are README.md available. Start them with docker-compose and then build with maven and start the application

Start service dependencies provided by docker-compose

This repository is accompanied by a docker-compose.dev.yaml file. It provides single goto requirement for the build dependencies. Just make sure to have it started before building the project

docker compose --env-file .env-dev -f docker-compose.dev.yaml up -d

Once you are done with it, you can just stop it, so it does not use up your system resources

docker compose  --env-file .env-dev -f docker-compose.dev.yaml stop

and restart it, when you need it again

docker compose  --env-file .env-dev -f docker-compose.dev.yaml start

In case you need a fresh start, you can tell docker-compose to tear down everything and start anew.

# Read the .env file into environment variables
ENV_FILE="$(pwd)/.env-dev"
source ${ENV_FILE}
# Tear down docker containers and remove volumes
docker compose  --env-file .env-dev -f docker-compose.dev.yaml down
# Remove the persistent docker volumes
docker volume rm ${COMPOSE_PROJECT_NAME}_db-it-data

About

The DenktMit eG spring testsupport repository contains useful bits and pieces we continuously reuse in our Spring based development

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages