/adidas-services

Adidas Product and Review services

Primary LanguageJava

Adidas Services (Technical Test)

Adidas Product and Review services.

How to run

There are two possible options to run the solution:

  1. Running locally, using Springboot Maven plugin:
    1. 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.
    2. Start review-service first, in order to do that, change the directory to review-service and execute a command: ./mvnw spring-boot:run (or mvnw spring-boot:run on Windows).
    3. Change the directory to product-service and execute the same Maven command - spring-boot:run
    4. Assert that both services are running and there are no errors in the standard output.

  2. Running using Docker Maven plugin:
    1. 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.

    2. 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.