Car rental manual - Yarekr/carrental GitHub Wiki
1. Layers:
This example application is implemented using classical layer application model. Itβs consists of following layers:
β’ Service layer
Not implemented in this application. Eventually shall contain all of rest services (internal / external) which provides endpoints to communicate between client-server and external systems.
β’ Business logic layer
It contains implementation of all business logic cases. It operates on Transfer objects while implementing business usecases.
β’ Data access layer
Layer oriented on database operations. Contains implementation of JDBC together with all queries and mappers between entities and transport objects.
2. Configuration
Application is a simple maven application with basic springboot functionality. Also it includes autoconfigured H2 inmemory database which allows to implement simple persistence layer. For more information please visit carrental/carrental/src/main/resources/ and pom.xml
3. Objects
Business domain of this example project is pretty simple, which strictly affect data model. Itβs consist of Interfaces implemented by Transport Objects. Transport Objects is used to encapsulate data, and to transfer data between layers of an application.
4. Use case
β’ ManageCarUcImpl (public)
Class containing implantation of all actions related to Car management. Use case contains implementation of following business cases:
* Get avarage millage
Fulfills following user story: As a car rental administrator I want to have access to average millage of cars.
* All cars in database
Fulfills following user story: As a car rental administrator I want to print list of all cars in company.
* Rent car by user
Fulfills following user story: As a user I want to rent a car
* Find a car by car name
Fulfills following user story: As an administrator, I want to check if the car is available in the rental
5. Builders
Used Builder pattern design pattern is to separate the construction of a complex object from its representation. By doing so the same construction process can create different representations.
- CarToBuilder
- TruckToBuilder
- UserToBuilder
6. Data Access Objects
-
CarDatabase β Stub for Car database, prepared as a first step of implementation (without database access). It contains dummy data stored in memory as a list of cars.
-
CarRepository β In memory database repository which allows to execute queries using JDBC.
-
UserFactory β (As CarDatabase) Stub for User database, prepared as a first step of implementation. It contains dummy data stored in memory as a list of users.
-
UserRepository β In memory database repository which allows to execute queries using JDBC.
7. Tests
* CarrentalApplicationTest β contain : context load test
* ManageCarUcTest β testing use cases :
- Avarage milage
- Unable to rent a car
- Renta a car Happy path
- Car available but in wrong condition