Adidas Services (Technical Test)
Adidas Product and Review services.
How to run
There are two possible options to run the solution:
- Running locally, using Springboot Maven plugin:
- Check application.properties in both modules (review-service and product-service) and set appropriate properties: Review writing credentials, ports and API endpoints. Services ports must be different.
- Start review-service first, in order to do that, change the directory to review-service and execute
a command:
./mvnw spring-boot:run
(ormvnw spring-boot:run
on Windows). - Change the directory to product-service and execute the same Maven command -
spring-boot:run
- Assert that both services are running and there are no errors in the standard output.
- Running using Docker Maven plugin:
-
Go to the repository root directory and run the following command:
mvn --projects review-service,product-service package -DskipTests && mvn --projects review-service,product-service dockerfile:build
Assert that both modules were built successfully. -
In any directory execute the following Docker commands:
Change environment variables if needed, but don't forget to change port mapping and use correct Review service host if changed.docker network create service-net
docker run -p 8082:8082 --net service-net --name review-host -e REVIEW_SERVICE_PORT=8081 -e REVIEW_ADMIN_USER=admin -e REVIEW_ADMIN_PASS=admin -t adidas-psavinov/review-service
docker run -p 8082:8082 --net service-net --name product-host -e PRODUCT_SERVICE_PORT=8082 -e REVIEW_SERVICE_HOST=review-host:8081 -t adidas-psavinov/product-service
Assert that both services are running and there are no errors in the standard output.
-
How to use
When started, services become available on the specified ports, some preloaded data is available:
Review Service: http://localhost:8081/review/BB5476
Product Service: http://localhost:8082/product/BB5476
How to test
There are tests for both endpoints, to run the tests execute the following command in the corresponding service module directory:
./mvnw test
(or mvnw test
on Windows)
Assert that all tests passed successfully. There are exceptions stack traces during the tests execution, it is an expected
behaviour caused by corresponding logger.error() calls in the DataProvider implementations.