Giter Site home page Giter Site logo

sky-test's Introduction

Sky test task

Project requirements described in the "Sky-task-requirements.pdf" file of the projects root folder.


Project consists of 2 modules:
  1. sky-test-api: (OpenApi spec holder, code generator (DTOs), source of truth API)
  2. sky-test-server: Spring Boot REST App based on generated DTOs of the "sky-test-api"

Technologies and libraries used:

  • Spring Boot 3
  • Spring Boot Data JPA
  • Spring Security (Basic Auth)
  • Lombok, Mapstruct and more (see POM file)
  • Docker + docker-compose
  • MySql, H2
  • OpenAPI 3
  • Maven
  • Junit 5, Mockito, Swagger-request-validator-spring-webmvc
  • Java 21

Table of Contents


Installation

  1. Clone the repository:
    git clone https://github.com/SergEndorfin/sky-test
  2. Navigate to the project directory:
    cd project
  3. Build the project:
    mvn clean install
    Note: It is necessary to run exactly "mvn install" first time to populate your local .m2 local Maven folder with the "sky-test-api" library, because "sky-test-api" does not store in any remote repositories.

Usage

There are 3 profiles configured in the project: default, dev, local.

To run the "sky-test-server" App with imbedded H2 DB you need to use "local" profile (all integration tests using "local" profile):

mvn spring-boot:run -Dspring-boot.run.profiles=local

You can run "mysqldb" service from docker-compose file and "dev" and "default" profile will interact with MySql DB:

mvn spring-boot:run -Dspring-boot.run.profiles=dev

If you want to test "ready to use" solution on your local, you can run

docker compose up --build

it will build the image based on Dockerfile from the "sky-test-server" folder and run both "sky-test-server" App and MySql containers. Then you can find "Sky-test.postman_collection.json" file in the root folder, put it into the Postman App and send requests to the endpoints of the running App with Basic Auth. For this, firstly, you need to fire "POST http://localhost:8080/v1/users" endpoint to create the user.


Contributing

"API first" approach has been implemented. To add a new endpoint you need to start from the "sky-test-api" specification module.

  1. Add spec info into OpenApi yml files.
  2. Then follow the TDD approach: add integration test like in "UserControllerApiValidationTest" class of the "sky-test-server" module with expected results to make sure API is fine.
  3. Add Controller endpoint, Service, Repository stuff
  4. Add unit tests for mapping (DTO to entity) and for everything from Step 3.

!! Each layer should be tested separately by utilizing Junit 5 and mockito. !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.