It is test technical task for the company Veikkaus Veikkaus is a reactive Spring Boot microservice for managing players, their wallets, and game events. It is built using reactive programming principles with Project Reactor, R2DBC, and an PostgreSQL-compatible database.
- DockerHub image: varg/veikkaus
- Application work on port
8080by default
docker run -p 8080:8080 varg/veikkausor docker compose
docker-compose up .- DB_NODES : Database nodes (default: localhost:5432)
- DB_NAME : Database name (default:veikkaus)
- DB_USER : Database user (default: postgres)
- DB_PASSWORD : Database password (default: postgres)
- DB_MASTER_NODE : Database master node (for liquibase migration, default: localhost:5432)
- DB_FAILOVER : Database failover (for multihost, ex: r2dbc:postgresql:failover://)
- Create and manage player accounts
- Charge or credit player balances based on game events
- Prevent duplicate events and duplicate players
- Java 21+
- Maven 3.9.5
- PostgreSQL 14+
- for POST request used Basic Auth with username
userand passwordpassword - The Swagger UI page will then be available at the following url:
http://server:port/swagger-ui.html
and the OpenAPI description will be available at the following url for json format: http://server:port/v3/api-docs
- server: The server name or IP
- port: The server port
- context-path: The context path of the application
curl --location 'http://127.0.0.1:8081/player' \
--header 'Content-Type: application/json' \
--data '{
"name": "Evgenii"
}'./mvnw spring-boot:runor
./mvnw clean package
java -jar target/veikkaus-0.0.1-SNAPSHOT.jardocker build -t veikkaus-app .
docker run -p 8080:8080 veikkaus-appapplication-test.yaml is used for integration and contract tests.
Ensure both Liquibase and R2DBC point to the same in-memory database:
spring:
r2dbc:
url: r2dbc:h2:mem://localhost/testdb;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
liquibase:
url: jdbc:h2:mem://localhost/testdb;DB_CLOSE_DELAY=-1;MODE=PostgreSQLLiquibase tables not found during test: Ensure R2DBC and JDBC share the same memory database (localhost/testdb). Contracts not generating: Ensure spring-cloud-contract-maven-plugin has correct baseClassForTests configured.
For further reference, please consider the following sections: