Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor TimerProtocolTest.groovy update

Rich Turnere89abd0e61d0
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
index c8b4324ca..4bb39ca8c 100644
--- a/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
@@ -46,6 +46,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
sceneAgent = assetStorageService.find(new AssetQuery().name("Scene Agent").type(AssetType.AGENT).parent(managerDemoSetup.apartment1Id))
+ sceneAgent = assetStorageService.find(sceneAgent.id, true)
assert apartment1.getAttribute("awaySceneTimeFRIDAY").get().getValueAsString().orElse("") == "08:30:00"
assert sceneAgent != null
}
@@ -157,6 +158,16 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
assert cronTrigger.cronExpression == "0 0 4 ? * MON,FRI *"
}
+ when: "a timer action is executed"
+ timerProtocol.doTriggerAction(sceneAgent.getAttribute("awaySceneFriday").get())
+
+ then: "the linked macro should have been executed"
+ conditions.eventually {
+ apartment1 = assetStorageService.find(apartment1.id, true)
+ apartment1.getAttribute("awayScene").get().getValueAsString() == "COMPLETED"
+ apartment1.getAttribute("lastExecutedScene").get().getValueAsString() == "AWAY"
+ }
+
when: "a trigger is deleted"
sceneAgent = assetStorageService.find(sceneAgent.id)
sceneAgent.removeAttribute("awaySceneFriday")