# developer-joyofenergy-java **Repository Path**: DuiBuQi/developer-joyofenergy-java ## Basic Information - **Project Name**: developer-joyofenergy-java - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-09-24 - **Last Updated**: 2021-10-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Welcome to PowerDale PowerDale is a small town with around 100 residents. Most houses have a smart meter installed that can save and send information about how much power a house is drawing/using. There are three major providers of energy in town that charge different amounts for the power they supply. - _Dr Evil's Dark Energy_ - _The Green Eco_ - _Power for Everyone_ # Introducing JOI Energy JOI Energy is a new start-up in the energy industry. Rather than selling energy they want to differentiate themselves from the market by recording their customers' energy usage from their smart meters and recommending the best supplier to meet their needs. You have been placed into their development team, whose current goal is to produce an API which their customers and smart meters will interact with. Unfortunately, two members of the team are on annual leave, and another one has called in sick! You are left with another ThoughtWorker to progress with the current user stories on the story wall. This is your chance to make an impact on the business, improve the code base and deliver value. ## Story Wall At JOI energy the development team use a story wall or Kanban board to keep track of features or "stories" as they are worked on. The wall you will be working from today has 7 columns: - Backlog - Ready for Dev - In Dev - Ready for Testing - In Testing - Ready for sign off - Done Examples can be found here [https://leankit.com/learn/kanban/kanban-board/](https://leankit.com/learn/kanban/kanban-board/) ## Users To trial the new JOI software 5 people from the JOI accounts team have agreed to test the service and share their energy data. | User | Smart Meter ID | Power Supplier | | ------- | --------------- | --------------------- | | Sarah | `smart-meter-0` | Dr Evil's Dark Energy | | Peter | `smart-meter-1` | The Green Eco | | Charlie | `smart-meter-2` | Dr Evil's Dark Energy | | Andrea | `smart-meter-3` | Power for Everyone | | Alex | `smart-meter-4` | The Green Eco | These values are used in the code and in the following examples too. ## Requirements The project requires [Java 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) or higher. The project makes use of Gradle and uses the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), which means you don't need Gradle installed. ## Useful Gradle commands The project makes use of Gradle and uses the Gradle wrapper to help you out carrying some common tasks such as building the project or running it. ### List all Gradle tasks List all the tasks that Gradle can do, such as `build` and `test`. ```console $ ./gradlew tasks ``` ### Build the project Compiles the project, runs the test and then creates an executable JAR file ```console $ ./gradlew build ``` Run the application using Java and the executable JAR file produced by the Gradle `build` task. The application will be listening to port `8080`. ```console $ java -jar build/libs/joi-energy.jar ``` ### Run the tests There are two types of tests, the unit tests and the functional tests. These can be executed as follows. - Run unit tests only ```console $ ./gradlew test ``` - Run functional tests only ```console $ ./gradlew functionalTest ``` - Run both unit and functional tests ```console $ ./gradlew check ``` ### Run the application Run the application which will be listening on port `8080`. ```console $ ./gradlew bootRun ``` ## API Below is a list of API endpoints with their respective input and output. Please note that the application needs to be running for the following endpoints to work. For more information about how to run the application, please refer to [run the application](#run-the-application) section above. ### Store Readings Endpoint ```text POST /readings/store ``` Example of body ```json { "smartMeterId": , "electricityReadings": [ { "time":