retail-discounts
is a discount calculator for a retail shop. This guide will walk you through the steps to run the application, its tests, and how to generate coverage reports.
- Docker
- Maven
- JDK 17 or above
git clone https://github.com/mjmaahs/retail-discounts.git
To run both the database and application, open your command prompt and execute:
cd path/to/retail-discounts
docker-compose up -d mongo && docker-compose up -d mongo-express && mvn clean install && docker-compose up -d app
To execute the unit tests, use the following Maven command:
cd path/to/retail-discounts
mvn test
Running the tests via Maven will also generate a JaCoCo coverage report. The report can be found at:
path/to/retail-discounts/target/site/jacoco
The SonarQube report can be located at:
path/to/retail-discounts/src/sonarqubereport
If you want to use Postman for testing or go into development mode:
- Start the database and DB express services only.
- Start the app from your IDE.
- Uncomment the
CommandLineRunner
in theRetailDiscountsApplication
class to insert raw data upon startup. - Disable CSRF in the
SecurityConfig
class.
The following Actuator endpoints are enabled: health
, info
, mappings
.
Authentication: username: john/test123
- URL:
http://localhost:8080/api/calculate-net-amount
- Method:
POST
- Body:
{"productSerialNumbers": ["000001","000002","000003"],"username": "bruce"}
- Basic Auth:
username: john/test123
To run only the database, execute:
cd path/to/retail-discounts
docker-compose up -d mongo && docker-compose up -d mongo-express && mvn clean install