Skip to content

aandmaldonado/backend-technical-test-v2

Repository files navigation

Overview Image

👨🏻‍💻 TUI DX Backend Technical Test v2

  1. Overview
  2. Conditions
  3. Tech Stack
  4. Prerequisites
  5. Operations
  6. API Documentation
  7. Database
  8. Security
  9. Getting Started
  10. Running Tests
  11. Postman Collection
  12. cURL
  13. Docker

1. Overview

Welcome to the TUI DX Backend Technical Test v2. This project is designed to evaluate your skills in backend development using Java, Spring Boot, and related technologies.

2. Conditions

  • Create a pilotes order (5, 10, or 15 pilotes).
  • Update a pilotes order within 5 minutes of creation.
  • Search orders by customer name with partial matching.
  • Data validation.
  • Secured search operation, other operations are public.

3. Tech Stack

  • Java: Core programming language.
  • Spring Boot: Framework for building microservices.
  • Spring Data JPA: Data access framework.
  • Spring Security: Authentication and authorization framework.
  • H2: In-memory database.
  • Gradle: Build automation tool.
  • Lombok: Reduces boilerplate code.
  • Swagger: API documentation.
  • Spock: Testing and specification framework.
  • Jacoco: Code coverage tool.
  • Checkstyle: Code quality tool.
  • Veracode: Security scanning tool.
  • SonarLint: Static code analysis tool.
  • Docker: Containerization tool.

4. Prerequisites

Ensure you have the following installed:

5. Operations

Details of the operations are as follows:

Operation Method Description
/orders POST Create a pilotes order
/orders/{id} PUT Update a pilotes order
/orders/search GET Search orders by customer info

6. API Documentation

The API documentation is available at

7. Database

The H2 database console is available at http://localhost:8080/h2-console.

  • jdbc url: jdbc:h2:mem:testdb
  • username: admin
  • password: admin

8. Security

  • Search Operation: Secured, requires authentication (demo user - user/user).
  • Create and Update Operations: Public, no authentication required.

9. Getting Started 🚀

  1. Clone the repository: (If you use bundle file, skip this step)

    git clone https://github.com/aandmaldonado/backend-technical-test-v2.git
    cd backend-technical-test-v2
  2. Build the project:

    ./gradlew build
  3. Run the application:

    ./gradlew bootRun

10. Running Tests

To execute the tests, run:

./gradlew test

To check code coverage, run:

./gradlew jacocoTestReport

The coverage report will be generated in build/reports/jacoco/test/html/index.html.

11. Postman Collection

You can find the Postman collection to test the APIs here.

12. cURL

  1. Create Order:
curl --location 'localhost:8080/orders' \
--header 'Content-Type: application/json' \
--data '{
    "client": {
        "firstName": "Álvaro",
        "lastName": "Maldonado",
        "telephone": "+34641962396"
    },
    "deliveryAddress": {
        "city": "Gandia",
        "street": "Carrer de França 12",
        "postcode": "46730",
        "country": "Spain"
    },
    "pilotes": "5"
}'
  1. Update Order:
curl --location --request PUT 'localhost:8080/orders/1' \
--header 'Content-Type: application/json' \
--data '{
    "client": {
        "firstName": "Álvaro",
        "lastName": "Maldonado",
        "telephone": "+34641962396"
    },
    "deliveryAddress": {
        "city": "Gandia",
        "street": "Carrer de França 12",
        "postcode": "46730",
        "country": "Spain"
    },
    "pilotes": "5"
}'
  1. Search Order:
curl --location 'localhost:8080/orders/search?filter=%C3%81lva' \
--header 'Authorization: Basic dXNlcjp1c2Vy' \
--header 'Cookie: JSESSIONID=8858AD0BFADC46B74E237F686474909C' \
--data ''

13. Docker

To run the application in Docker, follow these steps:

  1. Build local project:
     ./gradlew build
  2. Build Docker image:
     docker-compose build
  3. Run Docker container:
     docker-compose up

About

Java Engineer technical test

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published