czetsuya / test-powerledger

Save entities in batch using Spring Boot and H2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Powerledger Test

This project is the solution to Powerledger's test.

Test

You are working on a virtual power plant system for aggregating distributed power sources into a single cloud-based energy provider. Please implement a REST API in spring boot that encompasses the following functionality:

  • The API should have an endpoint that accepts - in the HTTP request body - a list of batteries, each containing: name, postcode, and watt capacity. This data should be persisted in a database (In-memory is acceptable).
  • The API should have an endpoint that receives a postcode range. The response body will contain a list of names of batteries that fall within the range, sorted alphabetically. Additionally, there should be some statistics included for the returned batteries, such as total and average watt capacity.
  • The implementation should use Java streams in some way.
  • We will be specifically looking for clean, tested and well-structured code.
  • If you have a way to deploy the application in a cloud environment it would be a plus, but this is not mandatory and won't impact the final outcome of the assessment. Please implement it in Java and check your code into either Github, Gitlab or Bitbucket to allow us to review your test.

Build and Deployment

The following commands build a docker image of the project locally:

docker build . -f docker/Dockerfile -t czetsuyatech/powerledger
docker run czetsuyatech/powerledger

Testing

To run both unit and integration tests.

mvn clean verify

About

Save entities in batch using Spring Boot and H2.


Languages

Language:Java 99.5%Language:Dockerfile 0.5%