Skip to content

Latest commit

 

History

History
97 lines (58 loc) · 4.01 KB

how_to_test.md

File metadata and controls

97 lines (58 loc) · 4.01 KB

How to test?

Open API (Swagger) UI

For Open API (Swagger) Documentation UI and the endpoints, open http://localhost:8080/swagger-ui/index.html after running the app.

swagger


Postman Collection

The Postman Collection shared in the resources can be modified and used for testing the endpoints.

Tip

When running create Account method on Postman, accountId variable is automatically set using the following script. The other Postman methods e.g. credit Money To Account uses the last created accountId if its value is not changed on the request body.

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("accountId", jsonData.data.id);

API Endpoints

Note

All URIs are relative to http://localhost:8080/api/v1


Class Method HTTP request Description
AccountCommandController createAccount POST /accounts Creates a new account using the given request parameters
AccountCommandController creditMoneyToAccount PUT /accounts/credit/{accountId} Credits money to the given account
AccountCommandController debitMoneyFromAccount PUT /accounts/debit/{accountId} Debits money from the given account


Class Method HTTP request Description
AccountQueryController findById GET /accounts/{accountId} Retrieves a single account by the given id
AccountQueryController listEventsForAccount GET /accounts/{accountId}/events Retrieves all events for the given account


Connecting to H2 database

In order to connect to the H2 database using DBeaver, IntelliJ IDEA, etc. the following url can be used after running the application:

jdbc:h2:tcp://localhost:9092/mem:bank_account_db

db settings



Connecting to Axon Server UI

After starting the application container on Docker, Axon Server UI will be reachable on http://localhost:8024/.

axon ui


Click on Commands menu to list the executed commands:

axon commands


Then, in order to list the queries, click on Queries menu:

axon queries


We can see all the events in the Search section. Click on Search button on the Search section to grab all events:

axon search



Unit & Integration Tests

Unit Tests are provided in the corresponding package(s).