100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Minor test reliability updates
Rich Turnerfc1dba863c59
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovyindex c5c02d7e7..3b878e65c 100644--- a/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy@@ -169,7 +169,25 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,def agentService = container.getService(AgentService.class)def assetProcessingService = container.getService(AssetProcessingService.class)- when: "a mock agent that uses the mock protocol is created with a valid protocol configuration"+ when: "a client websocket connection and attached event bus and service"+ def accessToken = {+ authenticate(+ container,+ MASTER_REALM,+ KEYCLOAK_CLIENT_ID,+ MASTER_REALM_ADMIN_USER,+ getString(container.getConfig(), SETUP_KEYCLOAK_ADMIN_PASSWORD, SETUP_KEYCLOAK_ADMIN_PASSWORD_DEFAULT)+ ).token+ }+ List<SharedEvent> collectedSharedEvents = []+ def eventBus = createEventBus(collectedSharedEvents)+ def clientEventService = new ClientEventService(eventBus, container.JSON)+ def websocketSession = connect(createWebsocketClient(), clientEventService.endpoint, serverUri(serverPort), WEBSOCKET_EVENTS, MASTER_REALM, accessToken.call())++ and: "a subscription is made to the agent status event"+ clientEventService.subscribe(AgentStatusEvent.class)++ and: "a mock agent that uses the mock protocol is created with several protocol configurations"def mockAgent = new ServerAsset()mockAgent.setName("Mock Agent")mockAgent.setType(AssetType.AGENT)@@ -192,24 +210,6 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,mockAgent.setRealmId(Constants.MASTER_REALM)mockAgent = assetStorageService.merge(mockAgent)- and: "a client websocket connection and attached event bus and service"- def accessToken = {- authenticate(- container,- MASTER_REALM,- KEYCLOAK_CLIENT_ID,- MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), SETUP_KEYCLOAK_ADMIN_PASSWORD, SETUP_KEYCLOAK_ADMIN_PASSWORD_DEFAULT)- ).token- }- List<SharedEvent> collectedSharedEvents = []- def eventBus = createEventBus(collectedSharedEvents)- def clientEventService = new ClientEventService(eventBus, container.JSON)- def websocketSession = connect(createWebsocketClient(), clientEventService.endpoint, serverUri(serverPort), WEBSOCKET_EVENTS, MASTER_REALM, accessToken.call())-- and: "a subscription is made to the flight priority filters"- clientEventService.subscribe(AgentStatusEvent.class)-then: "the protocol configurations should be linked and their deployment status should be available in the agent service"conditions.eventually {assert protocolLinkedConfigurations.size() == 4@@ -225,6 +225,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,assert agentService.getProtocolConnectionStatus(config2.getReferenceOrThrow()) == ConnectionStatus.ERRORassert agentService.getProtocolConnectionStatus(config3.getReferenceOrThrow()) == ConnectionStatus.ERRORassert agentService.getProtocolConnectionStatus(config4.getReferenceOrThrow()) == ConnectionStatus.DISABLED+ assert !collectedSharedEvents.isEmpty()assert collectedSharedEvents[0] instanceof AgentStatusEventassert (collectedSharedEvents[0] as AgentStatusEvent).protocolConfiguration.entityId == mockAgent.idassert (collectedSharedEvents[0] as AgentStatusEvent).protocolConfiguration.attributeName == "mockConfig1"diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovyindex 851377b11..d6839422a 100644--- a/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy@@ -100,7 +100,7 @@ class KNXImportTest extends Specification implements ManagerContainerTrait {def knxProjectFileResource = getClass().getResourceAsStream("/org/openremote/test/protocol/knx/knx-import-testproject.knxproj")- String base64Content =","+ Base64.getEncoder().encodeToString(knxProjectFileResource.bytes)+ String base64Content = Base64.getEncoder().encodeToString(knxProjectFileResource.bytes)def fileInfo = new FileInfo("knx-import-testproject.knxproj", base64Content, true)def assets = agentResource.importLinkedAttributes(null, knxAgent.getId(), "knxConfigError1", null, null, fileInfo)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.groovyindex 13b2e6d38..4aa2ec393 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@@ -26,7 +26,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {def "Check timer protocol agent and device asset deployment"() {given: "expected conditions"- def conditions = new PollingConditions(timeout: 15, initialDelay: 0)+ def conditions = new PollingConditions(timeout: 20, initialDelay: 0)when: "the container starts"def serverPort = findEphemeralPort()