Self contained service exposing a HTTP REST API with an embedded H2 database to manage accounts and their balances.
- Java 8
- H2 Database
- Javalin
- Gradle
- JUnit
- Mockito
You can develop and run this application using an IDE such as IntelliJ IDEA.
This can also be done via a command line terminal (examples given using bash shell).
./gradlew testOutput found as ./build/libs/account-manager-*.jar
./gradlew jar./gradlew runJUnit and Mockito are used for Unit testing. Functional tests are tagged with the annotation @Tag("Functional"), they also use the UniRest REST testing tool.
Example curl HTTP request to get account 12345678 balance:
curl --location --request GET 'http://localhost:8080/api/account/balance/12345678'Example curl HTTP request to transfer 120 from account 12345678 to account 88888888:
curl --location --request POST 'http://localhost:8080/api/account/transfer/from/12345678/to/88888888/amount/120'Configuration can be supplied optionally via environment variables.
Optional environment variables:
ACCOUNT_MANAGER_PORT- integer, defaults to8080ACCOUNT_MANAGER_H2_URL- H2 JDBC string, defaults tojdbc:h2:./database/account-manager-dbACCOUNT_MANAGER_H2_USERNAME- string, defaults to emptyACCOUNT_MANAGER_H2_PASSWORD- string, defaults to empty