This project is an experiment for designing a simple statemachine. I have used more complex statemachines such as Spring Statemachine. I wanted to make a simple Java based statemachine pattern without the use of a framework. I used Quarkus as a RESTful API framework for demostration and practice purposes.
I based it off an article from Baeldung: https://www.baeldung.com/java-enum-simple-state-machine
Instead of using the LeaveRequestState for manging approval states of somones leave. I decided to make a small statemachine around Git pull requests.
There are a total of 4 states within this state machine.
- DRAFT
- OPEN
- MERGED
- CLOSED
DRAFT is the starting state. MERGED and closed are end states.
DRAFT can transition to OPEN OPEN can transition to MERGED or CLOSED CLOSE can transition to OPEN
An example of a successful flow of creating a pull request and transitioning it to the merge state
An example of an unsuccessful flow is creating a pull request and attempting to transition between states in an incorrect order
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev