From 7b51b4593b5f9037118dae424247978bb0f31189 Mon Sep 17 00:00:00 2001 From: Aaron Hoffer Date: Thu, 31 Oct 2019 06:50:11 -0700 Subject: [PATCH] Updated readme and port # --- README.md | 12 +++++++----- src/main/java/status/StatusEndpointApplication.java | 2 -- src/main/resources/application.properties | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d4228a1..d7cbc46 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ ## Simulated Job Status Endpoint A endpoint for testing polling -Instructions -1. Start the Spring Application -2. In a browser, go to `http://localhost:8080/job/1` +###Instructions +1. Start the Spring application +2. In a browser, go to `http://localhost:9000/job/1` 3. The current status of job #1 is dipslayed in the browser, e.g. **INPROGRESS** 4. Refresh the browser several times until the status changes. Some jobs are stuck in the INPROGRESS and never complete. This is part of the simulation. -* The endpoint's path is `/job/{id}`, where `id` can be any string. If the string is unrecognized, a new job is created. If `id` is recognized, its current status is returned. +### How it works +The endpoint's path is `/job/{id}`, where `id` can be any string. If the string is unrecognized, a new job is created. If `id` is recognized, its current status is returned. The lifecycle of a job is: ``` @@ -16,4 +17,5 @@ The lifecycle of a job is: +----> FAILED ``` -The lifecycle of a `Job` is determined randomly by the `JobFactory` when the `Job` is created. \ No newline at end of file +* The lifecycle of a `Job` is determined randomly by the `JobFactory` when the `Job` is created. +* The probability of moving from one state to the next is hardcoded in the `JoStateMachine` class. \ No newline at end of file diff --git a/src/main/java/status/StatusEndpointApplication.java b/src/main/java/status/StatusEndpointApplication.java index 2e9e65e..cce14a1 100644 --- a/src/main/java/status/StatusEndpointApplication.java +++ b/src/main/java/status/StatusEndpointApplication.java @@ -6,9 +6,7 @@ @SpringBootApplication public class StatusEndpointApplication { - public static void main(String[] args) { SpringApplication.run(StatusEndpointApplication.class, args); } - } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d14af3b..630ce16 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,2 @@ #logging.level.web=DEBUG +server.port=9000 \ No newline at end of file