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
Test improvements
Rich Turnera51e22aa1797
diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex 57f99bda7..e29316a89 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -3,7 +3,6 @@ package org.openremote.test.notificationimport com.fasterxml.jackson.databind.node.ObjectNodeimport com.fasterxml.jackson.databind.node.TextNodeimport com.google.firebase.messaging.Message-import org.openremote.container.web.WebServiceimport org.openremote.manager.asset.AssetProcessingServiceimport org.openremote.manager.asset.AssetStorageServiceimport org.openremote.manager.asset.console.ConsoleResourceImpl@@ -13,17 +12,18 @@ import org.openremote.manager.notification.PushNotificationHandlerimport org.openremote.manager.rules.geofence.ORConsoleGeofenceAssetAdapterimport org.openremote.manager.security.ManagerIdentityServiceimport org.openremote.manager.setup.SetupService-import org.openremote.model.query.UserQuery-import org.openremote.model.query.filter.TenantPredicate-import org.openremote.model.util.TextUtil-import org.openremote.test.setup.KeycloakTestSetup-import org.openremote.test.setup.ManagerTestSetup+import org.openremote.manager.web.ManagerWebServiceimport org.openremote.model.attribute.AttributeRefimport org.openremote.model.console.ConsoleProviderimport org.openremote.model.console.ConsoleRegistrationimport org.openremote.model.console.ConsoleResourceimport org.openremote.model.notification.*+import org.openremote.model.query.UserQuery+import org.openremote.model.query.filter.TenantPredicate+import org.openremote.model.util.TextUtilimport org.openremote.test.ManagerContainerTrait+import org.openremote.test.setup.KeycloakTestSetup+import org.openremote.test.setup.ManagerTestSetupimport org.simplejavamail.email.Emailimport spock.lang.Specificationimport spock.util.concurrent.PollingConditions@@ -56,7 +56,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {def managerTestSetup = container.getService(SetupService.class).getTaskOfType(ManagerTestSetup.class)def notificationService = container.getService(NotificationService.class)def pushNotificationHandler = container.getService(PushNotificationHandler.class)- def consoleResource = (ConsoleResourceImpl)container.getService(WebService.class).getApiSingletons().find {it instanceof ConsoleResourceImpl}+ def consoleResource = (ConsoleResourceImpl)container.getService(ManagerWebService.class).apiSingletons.find {it instanceof ConsoleResourceImpl}and: "the clock is stopped for testing purposes"stopPseudoClock()diff --git a/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovyindex af6c00f95..53b2c063c 100644--- a/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy@@ -41,6 +41,14 @@ class TcpClientTest extends Specification implements ManagerContainerTrait {given: "expected conditions"def conditions = new PollingConditions(timeout: 10, delay: 0.2)+ and: "the IO client reconnect time is set low for test purposes"+ def initialMillis = AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS+ def maxMillis = AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS+ def jitterMillis = AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = 0+and: "the container is started"def container = startContainer(defaultConfig(), [])@@ -186,6 +194,9 @@ class TcpClientTest extends Specification implements ManagerContainerTrait {}cleanup: "the server should be stopped"+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = initialMillis+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = maxMillis+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = jitterMillisclient.disconnect()echoServer.stop()}diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovyindex fceb797e6..082a53a58 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy@@ -253,6 +253,18 @@ class WebTargetTest extends Specification {assert grant2.scope == grant.scopeassert ((OAuthPasswordGrant)grant2).username == grant.usernameassert ((OAuthPasswordGrant)grant2).password == grant.password++ when: "serialised"+ Map<String, Object> map = new HashMap<>();+ String v = "{\"test\": 123}"+ map.put("value", v)+ String mapStr = ValueUtil.JSON.writeValueAsString(map)++ and: "deserialised"+ def newMap = ValueUtil.JSON.readValue(mapStr, Map.class)++ then: "should work"+ assert newMap != null}def "Check Basic authentication"() {diff --git a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovyindex 0050f0316..63c0fa5c5 100644--- a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy@@ -44,6 +44,14 @@ class UdpClientTest extends Specification implements ManagerContainerTrait {given: "expected conditions"def conditions = new PollingConditions(timeout: 10, delay: 0.2)+ and: "the IO client reconnect time is set low for test purposes"+ def initialMillis = AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS+ def maxMillis = AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS+ def jitterMillis = AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = 0+and: "the container is started"def clientPort = findEphemeralPort()def container = startContainer(defaultConfig(), [])@@ -164,6 +172,9 @@ class UdpClientTest extends Specification implements ManagerContainerTrait {}cleanup: "the server should be stopped"+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = initialMillis+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = maxMillis+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = jitterMillisclient.disconnect()echoServer.stop()}diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovyindex df11253fc..2e9c1f874 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy@@ -75,6 +75,13 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitgiven: "expected conditions"def conditions = new PollingConditions(timeout: 10, delay: 0.2)+ and: "the IO client reconnect time is set low for test purposes"+ def initialMillis = AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS+ def maxMillis = AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS+ def jitterMillis = AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = 500+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = 0and: "the container is started"def container = startContainer(defaultConfig(), defaultServices())@@ -209,6 +216,9 @@ class WebsocketClientTest extends Specification implements ManagerContainerTrait}cleanup: "the server should be stopped"+ AbstractNettyIOClient.RECONNECT_DELAY_INITIAL_MILLIS = initialMillis+ AbstractNettyIOClient.RECONNECT_DELAY_MAX_MILLIS = maxMillis+ AbstractNettyIOClient.RECONNECT_DELAY_JITTER_MILLIS = jitterMillisif (client != null) {client.disconnect()}