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