Simulating the System¶
To simulate the system, we can use the Gradle run task like before.
Deployment classes are only generated for components marked with the <<deploy>> stereotype, thus we add it to the elevator system:
<<deploy>> component ElevatorSystem {
...
}
To make life easier, we can also set the main class to the deployment elevator system class.
application {
mainClass.set("elevator.DeployRestElevatorSystem")
}
We can then run the simulation by simply executing:
.\gradlew.bat -q --console plain run
./gradlew -q --console plain run
And send messages to the system, i.e., request the elevator to the first floor, with:
curl http://localhost:8020/ElevatorSystem/pressedOnFloor -Body '1' -Method Post
curl -X POST http://localhost:8020/ElevatorSystem/pressedOnFloor -d '1'