Read this in other languages: English, Русский
This service is designed to obtain a random or sequential vehicle registration number in the format A000AA 116 RUS
,
where A can be any character from the list [A, E, T, O, P, H, Y, K, X, C, B, M]
, 1 can be any digit, and 116 RUS
is a constant.
MongoDB was chosen as the database system because it typically provides high performance for insertion and retrieval operations.
- Before running the service, you need to build the JAR file first using the following command:
mvn package
- The service utilizes Docker, so to launch it, simply execute the command below.
docker-compose up --build -d
Two containers will be raised (application and MongoDB database) as described in the docker-compose.yml file located at the project root. To confirm that the containers have been successfully brought up, you can use the command below and check the status (Up).
docker ps
- You can stop the service using the following command:
docker-compose stop
- Obtaining a random number
- url: /api/v1/numbers/random GET
- incoming value: The authentication token must be provided in the request header
- return value: A string with the content type of text/plain (for example,
A000AA 116 RUS
)
- Obtaining the next number
- url: /api/v1/numbers/next GET
- incoming value: The authentication token must be provided in the request header
- return value: A string with the content type of text/plain (for example,
A000AA 116 RUS
)
More detailed description can be found in the Swagger documentation, where you can also test the requests. Swagger URL: http://localhost:8080/swagger-ui/index.html.
Additionally, in the requests.http file located at the project root, examples of requests have been provided, which you can execute within a development environment of your choice or using any other method.
- spring boot as the primary web framework
- jjwt for JWT authentication
- modelmapper for entity mapping
- swagger-v3 Swagger for API documentation
- testcontainers library providing the ability to run test containers for integration testing
- СУБД MongoDb
- Docker, docker-compose
Integration tests have been written for CarNumberController.java, which can be found in the src/test
folder.
mvn test
Tests can also be run through the development environment interface, for example Intellij Idea.