From 02aa654cf25b93c30d6d66d4698c8051c44acc32 Mon Sep 17 00:00:00 2001 From: Eric Bariaux <375613+ebariaux@users.noreply.github.com> Date: Tue, 11 Aug 2026 17:41:32 +0200 Subject: [PATCH] Re-get the protocol in the eventually loop, otherwise it keeps the same value through all iterations --- .../entsoe/agent/protocol/EntsoeProtocolTest.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/entsoe/src/test/groovy/org/openremote/extension/entsoe/agent/protocol/EntsoeProtocolTest.groovy b/entsoe/src/test/groovy/org/openremote/extension/entsoe/agent/protocol/EntsoeProtocolTest.groovy index 48906be..623d463 100644 --- a/entsoe/src/test/groovy/org/openremote/extension/entsoe/agent/protocol/EntsoeProtocolTest.groovy +++ b/entsoe/src/test/groovy/org/openremote/extension/entsoe/agent/protocol/EntsoeProtocolTest.groovy @@ -463,10 +463,11 @@ class EntsoeProtocolTest extends Specification implements ManagerContainerTrait asset = assetStorageService.merge(asset) def attributeRef = new AttributeRef(asset.id, "energyPrice") - def protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) + def protocol = null then: "the protocol is connected and attribute linked" conditions.eventually { + protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) assert protocol != null assert agentService.getAgent(agent.id).getAgentStatus().orElse(null) == ConnectionStatus.CONNECTED assert protocol.getLinkedAttributes().containsKey(attributeRef) @@ -943,10 +944,11 @@ class EntsoeProtocolTest extends Specification implements ManagerContainerTrait asset = assetStorageService.merge(asset) def attributeRef = new AttributeRef(asset.id, "energyPrice") - def protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) + def protocol = null then: "the protocol is connected and attribute linked" conditions.eventually { + protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) assert protocol != null assert agentService.getAgent(agent.id).getAgentStatus().orElse(null) == ConnectionStatus.CONNECTED assert protocol.getLinkedAttributes().containsKey(attributeRef) @@ -1021,10 +1023,11 @@ class EntsoeProtocolTest extends Specification implements ManagerContainerTrait asset = assetStorageService.merge(asset) def attributeRef = new AttributeRef(asset.id, "energyPrice") - def protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) + def protocol = null then: "the protocol is connected and attribute linked" conditions.eventually { + protocol = (EntsoeProtocol) agentService.getProtocolInstance(agent.id) assert protocol != null assert agentService.getAgent(agent.id).getAgentStatus().orElse(null) == ConnectionStatus.CONNECTED assert protocol.getLinkedAttributes().containsKey(attributeRef)