These commands can be used to build the application and start it:
mvn clean install
to buildmvn exec:java
to start
npm install -g @usebruno/cli
to install the Bruno CLIbru run
fromsrc/test/LibraryTests
to run the test cases- If you want to view the test cases themselves then you can find Bruno at https://www.usebruno.com and then use it to open the collection in
src/test
.
The API documentation can be found in two places:
http://localhost:8019/v3/api-docs
for the Open API documentationhttp://localhost:8019/swagger-ui/index.html
for Swagger
- Users cannot upload the same book twice, an error is returned for this scenario.
- Errors are returned if books cannot be found by ISBN or author.
- Errors are returned if books are borrowed/returned that don't belong to the library
- Errors are returned if someone tries to borrow a book and there are no copies left
- If someone returns a book that isn't from the library but matches one that's offered then it will be accepted!
- I decided to implement the Library cache using an enum as more traditional methods such as singleton objects can be defeated using Spring's dependency injection tools.
- The Bruno collection contains tests and assertions to ensure the output of the rest API is correct.
- I implemented a validation exception handler to handle any cases where book attributes are incorrect.
- I used Spring AOP to add a logging aspect to the rest controller.
- Bucket4j is used for rate limiting.