The name for this project was automatically generated by Github. Follow me: @elvisoliveira
mvn spring-boot:run
mvn test
newman run ./postman_collection.json --environment ./postman_environment.json --iteration-data ./postman_data.json
There is a simple UI running on the root (/) controller. Since the default port is 1337, if you are running the app locally you can have access to it on http://127.0.0.1:1337/
When the app starts a keypair is generated and delivered the file postman_data.json
, you may use the info on it.
A single digit is defined following this rules: Given an integer, we need to find the single digit of it.
- If x has only one digit, then its single digit is x.
- Otherwise, the single digit of x equals the single digit of the sum of the digits of x.
For instance, the single digit of 9875 will be calculated as:
Parameter | Calc | Return |
---|---|---|
9875 | 9 + 8 + 7 + 5 | 29 |
29 | 2 + 9 | 11 |
11 | 1 + 1 | 2 |
2 | 2 | 2 |
2 | 2 | 2 |
Given two numbers n and k, P must be defined as an string concatenation of n * k.
Example:
- n = 9875
- k = 4
- p = 9875 9875 9875 9875
singleDigit = singleDigit(9875987598759875)
// 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 + 5 + 7 + 8 + 9 = 116
singleDigit = singleDigit(116)
// 1 + 1 + 6 = 8
singleDigit = singleDigit(8)
The singleDigit function must have the following parameters:
- n: A string representing an integer
1 <= n <= 10ˆ10000002
- k: An integer representing the number of concatenation times
1 <= k <= 10ˆ53
- The single digit function shall return an integer
- A CRUD must be created for users
- A user has a name, email, address and a list of single digit results already calculated
- Each result list object must contain which parameters were inputted and the result of it
- A memory cache must be created to store the last 10 calculations performed by the single digit function, this cache is user independent, that is, if a calculation has already been performed and it is on the cache, it must not be performed again. Using caching frameworks is not allowed
- User name and email information must be encrypted with an asymmetric key
RSA
of size 2048. Each user may have a separated encryption key. The information will be encrypted with the public key and the client will decrypt using their private key
- Endpoints must be made available for the users CRUD
- An endpoint must be available for single digit calculation, this can be optionally associated with a user
- An endpoint that retrieves all calculations for a given user must be created
- An endpoint to send the user public key
that will be used for encryption
must be created. This API should receive as string that will contain the key
- The application must contain an in-memory database
- Maven should be used to build, run tests and start the application
- Unit tests must be created
- Postman integrated tests must be created and it's collection must be at the root of the repository
- This collection should be called "postman_collection.json"
- An Open API Swagger file should be created with API specification