- Java 8 is required.
- The project using Spring Boot framework.
- The project is built with Gradle (packaged within the project itself).
- The application runs on port 8080.
To launch the web server follow instructions as per your case:
From within project directory run following command (follow as per your case):
-
From git bash, run following command:
./gradle run
-
From windows command prompt:
gradlew run
- Gradle is configured to build for IntelliJ. Run following command and import project in IntelliJ:
./gradlew idea
- Run
Main
fromEvApplication.java
.
You can target http://localhost:8080.
Following webservices are available with example CURL command:
-
GET
/chargingSessions
: Gets all session entities:curl http://localhost:8080/chargingSessions
-
GET
/chargingSessions/summary
: Get the last minute summary:curl http://localhost:8080/chargingSessions/summary
-
POST
/chargingSessions
: This post is with JSON body with station ID for which SessionEntity is to be created.curl -d 'JSON_DATA_HERE' -H "Content-Type: application/json" http://localhost:8080/chargingSessions
Example:
curl -d '{"stationId":"ABC-21"}' -H "Content-Type: application/json" http://localhost:8080/chargingSessions
-
PUT
/chargingSessions/{id}
: Stop the session if already IN_PROGRESS. If the given session is already set to FINISHED, then does nothing and returns theSessionEntity
as it is.curl PUT http://localhost:8080/chargingSessions/{id}
Example:
curl -X PUT http://localhost:8080/chargingSessions/4f675b93-440b-4349-81b9-f500957291f2
To luanch the test suite, run following gradle command:
./gradlew test
Here is screenshot of the test coverage report:
SessionEntity
: Abstract POJO for a session entity.ChargingSessionEntity
: Extension of SessionEntity.Summary
: POJO to hold the summary KPIs.StatusEnum
: Enum for possible status for aSessionEntity
.ChargingStore
: Singleton to keep all theSessionEntity
in memory.
SessionEntityFactory
: Factory to create instances ofSessionEntity
child.
ChargingSessionContoller
: Controller defining all the available APIs forSessionController
.
For further reference, please consider the following sections: