|
| 1 | +# WireMock State Extension Demo |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <a href="https://wiremock.org" target="_blank"> |
| 5 | + <img width="512px" src="https://wiremock.org/images/logos/wiremock/logo_wide.svg" alt="WireMock Logo"/> |
| 6 | + </a> |
| 7 | +</p> |
| 8 | + |
| 9 | +This is a demonstration of the WireMock State Extension, showcasing its initial feature set and usage examples. |
| 10 | + |
| 11 | +## General Overview |
| 12 | + |
| 13 | +- **Watch the Demo Video**: [WireMock State Extension Demo Video](https://www.youtube.com/watch?v=OUrMEpzHbvY) |
| 14 | +- **View the Slides**: [WireMock State Extension Slides](https://github.com/wiremock/wiremock-extension-state/blob/develop/demo/wiremock_state_extension_webinar.pdf) |
| 15 | + |
| 16 | +## Initial Feature Set: The State |
| 17 | + |
| 18 | +- Creating, updating, and deleting a state. |
| 19 | +- Storing different states in association with a context. |
| 20 | +- Request matcher to check for the existence of a context. |
| 21 | +- Handlebars support. |
| 22 | + |
| 23 | +## State |
| 24 | + |
| 25 | +A context can have multiple properties. Each property can be overwritten individually. |
| 26 | + |
| 27 | +### Context |
| 28 | + |
| 29 | +The parent container of a state. Multiple contexts can exist. |
| 30 | + |
| 31 | +### Example: Modeling Queues |
| 32 | + |
| 33 | +- Adding new (unmodifiable) states to the context. |
| 34 | +- Insert as the first or last item. |
| 35 | +- Read access to the first/last/index. |
| 36 | +- Delete first/last/index. |
| 37 | +- Check size. |
| 38 | +- Suggested by @ioanngolovko. |
| 39 | + |
| 40 | +### StateList |
| 41 | + |
| 42 | +### Example: Improving Usability |
| 43 | + |
| 44 | +- Allow defining default values (suggested by @alexandre-chopin). |
| 45 | +- Expose the "list" to Handlebars. |
| 46 | +- Allow building listing endpoints. |
| 47 | +- Query "special" properties: updateCount, listSize, list, property existence. |
| 48 | +- Delete single properties. |
| 49 | +- Loadable in WireMock standalone and Docker container. |
| 50 | + |
| 51 | +<p align="center"> |
| 52 | + <a> |
| 53 | + <img width="512px" src="demo/Images/Example1.png" alt="Example1"/> |
| 54 | + </a> |
| 55 | +</p> |
| 56 | + |
| 57 | +<p align="center"> |
| 58 | + <a> |
| 59 | + <img width="512px" src="demo/Images/Example2.png" alt="Example2"/> |
| 60 | + </a> |
| 61 | +</p> |
| 62 | + |
| 63 | +## Getting Started |
| 64 | + |
| 65 | +To get started with the WireMock State Extension, follow these steps: |
| 66 | + |
| 67 | +1. [Install WireMock](https://github.com/wiremock/wiremock) if you haven't already. |
| 68 | +2. [Install the State Extension](link-to-extension) by following the installation instructions. |
| 69 | +3. Use the provided examples to understand how to create, manage, and interact with states. |
| 70 | + |
| 71 | +## Running the Demo Locally |
| 72 | + |
| 73 | +To run the WireMock State Extension demo locally, follow these steps: |
| 74 | + |
| 75 | +### Prerequisites |
| 76 | + |
| 77 | +Before you begin, ensure you have the following prerequisites installed on your system: |
| 78 | + |
| 79 | +1. **Java Development Kit (JDK)**: WireMock is a Java application, so you'll need the JDK installed. You can download it from the [official Oracle website](https://www.oracle.com/java/technologies/javase-downloads.html) or use an open-source distribution like OpenJDK. |
| 80 | + |
| 81 | +2. **Git**: You'll need Git to clone the WireMock State Extension repository. If you don't have Git installed, you can download it from the [official website](https://git-scm.com/). |
| 82 | + |
| 83 | +### Step 1: Clone the WireMock State Extension Repository |
| 84 | + |
| 85 | +```shell |
| 86 | +git clone https://github.com/wiremock/wiremock-extension-state.git |
| 87 | +cd wiremock-extension-state |
| 88 | +``` |
| 89 | + |
| 90 | +### Step 2: Build the Project |
| 91 | + |
| 92 | +./gradlew build |
| 93 | + |
| 94 | +### Start WireMock with the State Extension |
| 95 | + |
| 96 | +java -jar build/libs/wiremock-standalone-*.jar --extensions="com.github.tomakehurst.wiremock.extension.StateExtension" |
| 97 | +This command starts WireMock with the State Extension enabled. |
| 98 | + |
| 99 | +### Access the Demo |
| 100 | + |
| 101 | +The WireMock State Extension demo is now running locally. You can access it through a web browser or make API requests as needed. Refer to the demo video and slides for more information on using the extension. |
| 102 | + |
| 103 | +That's it! You've successfully set up and run the WireMock State Extension demo on your local machine. |
| 104 | + |
| 105 | +## Usage |
| 106 | + |
| 107 | +You can start experimenting with the WireMock State Extension by using the provided examples. Explore the capabilities of the extension for modeling queues and improving usability. |
| 108 | + |
| 109 | +## Contributions |
| 110 | + |
| 111 | +Contributions and feedback are welcome. If you have ideas or suggestions for improving the WireMock State Extension, feel free to contribute or share your thoughts. |
| 112 | + |
| 113 | +This is a README file with additional content. The page now includes a general overview, links to the demo video and slides, and instructions on how to run the demo locally. |
| 114 | + |
| 115 | + |
| 116 | + |
0 commit comments