The car park now has
Each parking slot is represented by a
parking1(1, 1, e). parking2(1, 2, e). parking3(1, 3, e). parking4(4, 1, w). parking5(4, 2, w). parking6(4, 3, w).
The finite-state machine describing the business logic remains essentially the same. The only difference concerning its states is that the state
The
When the user sets the fan to be handled automatically,
The
The external
In addition to the use of a mock-object for the simulation of the presence/absence of the car in the OUTDOOR, a
Experiments shown that the minimum distance that the sonar is able to intercept is 3 cm, while the maximum is 42 cm. For this reason we established a
As a result of the enhancements previously described, the
To simplify the writing of test cases, we introduced a new class called
Tests from Sprint 1 and Sprint 2 must still hold, however they had to be adapted to deal with the multiple parking-slots. We report hereunder only the most significant fragments of each new test case:
@Test fun checkSlots() { var cco = CarparkingCoapObserver("parkserviceguiactor", blocking = true, verbose = false) actor!!.forward("enterRequest", "enterRequest(0)", "parkmanagerserviceactor") var slotnum6 = cco.observePayload() actor!!.forward("carEnter", "carEnter(0)", "parkmanagerserviceactor") var tokenid6 = cco.observePayload() assertLocationInTime("6", "0", "N", 10000) assertLocationInTime("4", "3", "W", 10000) // REPEAT FOR EVERY PARKING-SLOT // ALL PARKING-SLOTS ARE NOW FULL actor!!.forward("enterRequest", "enterRequest(0)", "parkmanagerserviceactor") assertSlotnum(cco, "0") actor!!.forward("exitRequest", "exitRequest($tokenid4)", "parkmanagerserviceactor") assertLocationInTime("4", "1", "W", 10000) assertLocationInTime("6", "4", "S", 10000) actor!!.forward("exitRequest", "exitRequest($tokenid4)", "parkmanagerserviceactor") assertNotice(cco, "tokenid(invalid)") }
@Test fun checkAlarms() { val ccoo = CarparkingCoapObserver("outdoorsentinelactor", blocking = true) actor!!.emit("outdoorCleared", "outdoorCleared(0)") assertNoEventInTime(ccoo, 1000) actor!!.emit("outdoorOccupied", "outdoorOccupied(0)") assertNoEventInTime(ccoo, 4000) assertEvent(ccoo, "outdoorAlarm(0)") actor!!.emit("outdoorCleared", "outdoorCleared(0)") assertEvent(ccoo, "outdoorAlarmRevoked(0)") val ccof = CarparkingCoapObserver("fanactor", blocking = true) actor!!.forward("fanAuto", "fanAuto(auto)", "parkservicestatusguiactor") actor!!.emit("temperatureAlarm", "temperatureAlarm(0)") assertEvent(ccof, "fanStart(0)") actor!!.emit("temperatureAlarmRevoked", "temperatureAlarmRevoked(0)") assertEvent(ccof, "fanStop(0)") actor!!.forward("fanAuto", "fanAuto(manual)", "parkservicestatusguiactor") actor!!.emit("temperatureAlarm", "temperatureAlarm(0)") assertNoEventInTime(ccof, 1000) actor!!.emit("temperatureAlarmRevoked", "temperatureAlarmRevoked(0)") assertNoEventInTime(ccof, 1000) }
@Test fun checkTrolleyStop() { actor!!.forward("stopTrolley", "stopTrolley(0)", "trolleyactor") actor!!.forward("goto", "goto(parking6)", "trolleyactor") assertNotMovingInTime(2000) actor!!.forward("startTrolley", "startTrolley(0)", "trolleyactor") assertLocationInTime("4", "3", "W", 10000) assertNotMovingInTime(2000) actor!!.forward("goto", "goto(home)", "trolleyactor") delay(2000) actor!!.forward("stopTrolley", "stopTrolley(0)", "trolleyactor") assertNotMovingInTime(2000) actor!!.forward("startTrolley", "startTrolley(0)", "trolleyactor") assertLocationInTime("0", "0", "S", 10000) assertNotMovingInTime(2000) }
|
|
Executable model: trolley.qak | Test plan: Sprint3Test.kt |