Toll Parking is a simple Spring Boot REST API Application, It manages the toll parking of standard and electric cars.
- JDK 8: You can use Oracle JDK8 or Open JDK
- Maven 3.5.X: For dependencies management Download Maven
- H2: In memory Database Download H2 DB
- Postman: For testing Toll Parking API Download Postman
- Clone the repository:
git clone https://github.com/Anasss/tollParking.git
- Install dependencies:
cd tollParking
mvn install
- Running the app:
mvn spring-boot:run
N.B:
- The Installation and the running of the app could be also done using an IDE like IntelliJ or Eclipse
- By default, the app is running on port 8085, this could be changed by editing the file application.properties
A postman collection was attached to the repository under the postman folder. It contains the API entry-points and perform some basic tests on the flow.
In order to import it, open Postman and import Collection and Environement json files:
File -> Import -> Drop the collection json file: TOLL_PARKING_MANUAL.json
File -> Import -> Drop the Environement json file: TOLL_PARKING_ENVIRONEMENT.json
You can now run nominal scenarios without editing any request with the predefined PM parameters (Check-in first parkingSlot found!)
Swagger is used to describe and document Toll Parking REST API.
Once the application is running, Swagger documentation could be accessed from: http://localhost:8085/swagger-ui.html
A toll parking contains multiple parking slots of different types (Standard and Electrical).
Cars of all types come in and out randomly, the API must :
- Send them to the right parking slot of refuse them if there is no slot (of the right type) left.
- Mark the parking slot as Free when the car leaves it
- Bill the customer when the car leaves.
- GET Available parking slots: /v1/shopping/parking-slots/{slotType} Where slotType :
- STD For standard cars: gasoline-powered
- EC_20KW For 20kw power supply for electric cars
- EC_50KW For 50kw power supply for electric cars
- POST Check-in a parking slot: /v1/check-in/parking-slot/{slotId}/{slotType}
- POST Check-out a parking slot and issue the bill: /v1/check-out/parking-slot/{vehicleId}
N.B: These entry-points are already defined in the repository's postman JSON collection, see postman section
A sync scan has been performed to identify potential vulnerabilities in the code: https://snyk.io/test/github/Anasss/tollParking
We should analyze them and fix the identified security issues!
We should also consider fixing some quality issues reported by Codacy and improve code coverage!