The project is organized in way of mix Hexagonal architecture + DDD + Clean architecture.
code
- Java source code
e2e
- Karate tests
api
folder - APIFirst approach. Implementation of autogenerated REST interfaces from openapi spec. src/test/resources/compose
folder with docker compose to run locally required infrastructure such as DB, colors API, etc.api
folder in each submodule is used to generate client API. There is openapi spec file.cd code
mvn clean install
Options to enable/disable different test types:
-DskipTests
skips both unit and integration tests
-DskipUnitTests
skips unit tests but executes integration tests
-DskipIntegrationTests
skips integration tests but executes unit tests
To run integration tests docker-compose should be up.
docker-compose -f ./orders-boot/src/test/resources/compose/docker-compose.yml up
java -jar -DLOCAL_PASSWORD=<LOCAL_PASSWORD> -Dspring.profiles.active=local ./code/orders-boot/target/orders-boot-*.jar
where LOCAL_PASSWORD
is password applied on local env for all users by default which are specified in auth.users
section in application-local.yml
.
By default, each time when app starts the keypair for JWT is generated. It means after restart app JWT should be generated. Later we add possibility to use static keys.
Swagger http://localhost:8080/retail/swagger-ui/index.html.
cd e2e/karate
mvn clean verify -Dkarate.env=local
It is possible to specify username/password via env vars which will be used by karate, defaults see in config-local-secret.yml
mvn clean verify -Dkarate.env=local -DUSERNAME=<TEST_USERNAME> -DPASSWORD=<TEST_PASSWORD>
where TEST_USERNAME
and TEST_PASSWORD
is username and password with which app started
mvn -B clean verify -DskipITs pitest:mutationCoverage pitest:report-aggregate-module
Mutation report is located <ROOT_MODULE>/target/pit-reports/index.html
UT coverage is located <ROOT_MODULE>/jacoco-report-aggregate/target/site/jacoco-aggregate/index.html
To apply format for java and pom.xml run mvn with the format-apply
profile
Example: mvn clean install -DskipTests -P format-apply
curl --location 'http://localhost:8080/retail/auth/token' \
--header 'Content-Type: application/json' \
--data '{
"username": "<USERNAME>",
"password": "<PASSWORD>"
}'