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
Convert Java JUnit unit tests to Groovy Spock specs (#3146)
Eric Bariaux9a82cf461973
diff --git a/agent/build.gradle b/agent/build.gradleindex c426731c7..43b1d3ac2 100644--- a/agent/build.gradle+++ b/agent/build.gradle@@ -54,9 +54,9 @@ dependencies {compileOnly libs.javaxAnnotationApi- testImplementation libs.junitJupiterApi- testImplementation libs.mockitoCore- testRuntimeOnly libs.junitJupiterEngine+ testImplementation libs.groovy+ testImplementation platform(libs.spockBom)+ testImplementation libs.spockCoretestRuntimeOnly "org.junit.platform:junit-platform-launcher"implementation libs.bouncycastleBcprovJdk18ondiff --git a/agent/src/test/groovy/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.groovy b/agent/src/test/groovy/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.groovynew file mode 100644index 000000000..7500d5a26--- /dev/null+++ b/agent/src/test/groovy/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.groovy@@ -0,0 +1,240 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.agent.protocol.simulator++import spock.lang.Specification++import java.time.Instant+import java.time.LocalDateTime+import java.time.ZoneOffset++class SimulatorAgentProtocolScheduleTest extends Specification {++ private static final long SECOND = 1000+ private static final long MINUTE = SECOND * 60+ private static final long HOUR = MINUTE * 60+ private static final long DAY = HOUR * 24++ def "a non-recurring schedule returns its start forever"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start)++ expect:+ [+ instant("1999-01-01T00:00:00.000Z"),+ start,+ instant("9999-12-31T23:59:59.999Z")+ ].each { assert schedule.tryAdvanceActive(it, 0) == start }+ }++ def "a non-recurring schedule with an end keeps returning its start"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def end = instant("2000-01-10T00:00:00.000Z")+ def schedule = schedule(start, end)++ expect:+ ([instant("1999-01-01T00:00:00.000Z")] + (0..9).collect { start + DAY * it })+ .each { assert schedule.tryAdvanceActive(it, 0) == start }++ and: "the end is checked separately"+ schedule.isAfterScheduleEnd(end + 1)+ schedule.tryAdvanceActive(end + 1, 0) == start+ }++ def "a daily recurrence returns its last occurrence after UNTIL"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start, null, "FREQ=DAILY;UNTIL=20000104T235959")++ expect:+ schedule.tryAdvanceActive(instant("1999-01-01T00:00:00.000Z") + DAY - 1, 0) == start+ (0..3).each { day ->+ def occurrence = start + DAY * day+ assert schedule.tryAdvanceActive(occurrence, 0) == occurrence+ assert schedule.tryAdvanceActive(occurrence + DAY - 1, 0) == occurrence+ }++ and:+ def lastOccurrence = instant("2000-01-04T00:00:00.000Z")+ schedule.tryAdvanceActive(lastOccurrence, 0) == lastOccurrence+ schedule.tryAdvanceActive(lastOccurrence + DAY, 0) == lastOccurrence+ }++ def "a daily recurrence returns its last occurrence after COUNT"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start, null, "FREQ=DAILY;COUNT=4")++ expect:+ schedule.tryAdvanceActive(instant("1999-01-01T00:00:00.000Z") + DAY - 1, 0) == start+ (0..2).each { day ->+ def occurrence = start + DAY * day+ assert schedule.tryAdvanceActive(occurrence, 0) == occurrence+ assert schedule.tryAdvanceActive(occurrence + DAY - 1, 0) == occurrence+ }++ and:+ def lastOccurrence = instant("2000-01-04T00:00:00.000Z")+ schedule.tryAdvanceActive(lastOccurrence, 0) == lastOccurrence+ schedule.tryAdvanceActive(lastOccurrence + DAY, 0) == lastOccurrence+ }++ def "a recurrence with BYHOUR and BYMINUTE starts at the configured time"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start, null, "FREQ=DAILY;BYHOUR=17;BYMINUTE=30")++ expect:+ schedule.tryAdvanceActive(+ instant("1999-01-01T00:00:00.000Z") + DAY - 1,+ 0+ ) == start + 17 * HOUR + 30 * MINUTE+ }++ def "a minutely recurrence returns its last occurrence after UNTIL"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ // A trailing Z would make UNTIL an OffsetDateTime, while ical4j compares LocalDateTime+ // candidates and therefore ends the recurrence differently.+ def schedule = schedule(start, null, "FREQ=MINUTELY;UNTIL=20000101T000500")++ expect:+ schedule.tryAdvanceActive(instant("1999-01-01T00:00:00.000Z") + MINUTE - 1, 0) == start+ (0..3).each { minute ->+ def occurrence = start + MINUTE * minute+ assert schedule.tryAdvanceActive(occurrence, 0) == occurrence+ assert schedule.tryAdvanceActive(occurrence + MINUTE - 1, 0) == occurrence+ }++ and:+ def lastOccurrence = instant("2000-01-01T00:04:00.000Z")+ schedule.tryAdvanceActive(lastOccurrence + MINUTE, 0) == lastOccurrence+ schedule.tryAdvanceActive(lastOccurrence + 2 * MINUTE, 0) == lastOccurrence+ }++ def "a recurrence catches up with the current time"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start, null, "FREQ=MINUTELY")+ def now = instant("2000-01-01T01:00:00.000Z")++ expect:+ schedule.tryAdvanceActive(now, 0) == start + 60 * MINUTE+ schedule.tryAdvanceActive(now + MINUTE, 0) == start + 61 * MINUTE+ }++ def "an hourly recurrence calculates offset delays"() {+ given:+ def start = instant("2000-01-01T00:00:00.000Z")+ def schedule = schedule(start, null, "FREQ=HOURLY")++ expect:+ delays(schedule, [+ (start): 100 * SECOND,+ (instant("2000-01-01T00:01:39.000Z")): SECOND,+ (instant("2000-01-01T00:01:40.000Z")): 3600 * SECOND+ ])+ }++ def "an hourly recurrence with a future start calculates offset delays"() {+ given:+ def schedule = schedule(+ instant("2000-01-02T00:00:00.000Z"),+ null,+ "FREQ=HOURLY"+ )++ expect:+ delays(schedule, [+ (instant("2000-01-01T00:00:00.000Z")): DAY + 100 * SECOND,+ (instant("2000-01-01T00:01:00.000Z")): DAY + 40 * SECOND,+ (instant("2000-01-01T00:02:00.000Z")): DAY - 20 * SECOND+ ])+ }++ def "an hourly recurrence with UNTIL calculates delays through its last occurrence"() {+ given:+ def schedule = schedule(+ instant("2000-01-01T00:00:00.000Z"),+ null,+ "FREQ=HOURLY;UNTIL=20000101T020000"+ )++ expect:+ delays(schedule, recurringDelayExpectations())++ and: "UNTIL is checked separately while delays remain positive before UNTIL plus offset"+ schedule.isAfterScheduleEnd(instant("2000-01-01T03:00:00.001Z"))+ }++ def "an hourly recurrence with COUNT calculates delays through its last occurrence"() {+ given:+ def schedule = schedule(+ instant("2000-01-01T00:00:00.000Z"),+ null,+ "FREQ=HOURLY;COUNT=3"+ )++ expect:+ delays(schedule, recurringDelayExpectations())+ }++ private static void delays(+ SimulatorProtocol.Schedule schedule,+ Map<Long, Long> expectedDelays+ ) {+ expectedDelays.each { now, expected ->+ def timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0)+ assert schedule.getDelay(100, timeSinceOccurrenceStarted).asLong == expected+ }+ }++ private static Map<Long, Long> recurringDelayExpectations() {+ [+ (instant("2000-01-01T00:00:00.000Z")): 100 * SECOND,+ (instant("2000-01-01T00:01:00.000Z")): 40 * SECOND,+ (instant("2000-01-01T00:02:00.000Z")): 3580 * SECOND,+ (instant("2000-01-01T01:00:00.000Z")): 100 * SECOND,+ (instant("2000-01-01T01:01:00.000Z")): 40 * SECOND,+ (instant("2000-01-01T01:02:00.000Z")): 3580 * SECOND,+ (instant("2000-01-01T02:00:00.000Z")): 100 * SECOND,+ (instant("2000-01-01T02:01:00.000Z")): 40 * SECOND,+ (instant("2000-01-01T02:02:00.000Z")): -20 * SECOND,+ (instant("2000-01-01T03:00:00.000Z")): -3500 * SECOND+ ]+ }++ private static SimulatorProtocol.Schedule schedule(+ long start,+ Long end = null,+ String recurrence = null+ ) {+ new SimulatorProtocol.Schedule(+ LocalDateTime.ofInstant(Instant.ofEpochMilli(start), ZoneOffset.UTC),+ end == null ? null : LocalDateTime.ofInstant(Instant.ofEpochMilli(end), ZoneOffset.UTC),+ recurrence+ )+ }++ private static long instant(String value) {+ Instant.parse(value).toEpochMilli()+ }+}diff --git a/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.java b/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.javadeleted file mode 100644index 036aadf28..000000000--- a/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.java+++ /dev/null@@ -1,363 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.agent.protocol.simulator;--import static org.junit.jupiter.api.Assertions.assertEquals;-import static org.junit.jupiter.api.Assertions.assertTrue;--import java.time.Instant;-import java.time.LocalDateTime;-import java.time.ZoneOffset;-import org.junit.jupiter.api.Nested;-import org.junit.jupiter.api.Test;--public class SimulatorAgentProtocolScheduleTest {-- private static final long SECOND = 1000;- private static final long MINUTE = SECOND * 60;- private static final long HOUR = MINUTE * 60;- private static final long DAY = HOUR * 24;-- @Nested- public class TryAdvanceActive {-- @Test- public void shouldReturnStartAsCurrentForever() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, null);-- long[] instants = {- Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli(),- start.toEpochMilli(),- Instant.parse("9999-12-31T23:59:59.999Z").toEpochMilli()- };- for (long epoch : instants) {- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch, 0));- }- }-- @Test- public void shouldAlwaysReturnStartAsCurrentWithEnd() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z"),- end = Instant.parse("2000-01-10T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC),- LocalDateTime.ofInstant(end, ZoneOffset.UTC),- null);-- long[] instants = {- Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli(),- start.toEpochMilli(),- start.toEpochMilli() + DAY,- start.toEpochMilli() + DAY * 2,- start.toEpochMilli() + DAY * 3,- start.toEpochMilli() + DAY * 4,- start.toEpochMilli() + DAY * 5,- start.toEpochMilli() + DAY * 6,- start.toEpochMilli() + DAY * 7,- start.toEpochMilli() + DAY * 8,- start.toEpochMilli() + DAY * 9,- };- for (long epoch : instants) {- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch, 0));- }-- // Reaching the end will continue to return the start value, so we use another check to end it- assertTrue(- schedule.isAfterScheduleEnd(Instant.parse("2000-01-10T00:00:00.001Z").toEpochMilli()));- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(end.toEpochMilli() + 1, 0));- }-- @Test- public void shouldReturnOnlyCurrentAfterUntil() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC),- null,- "FREQ=DAILY;UNTIL=20000104T235959");-- long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY - 1, 0));-- long[] instants = {- start.toEpochMilli(),- start.toEpochMilli() + DAY,- start.toEpochMilli() + DAY * 2,- start.toEpochMilli() + DAY * 3,- };- for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant, 0));- // DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + DAY - 1, 0));- }-- // Should only return the start of the current occurrence '2000-01-04T00:00:00.000Z' as there- // are no future- // occurrences- long until = Instant.parse("2000-01-04T00:00:00.000Z").toEpochMilli();- assertEquals(until, schedule.tryAdvanceActive(until, 0));- assertEquals(until, schedule.tryAdvanceActive(until + DAY, 0));- }-- @Test- public void shouldReturnLastOccurrenceAfterCount() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=DAILY;COUNT=4");-- long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY - 1, 0));-- long[] instants = {- start.toEpochMilli(), start.toEpochMilli() + DAY, start.toEpochMilli() + DAY * 2,- };- for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant, 0));- // DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + DAY - 1, 0));- }-- // Should only return the start of the current occurrence 2000-01-04T00:00:00.000Z as there- // are no future- // occurrences- long count = Instant.parse("2000-01-04T00:00:00.000Z").toEpochMilli();- assertEquals(count, schedule.tryAdvanceActive(count, 0));- assertEquals(count, schedule.tryAdvanceActive(count + DAY, 0));- }-- @Test- public void shouldStartAt1730() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC),- null,- "FREQ=DAILY;BYHOUR=17;BYMINUTE=30");-- long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(- start.toEpochMilli() + 17 * HOUR + 30 * MINUTE,- schedule.tryAdvanceActive(epoch + DAY - 1, 0));- }-- @Test- public void shouldMinutelyReturnNextUntil() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- // Do not end 'UNTIL' with 'Z' as that would mean UTC, while internally (in ical4j) the next- // candidate is determined by- // 'TemporalComparator.INSTANCE.compare' which would be comparing LocalDateTime with- // OffsetDateTime and thus end differently- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC),- null,- "FREQ=MINUTELY;UNTIL=20000101T000500");-- long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + MINUTE - 1, 0));-- long[] instants = {- start.toEpochMilli(),- start.toEpochMilli() + MINUTE,- start.toEpochMilli() + MINUTE * 2,- start.toEpochMilli() + MINUTE * 3,- };- for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant, 0));- // DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + MINUTE - 1, 0));- }-- long until = Instant.parse("2000-01-01T00:04:00.000Z").toEpochMilli();- assertEquals(until, schedule.tryAdvanceActive(until + MINUTE, 0));- assertEquals(until, schedule.tryAdvanceActive(until + MINUTE * 2, 0));- }-- @Test- public void shouldCatchUpWithCurrentTime() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=MINUTELY");-- long epoch = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli() + 60 * MINUTE, schedule.tryAdvanceActive(epoch, 0));- assertEquals(- start.toEpochMilli() + 61 * MINUTE, schedule.tryAdvanceActive(epoch + MINUTE, 0));- }- }-- @Nested- public class GetDelay {-- @Test- public void getDelayForHourlyRecurrence() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY");-- long now = start.toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:01:39.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:01:40.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(3600 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());- }-- @Test- public void getDelayForHourlyRecurrenceWithStartDate() {- Instant start = Instant.parse("2000-01-02T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY");-- long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(- DAY + 100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(- DAY + 40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(- DAY - 20 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());- }-- @Test- public void getDelayCustomRecurringWithUntil() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC),- null,- "FREQ=HOURLY;UNTIL=20000101T020000");-- long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(3580 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(3580 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T02:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T02:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- // UNTIL will continue to return positive delays if now < UNTIL + offset, so we use another- // check to end it- assertTrue(- schedule.isAfterScheduleEnd(- Instant.parse("2000-01-01T03:00:00.001Z").toEpochMilli())); // TODO: fix-- // The datapoint won't be replayed after the 3rd occurrence so the delay is negative- now = Instant.parse("2000-01-01T02:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(-20 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T03:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(-3500 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());- }-- @Test- public void getDelayCustomRecurringWithCount() {- Instant start = Instant.parse("2000-01-01T00:00:00.000Z");- SimulatorProtocol.Schedule schedule =- new SimulatorProtocol.Schedule(- LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY;COUNT=3");-- long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(3580 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T01:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(3580 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T02:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(100 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T02:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(40 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- // The datapoint won't be replayed after the 3rd occurrence so the delay is negative- now = Instant.parse("2000-01-01T02:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(-20 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());-- now = Instant.parse("2000-01-01T03:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);- assertEquals(-3500 * SECOND, schedule.getDelay(100, timeSinceOccurrenceStarted).getAsLong());- }- }-}diff --git a/container/build.gradle b/container/build.gradleindex b91c36cf5..e13161d16 100644--- a/container/build.gradle+++ b/container/build.gradle@@ -56,9 +56,8 @@ dependencies {}dependencies {- testImplementation libs.junitJupiterParams- testImplementation libs.junitJupiterApi- testRuntimeOnly libs.junitJupiterEngine+ testImplementation platform(libs.spockBom)+ testImplementation libs.spockCoretestRuntimeOnly "org.junit.platform:junit-platform-launcher"}diff --git a/container/src/test/groovy/org/openremote/container/timer/PseudoClockTest.groovy b/container/src/test/groovy/org/openremote/container/timer/PseudoClockTest.groovynew file mode 100644index 000000000..2a7779699--- /dev/null+++ b/container/src/test/groovy/org/openremote/container/timer/PseudoClockTest.groovy@@ -0,0 +1,62 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.container.timer++import spock.lang.Specification++import java.time.LocalDate+import java.time.LocalTime+import java.time.ZoneId++class PseudoClockTest extends Specification {++ TimerService.Clock clock++ def setup() {+ clock = TimerService.Clock.PSEUDO+ clock.init()+ clock.stop()+ }++ def "setTime sets #date at midnight in #zone to #expected milliseconds"() {+ expect:+ clock.setTime(LocalDate.parse(date), LocalTime.MIDNIGHT, ZoneId.of(zone)) == expected+ clock.currentTimeMillis == expected++ where:+ date | zone || expected+ "1970-01-01" | "UTC" || 0L+ "1970-01-02" | "UTC" || 24L * 3_600_000+ "1970-01-01" | "CET" || -3_600_000L+ "1970-01-02" | "CET" || 23L * 3_600_000+ }++ def "setTime sets #timestamp to #expected milliseconds"() {+ expect:+ clock.setTime(timestamp) == expected+ clock.currentTimeMillis == expected++ where:+ timestamp || expected+ "1970-01-01T00:00:00.000Z" || 0L+ "1970-01-02T00:00:00.000Z" || 24L * 3_600_000+ "1970-01-01T00:00:00.000+01:00" || -3_600_000L+ "1970-01-02T00:00:00.000+01:00" || 23L * 3_600_000+ }+}diff --git a/container/src/test/groovy/org/openremote/container/web/WebServiceEntitySizeConfigTest.groovy b/container/src/test/groovy/org/openremote/container/web/WebServiceEntitySizeConfigTest.groovynew file mode 100644index 000000000..8f5dac410--- /dev/null+++ b/container/src/test/groovy/org/openremote/container/web/WebServiceEntitySizeConfigTest.groovy@@ -0,0 +1,65 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.container.web++import org.openremote.container.security.IdentityService+import org.openremote.model.Container+import spock.lang.Specification++class WebServiceEntitySizeConfigTest extends Specification {++ def "uses #scenario entity size limits"() {+ given:+ def config = [+ (WebService.OR_WEBSERVER_LISTEN_HOST): "127.0.0.1",+ (WebService.OR_WEBSERVER_LISTEN_PORT): "0"+ ] + overrides+ def container = Stub(Container) {+ getConfig() >> config+ getService(IdentityService) >> null+ getService(_) >> { Class type ->+ throw new IllegalStateException("Service not available in test container: ${type.name}")+ }+ }+ def service = new TrackingWebService()++ when:+ service.init(container)++ then:+ service.multipartLimit == expectedMultipartLimit+ service.maxLimit == expectedMaxLimit++ where:+ scenario | overrides || expectedMultipartLimit | expectedMaxLimit+ "default" | [:] || WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE_DEFAULT | WebService.OR_WEBSERVER_MAX_ENTITY_SIZE_DEFAULT+ "configured" | [(WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE): "1024", (WebService.OR_WEBSERVER_MAX_ENTITY_SIZE): "2048"] || 1024L | 2048L+ "invalid" | [(WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE): "invalid", (WebService.OR_WEBSERVER_MAX_ENTITY_SIZE): "also_invalid"] || WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE_DEFAULT | WebService.OR_WEBSERVER_MAX_ENTITY_SIZE_DEFAULT+ }++ static class TrackingWebService extends WebService {+ long getMultipartLimit() {+ multipartMaxEntitySize+ }++ long getMaxLimit() {+ maxEntitySize+ }+ }+}diff --git a/container/src/test/java/org/openremote/container/timer/PseudoClockTest.java b/container/src/test/java/org/openremote/container/timer/PseudoClockTest.javadeleted file mode 100644index 1813753e9..000000000--- a/container/src/test/java/org/openremote/container/timer/PseudoClockTest.java+++ /dev/null@@ -1,72 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.container.timer;--import static org.junit.jupiter.api.Assertions.assertEquals;--import java.time.LocalDate;-import java.time.LocalTime;-import java.time.ZoneId;-import org.junit.jupiter.api.BeforeEach;-import org.junit.jupiter.api.Test;-import org.junit.jupiter.api.parallel.Execution;-import org.junit.jupiter.api.parallel.ExecutionMode;--@Execution(ExecutionMode.SAME_THREAD)-public class PseudoClockTest {-- private TimerService.Clock clock;-- @BeforeEach- public void setup() {- clock = TimerService.Clock.PSEUDO;- clock.init();- clock.stop();- }-- @Test- public void testSetTime() {- clock.setTime(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0), ZoneId.of("UTC"));- assertEquals(0, clock.getCurrentTimeMillis());-- clock.setTime(LocalDate.of(1970, 1, 2), LocalTime.of(0, 0), ZoneId.of("UTC"));- assertEquals(24 * 3_600_000, clock.getCurrentTimeMillis());-- clock.setTime(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0), ZoneId.of("CET"));- assertEquals(-3_600_000, clock.getCurrentTimeMillis());-- clock.setTime(LocalDate.of(1970, 1, 2), LocalTime.of(0, 0), ZoneId.of("CET"));- assertEquals(23 * 3_600_000, clock.getCurrentTimeMillis());- }-- @Test- public void testSetTimeISO() {- clock.setTime("1970-01-01T00:00:00.000Z");- assertEquals(0, clock.getCurrentTimeMillis());-- clock.setTime("1970-01-02T00:00:00.000Z");- assertEquals(24 * 3_600_000, clock.getCurrentTimeMillis());-- clock.setTime("1970-01-01T00:00:00.000+01:00");- assertEquals(-3_600_000, clock.getCurrentTimeMillis());-- clock.setTime("1970-01-02T00:00:00.000+01:00");- assertEquals(23 * 3_600_000, clock.getCurrentTimeMillis());- }-}diff --git a/container/src/test/java/org/openremote/container/web/WebServiceEntitySizeConfigTest.java b/container/src/test/java/org/openremote/container/web/WebServiceEntitySizeConfigTest.javadeleted file mode 100644index 265a73299..000000000--- a/container/src/test/java/org/openremote/container/web/WebServiceEntitySizeConfigTest.java+++ /dev/null@@ -1,146 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.container.web;--import static org.junit.jupiter.api.Assertions.assertEquals;--import io.micrometer.core.instrument.MeterRegistry;-import java.util.Collection;-import java.util.Collections;-import java.util.Map;-import java.util.concurrent.ExecutorService;-import java.util.concurrent.ScheduledExecutorService;-import org.junit.jupiter.api.Test;-import org.openremote.container.security.IdentityService;-import org.openremote.model.Container;-import org.openremote.model.ContainerService;--public class WebServiceEntitySizeConfigTest {-- @Test- public void shouldUseDefaultEntitySizeLimits() throws Exception {- TrackingWebService service = new TrackingWebService();- service.init(- new TestContainer(- Map.of(- WebService.OR_WEBSERVER_LISTEN_HOST, "127.0.0.1",- WebService.OR_WEBSERVER_LISTEN_PORT, "0")));-- assertEquals(- WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE_DEFAULT, service.getMultipartLimit());- assertEquals(WebService.OR_WEBSERVER_MAX_ENTITY_SIZE_DEFAULT, service.getMaxLimit());- }-- @Test- public void shouldUseConfiguredEntitySizeLimits() throws Exception {- TrackingWebService service = new TrackingWebService();- service.init(- new TestContainer(- Map.of(- WebService.OR_WEBSERVER_LISTEN_HOST, "127.0.0.1",- WebService.OR_WEBSERVER_LISTEN_PORT, "0",- WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE, "1024",- WebService.OR_WEBSERVER_MAX_ENTITY_SIZE, "2048")));-- assertEquals(1024L, service.getMultipartLimit());- assertEquals(2048L, service.getMaxLimit());- }-- @Test- public void shouldFallbackToDefaultsForInvalidEntitySizeLimits() throws Exception {- TrackingWebService service = new TrackingWebService();- service.init(- new TestContainer(- Map.of(- WebService.OR_WEBSERVER_LISTEN_HOST, "127.0.0.1",- WebService.OR_WEBSERVER_LISTEN_PORT, "0",- WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE, "invalid",- WebService.OR_WEBSERVER_MAX_ENTITY_SIZE, "also_invalid")));-- assertEquals(- WebService.OR_WEBSERVER_MULTIPART_MAX_ENTITY_SIZE_DEFAULT, service.getMultipartLimit());- assertEquals(WebService.OR_WEBSERVER_MAX_ENTITY_SIZE_DEFAULT, service.getMaxLimit());- }-- static class TrackingWebService extends WebService {- long getMultipartLimit() {- return multipartMaxEntitySize;- }-- long getMaxLimit() {- return maxEntitySize;- }- }-- static class TestContainer implements Container {- private final Map<String, String> config;-- TestContainer(Map<String, String> config) {- this.config = config;- }-- @Override- public Map<String, String> getConfig() {- return config;- }-- @Override- public boolean isDevMode() {- return false;- }-- @Override- public ContainerService[] getServices() {- return new ContainerService[0];- }-- @Override- public ScheduledExecutorService getScheduledExecutor() {- return null;- }-- @Override- public ExecutorService getExecutor() {- return null;- }-- @Override- public <T extends ContainerService> Collection<T> getServices(Class<T> type) {- return Collections.emptyList();- }-- @Override- public <T extends ContainerService> T getService(Class<T> type) throws IllegalStateException {- if (type == IdentityService.class) {- return null;- }- throw new IllegalStateException("Service not available in test container: " + type.getName());- }-- @Override- public <T extends ContainerService> boolean hasService(Class<T> type) {- return false;- }-- @Override- public MeterRegistry getMeterRegistry() {- return null;- }- }-}diff --git a/model/build.gradle b/model/build.gradleindex f4571a45d..332a3d659 100644--- a/model/build.gradle+++ b/model/build.gradle@@ -1,5 +1,6 @@plugins {id 'java-library'+ id 'groovy'id 'maven-publish'id 'signing'}@@ -43,12 +44,11 @@ dependencies {api libs.exp4jdependencies {+ testImplementation libs.groovytestImplementation libs.jsonassert- testImplementation libs.junitJupiterParams- testImplementation libs.junitJupiterApi- testImplementation libs.mockitoCore+ testImplementation platform(libs.spockBom)+ testImplementation libs.spockCoretestRuntimeOnly libs.jakartaEl- testRuntimeOnly libs.junitJupiterEnginetestRuntimeOnly "org.junit.platform:junit-platform-launcher"}}diff --git a/model/src/test/groovy/org/openremote/model/geo/GeoJSONPointTest.groovy b/model/src/test/groovy/org/openremote/model/geo/GeoJSONPointTest.groovynew file mode 100644index 000000000..db4b53232--- /dev/null+++ b/model/src/test/groovy/org/openremote/model/geo/GeoJSONPointTest.groovy@@ -0,0 +1,56 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.model.geo++import spock.lang.Specification++class GeoJSONPointTest extends Specification {++ def "parseRawLocation returns null for invalid input '#input'"() {+ expect:+ GeoJSONPoint.parseRawLocation(input) == null++ where:+ input << [null, "", "1,2,3", "abc,2", "1,def"]+ }++ def "parseRawLocation parses valid input"() {+ when:+ def point = GeoJSONPoint.parseRawLocation("12.5, -3.75")++ then:+ point != null+ point.x == 12.5d+ point.y == -3.75d+ }++ def "offsetByMeters offsets east and north"() {+ given:+ def origin = new GeoJSONPoint(0d, 0d)++ when:+ def offset = origin.offsetByMeters(1000d, 1000d)++ then:+ def expectedLat = 0.0090436947d+ def expectedLon = 0.0089831528d+ Math.abs(offset.y - expectedLat) < 1e-9+ Math.abs(offset.x - expectedLon) < 1e-9+ }+}diff --git a/model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.java b/model/src/test/groovy/org/openremote/model/util/JSONSchemaUtilTest.groovysimilarity index 69%rename from model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.javarename to model/src/test/groovy/org/openremote/model/util/JSONSchemaUtilTest.groovyindex 42fc0f938..7b79bbbca 100644--- a/model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.java+++ b/model/src/test/groovy/org/openremote/model/util/JSONSchemaUtilTest.groovy@@ -16,73 +16,62 @@** SPDX-License-Identifier: AGPL-3.0-or-later*/-package org.openremote.model.util;+package org.openremote.model.util-import static org.junit.jupiter.api.Assertions.*;-import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;+import static org.skyscreamer.jsonassert.JSONAssert.assertEquals-import com.fasterxml.jackson.annotation.*;-import com.fasterxml.jackson.core.JsonProcessingException;-import com.fasterxml.jackson.databind.JsonNode;-import java.io.IOException;-import java.io.InputStream;-import java.io.Serializable;-import java.time.*;-import java.util.Date;-import java.util.Map;-import org.json.JSONException;-import org.junit.jupiter.api.BeforeAll;-import org.junit.jupiter.api.Test;-import org.junit.jupiter.params.ParameterizedTest;-import org.junit.jupiter.params.provider.ValueSource;-import org.openremote.model.util.JSONSchemaUtil.*;-import org.reflections.Reflections;+import com.fasterxml.jackson.annotation.*+import org.openremote.model.util.JSONSchemaUtil.*+import org.openremote.model.value.ValueType+import org.reflections.Reflections+import spock.lang.Specification-public class JSONSchemaUtilTest {+import java.time.*- private static final Reflections reflections = new Reflections("org.openremote");+class JSONSchemaUtilTest extends Specification {- @BeforeAll- static void setup() {- ValueUtil.doInitialise();+ private static final Reflections reflections = new Reflections("org.openremote")++ def setupSpec() {+ ValueUtil.doInitialise()}private static InputStream loadResourceAsStream(String resourcePath) {- return JSONSchemaUtilTest.class.getResourceAsStream(- "/org/openremote/model/util/" + resourcePath + ".json");+ JSONSchemaUtilTest.getResourceAsStream(+ "/org/openremote/model/util/" + resourcePath + ".json")}static class Title {}- @Test- public void shouldHaveTitle() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema has a generated title"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","title": "Title","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(Title.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(Title)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonSchemaTitle(value = "Test Title", i18n = false)static class ItemType {}static class MembersShouldNotHaveTitle {- public Map<String, String> test;- public ItemType[] test1;+ public Map<String, String> test+ public ItemType[] test1}- @Test- public void shouldNotHaveTitle() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema members do not have generated titles"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -100,58 +89,58 @@ public class JSONSchemaUtilTest {"title": "Members Should Not Have Title","additionalProperties": true}- """);+ ''')- JsonNode actual = ValueUtil.getSchema(MembersShouldNotHaveTitle.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(MembersShouldNotHaveTitle)+ assertEquals(expected.toString(), actual.toString(), true)}- @Test- public void shouldRemapByte() throws IOException, JSONException {- JsonNode expected =- ValueUtil.JSON.readTree(loadResourceAsStream(java.lang.Byte.class.getName()));- JsonNode actual = ValueUtil.getSchema(java.lang.Byte.class);- assertEquals(expected.toString(), actual.toString(), true);+ def "schema remaps Byte"() {+ expect:+ def expected =+ ValueUtil.JSON.readTree(loadResourceAsStream(Byte.name))+ def actual = ValueUtil.getSchema(Byte)+ assertEquals(expected.toString(), actual.toString(), true)}static class AdditionalProperties {}- @Test- public void shouldHaveAdditionalPropertiesTrue() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema allows additional properties"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","title": "Additional Properties","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(AdditionalProperties.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(AdditionalProperties)+ assertEquals(expected.toString(), actual.toString(), true)}static class RemapTypes {- @JsonSchemaTypeRemap(type = String.class)- public boolean test1;+ @JsonSchemaTypeRemap(type = String)+ public boolean test1- @JsonSchemaTypeRemap(type = boolean.class)- public String test2;+ @JsonSchemaTypeRemap(type = boolean)+ public String test2- @JsonSchemaTypeRemap(type = Date.class)- public boolean test3;+ @JsonSchemaTypeRemap(type = Date)+ public boolean test3@JsonSchemaSupplier(supplier = SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)- public Boolean test4;+ public Boolean test4}- @Test- public void shouldRemapTypes() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema remaps annotated types"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema":"http://json-schema.org/draft-07/schema#","type":"object",@@ -164,45 +153,46 @@ public class JSONSchemaUtilTest {"required":["test1","test3"],"title":"Remap Types","additionalProperties":true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(RemapTypes.class);- assertEquals(expected.toString(), actual.toString(), false);+ def actual = ValueUtil.getSchema(RemapTypes)+ assertEquals(expected.toString(), actual.toString(), false)}- @ParameterizedTest- @ValueSource(- classes = {- org.openremote.model.value.ValueType.BooleanMap.class,- org.openremote.model.value.ValueType.DoubleMap.class,- org.openremote.model.value.ValueType.IntegerMap.class,- org.openremote.model.value.ValueType.ObjectMap.class,- org.openremote.model.value.ValueType.StringMap.class,- org.openremote.model.value.ValueType.MultivaluedStringMap.class,- })- public void shouldHandleMapTypes() throws IOException, JSONException {- JsonNode expected =- ValueUtil.JSON.readTree(loadResourceAsStream(java.lang.Byte.class.getName()));- JsonNode actual = ValueUtil.getSchema(java.lang.Byte.class);- assertEquals(expected.toString(), actual.toString(), true);+ def "schema handles map type #mapType.simpleName"() {+ expect:+ def expected =+ ValueUtil.JSON.readTree(loadResourceAsStream(mapType.name))+ def actual = ValueUtil.getSchema(mapType)+ assertEquals(expected.toString(), actual.toString(), true)++ where:+ mapType << [+ ValueType.BooleanMap,+ ValueType.DoubleMap,+ ValueType.IntegerMap,+ ValueType.ObjectMap,+ ValueType.StringMap,+ ValueType.MultivaluedStringMap+ ]}static class JacksonAnnotations {@JsonPropertyDescription("This property should have a description.")- public Boolean test1;+ public Boolean test1@JsonProperty("renamed")- public Boolean test2;+ public Boolean test2@JsonProperty(value = "renamed1", required = true)- public Boolean test3;+ public Boolean test3}- @Test- public void shouldHandleJacksonAnnotations() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema handles Jackson annotations"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -223,27 +213,27 @@ public class JSONSchemaUtilTest {"required": [ "renamed1" ],"title": "Jackson Annotations","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(JacksonAnnotations.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(JacksonAnnotations)+ assertEquals(expected.toString(), actual.toString(), true)}static class Primitives {- public boolean test1;- public int test2;- public long test3;- public float test4;- public double test5;- public byte test6;- public char test7;- }-- @Test- public void shouldHaveRequiredPrimitives() throws JsonProcessingException, JSONException {- JsonNode expected =+ public boolean test1+ public int test2+ public long test3+ public float test4+ public double test5+ public byte test6+ public char test7+ }++ def "schema requires primitive fields"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -267,10 +257,10 @@ public class JSONSchemaUtilTest {],"title": "Primitives","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(Primitives.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(Primitives)+ assertEquals(expected.toString(), actual.toString(), true)}static class AnnotationsForFields {@@ -278,16 +268,15 @@ public class JSONSchemaUtilTest {@JsonSchemaDescription(value = "test", i18n = false)@JsonSchemaFormat("test")@JsonSchemaDefault("false")- @JsonSchemaExamples({"test"})- public Boolean all;+ @JsonSchemaExamples(["test"])+ public Boolean all}- @Test- public void shouldApplyCustomAnnotationsForFields()- throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema applies custom annotations to fields"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -303,24 +292,24 @@ public class JSONSchemaUtilTest {},"title": "Annotations For Fields","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(AnnotationsForFields.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(AnnotationsForFields)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonSchemaTitle(value = "test", i18n = false)@JsonSchemaDescription(value = "test", i18n = false)@JsonSchemaFormat("test")@JsonSchemaDefault("{}")- @JsonSchemaExamples({"test"})+ @JsonSchemaExamples(["test"])static class AnnotationsForTypes {}- @Test- public void shouldApplyCustomAnnotationsForTypes() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema applies custom annotations to types"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -332,59 +321,58 @@ public class JSONSchemaUtilTest {"examples": ["test"]- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(AnnotationsForTypes.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(AnnotationsForTypes)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonSchemaTitle("test")@JsonSchemaDescription("test")static class I18nAnnotations {}- @Test- public void shouldApplyI18nAnnotations() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema applies i18n annotations"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","i18n": "org.openremote.model.util.JSONSchemaUtilTest.I18nAnnotations","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(I18nAnnotations.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(I18nAnnotations)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonSchemaTitle(value = "test", i18n = false)@JsonSchemaDescription("Translated description")static class I18nAnnotationsPartiallyDisabled {}- @Test- public void shouldApplyI18nAnnotationsPartiallyDisabled()- throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema applies partially disabled i18n annotations"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","title": "test","i18n": "org.openremote.model.util.JSONSchemaUtilTest.I18nAnnotationsPartiallyDisabled","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(I18nAnnotationsPartiallyDisabled.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(I18nAnnotationsPartiallyDisabled)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonTypeInfo(property = "type", use = JsonTypeInfo.Id.NAME)- @JsonSubTypes({- @JsonSubTypes.Type(SubType.class),- @JsonSubTypes.Type(SubTypeSuperclass.class),- })+ @JsonSubTypes([+ @JsonSubTypes.Type(SubType),+ @JsonSubTypes.Type(SubTypeSuperclass),+ ])abstract static class PolymorphicType<T extends PolymorphicType<?>> implements Serializable {}@JsonTypeName("SubType")@@ -393,11 +381,11 @@ public class JSONSchemaUtilTest {@JsonTypeName("SubTypeSuperclass")static class SubTypeSuperclass extends SubType {}- @Test- public void shouldHaveSubtypesWithTypeProperty() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema includes subtypes with a type property"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","definitions": {@@ -438,17 +426,17 @@ public class JSONSchemaUtilTest {"type": "object","additionalProperties": true,"title": "Polymorphic Type"- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(PolymorphicType.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(PolymorphicType)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonTypeInfo(property = "customType", use = JsonTypeInfo.Id.NAME)- @JsonSubTypes({- @JsonSubTypes.Type(SubTypeWithCustomProperty.class),- @JsonSubTypes.Type(SubTypeSuperClassWithCustomProperty.class),- })+ @JsonSubTypes([+ @JsonSubTypes.Type(SubTypeWithCustomProperty),+ @JsonSubTypes.Type(SubTypeSuperClassWithCustomProperty),+ ])abstract static class PolymorphicTypeWithCustomProperty<T extends PolymorphicTypeWithCustomProperty<?>>implements Serializable {}@@ -460,12 +448,11 @@ public class JSONSchemaUtilTest {@JsonTypeName("SubTypeSuperClassWithCustomProperty")static class SubTypeSuperClassWithCustomProperty extends SubTypeWithCustomProperty {}- @Test- public void shouldHaveSubtypesWithCustomTypeProperty()- throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema includes subtypes with a custom type property"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","definitions": {@@ -506,10 +493,10 @@ public class JSONSchemaUtilTest {"type": "object","additionalProperties": true,"title": "Polymorphic Type With Custom Property"- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(PolymorphicTypeWithCustomProperty.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(PolymorphicTypeWithCustomProperty)+ assertEquals(expected.toString(), actual.toString(), true)}// Note: JsonTypeInfo.As.EXISTING_PROPERTY doesn't necessarily change the behavior mainly the@@ -518,45 +505,44 @@ public class JSONSchemaUtilTest {property = PolymorphicTypeWithCustomExistingProperty.VALUE_KEY_CUSTOM_TYPE,use = JsonTypeInfo.Id.NAME,include = JsonTypeInfo.As.EXISTING_PROPERTY)- @JsonSubTypes({+ @JsonSubTypes([@JsonSubTypes.Type(name = SubTypeWithCustomExistingProperty.SUB_CUSTOM_TYPE,- value = SubTypeWithCustomExistingProperty.class),+ value = SubTypeWithCustomExistingProperty),@JsonSubTypes.Type(name = SubTypeSuperClassWithCustomExistingProperty.SUPER_CUSTOM_TYPE,- value = SubTypeSuperClassWithCustomExistingProperty.class),- })+ value = SubTypeSuperClassWithCustomExistingProperty),+ ])abstract static class PolymorphicTypeWithCustomExistingProperty<T extends PolymorphicTypeWithCustomExistingProperty<?>>implements Serializable {- public static final String VALUE_KEY_CUSTOM_TYPE = "customType";+ public static final String VALUE_KEY_CUSTOM_TYPE = "customType"@JsonProperty(VALUE_KEY_CUSTOM_TYPE)- protected String customType;+ protected String customType- public String getCustomType() {- return customType;+ String getCustomType() {+ customType}}@JsonTypeName(SubTypeWithCustomExistingProperty.SUB_CUSTOM_TYPE)static class SubTypeWithCustomExistingPropertyextends PolymorphicTypeWithCustomExistingProperty<SubTypeWithCustomExistingProperty> {- public static final String SUB_CUSTOM_TYPE = "sub";+ public static final String SUB_CUSTOM_TYPE = "sub"}@JsonTypeName(SubTypeSuperClassWithCustomExistingProperty.SUPER_CUSTOM_TYPE)static class SubTypeSuperClassWithCustomExistingPropertyextends SubTypeWithCustomExistingProperty {- public static final String SUPER_CUSTOM_TYPE = "super";+ public static final String SUPER_CUSTOM_TYPE = "super"}- @Test- public void shouldHaveSubtypesWithExistingCustomTypeProperty()- throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema includes subtypes with an existing custom type property"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","definitions": {@@ -597,20 +583,20 @@ public class JSONSchemaUtilTest {"type": "object","additionalProperties": true,"title": "Polymorphic Type With Custom Existing Property"- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(PolymorphicTypeWithCustomExistingProperty.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(PolymorphicTypeWithCustomExistingProperty)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonTypeInfo(property = "type",use = JsonTypeInfo.Id.NAME,include = JsonTypeInfo.As.EXTERNAL_PROPERTY)- @JsonSubTypes({- @JsonSubTypes.Type(ExternalSubType.class),- @JsonSubTypes.Type(ExternalSubTypeSuperclass.class),- })+ @JsonSubTypes([+ @JsonSubTypes.Type(ExternalSubType),+ @JsonSubTypes.Type(ExternalSubTypeSuperclass),+ ])abstract static class ExternalPolymorphicType<T extends ExternalPolymorphicType<?>>implements Serializable {}@@ -618,11 +604,11 @@ public class JSONSchemaUtilTest {static class ExternalSubTypeSuperclass extends ExternalSubType {}- @Test- public void shouldSetEnumTypeForExternalProperty() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema sets the enum type for an external property"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","definitions": {@@ -663,10 +649,10 @@ public class JSONSchemaUtilTest {"type": "object","additionalProperties": true,"title": "External Polymorphic Type"- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(ExternalPolymorphicType.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(ExternalPolymorphicType)+ assertEquals(expected.toString(), actual.toString(), true)}@JsonTypeName("ReflectedPolymorphicType")@@ -677,12 +663,11 @@ public class JSONSchemaUtilTest {@JsonTypeName("ResolvedSubType")static class ResolvedSubType extends ReflectedPolymorphicType<ResolvedSubType> {}- @Test- public void shouldResolveSubtypesThroughReflections()- throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema resolves subtypes through reflections"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","definitions": {@@ -717,42 +702,42 @@ public class JSONSchemaUtilTest {"required": ["type"]- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(ReflectedPolymorphicType.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(ReflectedPolymorphicType)+ assertEquals(expected.toString(), actual.toString(), true)}- @Test- public void shouldNotHaveAllOf() {- for (Class<?> clazz : reflections.getTypesAnnotatedWith(JsonTypeInfo.class)) {- assertFalse(ValueUtil.getSchema(clazz).toString().contains("allOf"));+ def "schemas do not use allOf"() {+ expect:+ reflections.getTypesAnnotatedWith(JsonTypeInfo).each { clazz ->+ assert !ValueUtil.getSchema(clazz).toString().contains("allOf")}}static class JavaTimeJacksonModule {- public Duration duration;- public LocalDateTime localDateTime;- public LocalDate localDate;- public LocalTime localTime;- public MonthDay monthDay;- public OffsetTime offsetTime;- public Period period;- public Year year;- public YearMonth yearMonth;- public ZoneId zoneId;- public ZoneOffset zoneOffset;+ public Duration duration+ public LocalDateTime localDateTime+ public LocalDate localDate+ public LocalTime localTime+ public MonthDay monthDay+ public OffsetTime offsetTime+ public Period period+ public Year year+ public YearMonth yearMonth+ public ZoneId zoneId+ public ZoneOffset zoneOffset// Instant variants- public Instant instant;- public OffsetDateTime offsetDateTime;- public ZonedDateTime zonedDateTime;+ public Instant instant+ public OffsetDateTime offsetDateTime+ public ZonedDateTime zonedDateTime}- @Test- public void shouldApplyJacksonSerializers() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema applies Jackson serializers"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "object",@@ -814,26 +799,26 @@ public class JSONSchemaUtilTest {},"title": "Java Time Jackson Module","additionalProperties": true- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(JavaTimeJacksonModule.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(JavaTimeJacksonModule)+ assertEquals(expected.toString(), actual.toString(), true)}enum TypeOption {- INTEGER(int.class),- STRING(String.class),- LONG(long.class),- FLOAT(Float.class);+ INTEGER(int),+ STRING(String),+ LONG(long),+ FLOAT(Float)TypeOption(Class<?> javaType) {}}- @Test- public void shouldGenerateEnum() throws JsonProcessingException, JSONException {- JsonNode expected =+ def "schema generates enum values"() {+ expect:+ def expected =ValueUtil.JSON.readTree(- """+ '''{"$schema": "http://json-schema.org/draft-07/schema#","type": "string",@@ -844,9 +829,9 @@ public class JSONSchemaUtilTest {"FLOAT"],"title": "Type Option"- }""");+ }''')- JsonNode actual = ValueUtil.getSchema(TypeOption.class);- assertEquals(expected.toString(), actual.toString(), true);+ def actual = ValueUtil.getSchema(TypeOption)+ assertEquals(expected.toString(), actual.toString(), true)}}diff --git a/model/src/test/groovy/org/openremote/model/util/LockByKeyTest.groovy b/model/src/test/groovy/org/openremote/model/util/LockByKeyTest.groovynew file mode 100644index 000000000..887815e5f--- /dev/null+++ b/model/src/test/groovy/org/openremote/model/util/LockByKeyTest.groovy@@ -0,0 +1,116 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.model.util++import spock.lang.Specification+import spock.util.concurrent.PollingConditions++import java.util.concurrent.*++class LockByKeyTest extends Specification {+ /**+ * A controllable version of LockByKey that allows us to pause the unlock method at a critical+ * point.+ */+ static class ControllableLockByKey extends LockByKey {++ private final CountDownLatch pauseLatch = new CountDownLatch(1)+ private final CountDownLatch resumeLatch = new CountDownLatch(1)++ @Override+ protected LockWrapper createLockWrapper() {+ new LockWrapper() {+ @Override+ int removeThreadFromQueue() {+ def result = super.removeThreadFromQueue()+ if (result == 0) {+ // Signal that we are at the critical point+ pauseLatch.countDown()+ // Wait for the test to tell us to continue+ try {+ resumeLatch.await()+ } catch (InterruptedException e) {+ throw new RuntimeException(e)+ }+ }+ result+ }+ }+ }++ void waitForPause() throws InterruptedException {+ pauseLatch.await(5, TimeUnit.SECONDS)+ }++ void resume() {+ resumeLatch.countDown()+ }+ }++ def "threads queued behind an unlock are not starved"() {+ given:+ def conditions = new PollingConditions(timeout: 5)+ def lockByKey = new ControllableLockByKey()+ def key = "testKey"+ def executor = Executors.newFixedThreadPool(3)+ def threadResumeLatch = new CountDownLatch(1)++ when: "a thread acquires and releases the lock, pausing in the middle of unlock"+ def future1 = executor.submit {+ lockByKey.lock(key)+ lockByKey.unlock(key)+ }+ lockByKey.waitForPause()++ and: "two more threads try to acquire the lock while the first is unlocking"+ def contenders = new CopyOnWriteArrayList<Thread>()+ def contend = {+ contenders.add(Thread.currentThread())+ lockByKey.lock(key)+ threadResumeLatch.await(5, TimeUnit.SECONDS)+ lockByKey.unlock(key)+ }+ def future2 = executor.submit(contend)+ def future3 = executor.submit(contend)++ then: "both contend for the lock the first thread is about to remove"+ conditions.eventually {+ assert contenders.size() == 2+ assert contenders.every {+ it.state == Thread.State.BLOCKED || it.state == Thread.State.WAITING+ }+ }++ when: "the first thread completes its unlock and removes the LockWrapper"+ lockByKey.resume()++ then:+ future1.get(5, TimeUnit.SECONDS) == null++ when: "the queued threads are released"+ threadResumeLatch.countDown()++ then: "neither is stuck"+ future2.get(5, TimeUnit.SECONDS) == null+ future3.get(5, TimeUnit.SECONDS) == null++ cleanup:+ executor.shutdownNow()+ }+}diff --git a/model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.java b/model/src/test/groovy/org/openremote/model/util/UniqueIdentifierGeneratorTest.groovysimilarity index 71%rename from model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.javarename to model/src/test/groovy/org/openremote/model/util/UniqueIdentifierGeneratorTest.groovyindex cdf77dac1..6f8ba91fa 100644--- a/model/src/test/java/org/openremote/model/util/UniqueIdentifierGeneratorTest.java+++ b/model/src/test/groovy/org/openremote/model/util/UniqueIdentifierGeneratorTest.groovy@@ -16,19 +16,14 @@** SPDX-License-Identifier: AGPL-3.0-or-later*/-package org.openremote.model.util;+package org.openremote.model.util-import static org.junit.jupiter.api.Assertions.assertEquals;+import spock.lang.Specification-import org.junit.jupiter.api.Test;+class UniqueIdentifierGeneratorTest extends Specification {-public class UniqueIdentifierGeneratorTest {-- @Test- public void generatedAssetIdHasExpectedLength() {- assertEquals(- 22,- UniqueIdentifierGenerator.generateId("masterlight-1-1").length(),- "Asset ids must be 22 characters long");- }+ def "generated asset ID has expected length"() {+ expect: "Asset IDs must be 22 characters long"+ UniqueIdentifierGenerator.generateId("masterlight-1-1").length() == 22+ }}diff --git a/model/src/test/groovy/org/openremote/model/value/ValueUtilTest.groovy b/model/src/test/groovy/org/openremote/model/value/ValueUtilTest.groovynew file mode 100644index 000000000..e71219ee4--- /dev/null+++ b/model/src/test/groovy/org/openremote/model/value/ValueUtilTest.groovy@@ -0,0 +1,88 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * SPDX-License-Identifier: AGPL-3.0-or-later+ */+package org.openremote.model.value++import jakarta.validation.ConstraintValidatorContext+import org.openremote.model.attribute.Attribute+import org.openremote.model.util.ValueUtil+import spock.lang.Specification++import java.time.Instant++class ValueUtilTest extends Specification {++ ConstraintValidatorContext context++ def setup() {+ def builder = Stub(ConstraintValidatorContext.ConstraintViolationBuilder)+ def attributesNode = Stub(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext)+ def valueNode = Stub(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext)+ def containerNode = Stub(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext)+ def iterableNode = Stub(ConstraintValidatorContext.ConstraintViolationBuilder.NodeContextBuilder)+ def keyNode = Stub(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderDefinedContext)++ context = Stub(ConstraintValidatorContext) {+ buildConstraintViolationWithTemplate(_) >> builder+ }+ builder.addPropertyNode("attributes") >> attributesNode+ attributesNode.addPropertyNode("value") >> valueNode+ valueNode.inContainer(Map, 1) >> containerNode+ containerNode.inIterable() >> iterableNode+ iterableNode.atKey(_) >> keyNode+ }++ def "validating #description returns #expected"() {+ given:+ def descriptor = new AttributeDescriptor(attributeName, valueType)+ def attribute = new Attribute(descriptor)+ if (value != null) {+ attribute.value = value+ }+ ValueUtil.ConstraintViolationPathProvider pathProvider = { constraintViolationBuilder ->+ constraintViolationBuilder+ .addPropertyNode("attributes")+ .addPropertyNode("value")+ .inContainer(Map, 1)+ .inIterable()+ .atKey(attribute.name)+ }++ expect:+ ValueUtil.validateValue(+ descriptor,+ descriptor.type,+ attribute,+ Instant.EPOCH,+ context,+ pathProvider,+ attribute.value.orElse(null)+ ) == expected++ where:+ description | attributeName | valueType | value || expected+ "a positive integer" | "positiveNumber" | ValueType.POSITIVE_INTEGER | 1 || true+ "an empty positive integer" | "positiveNumber" | ValueType.POSITIVE_INTEGER | null || true+ "a negative integer as a positive integer" | "positiveNumber" | ValueType.POSITIVE_INTEGER | -1 || false+ "an array of positive integers" | "arrayOfPositiveNumbers" | ValueType.POSITIVE_INTEGER.asArray() | [1, 2] as Integer[] || true+ "an empty array of positive integers" | "arrayOfPositiveNumbers" | ValueType.POSITIVE_INTEGER.asArray() | null || true+ "an array containing a negative integer" | "arrayOfPositiveNumbers" | ValueType.POSITIVE_INTEGER.asArray() | [1, -2] as Integer[] || false+ "nested arrays of positive integers" | "arrayOfArrayOfPositiveNumbers" | ValueType.POSITIVE_INTEGER.asArray().asArray() | [[1, 2] as Integer[], [5, 2] as Integer[]] as Integer[][] || true+ "nested arrays containing a negative integer"| "arrayOfArrayOfPositiveNumbers" | ValueType.POSITIVE_INTEGER.asArray().asArray() | [[1, 2] as Integer[], [-5, 2] as Integer[]] as Integer[][]|| false+ }+}diff --git a/model/src/test/java/org/openremote/model/geo/GeoJSONPointTest.java b/model/src/test/java/org/openremote/model/geo/GeoJSONPointTest.javadeleted file mode 100644index be05a7094..000000000--- a/model/src/test/java/org/openremote/model/geo/GeoJSONPointTest.java+++ /dev/null@@ -1,55 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.model.geo;--import static org.junit.jupiter.api.Assertions.assertEquals;-import static org.junit.jupiter.api.Assertions.assertNotNull;-import static org.junit.jupiter.api.Assertions.assertNull;--import org.junit.jupiter.api.Test;--public class GeoJSONPointTest {-- @Test- public void parseRawLocationReturnsNullForInvalidInput() {- assertNull(GeoJSONPoint.parseRawLocation(null));- assertNull(GeoJSONPoint.parseRawLocation(""));- assertNull(GeoJSONPoint.parseRawLocation("1,2,3"));- assertNull(GeoJSONPoint.parseRawLocation("abc,2"));- assertNull(GeoJSONPoint.parseRawLocation("1,def"));- }-- @Test- public void parseRawLocationParsesValidInput() {- GeoJSONPoint point = GeoJSONPoint.parseRawLocation("12.5, -3.75");- assertNotNull(point);- assertEquals(12.5d, point.getX());- assertEquals(-3.75d, point.getY());- }-- @Test- public void offsetByMetersOffsetsEastAndNorth() {- GeoJSONPoint origin = new GeoJSONPoint(0d, 0d);- GeoJSONPoint offset = origin.offsetByMeters(1000d, 1000d);- double expectedLat = 0.0090436947d;- double expectedLon = 0.0089831528d;- assertEquals(expectedLat, offset.getY(), 1e-9);- assertEquals(expectedLon, offset.getX(), 1e-9);- }-}diff --git a/model/src/test/java/org/openremote/model/util/LockByKeyTest.java b/model/src/test/java/org/openremote/model/util/LockByKeyTest.javadeleted file mode 100644index 061ba2b98..000000000--- a/model/src/test/java/org/openremote/model/util/LockByKeyTest.java+++ /dev/null@@ -1,162 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.model.util;--import static org.junit.jupiter.api.Assertions.*;--import java.util.concurrent.*;-import org.junit.jupiter.api.Test;--public class LockByKeyTest {- /**- * A controllable version of LockByKey that allows us to pause the unlock method at a critical- * point.- */- static class ControllableLockByKey extends LockByKey {-- private final CountDownLatch pauseLatch = new CountDownLatch(1);- private final CountDownLatch resumeLatch = new CountDownLatch(1);-- @Override- protected LockWrapper createLockWrapper() {- return new LockWrapper() {- @Override- public int removeThreadFromQueue() {- int result = super.removeThreadFromQueue();- if (result == 0) {- // Signal that we are at the critical point- pauseLatch.countDown();- // Wait for the test to tell us to continue- try {- resumeLatch.await();- } catch (InterruptedException e) {- throw new RuntimeException(e);- }- }- return result;- }- };- }-- public void waitForPause() throws InterruptedException {- pauseLatch.await(5, TimeUnit.SECONDS);- }-- public void resume() {- resumeLatch.countDown();- }-- public int getQueueSize(String key) {- LockWrapper lockWrapper = locks.get(key);- if (lockWrapper != null) {- return lockWrapper.numberOfThreadsInQueue.get();- }- return 0;- }- }-- @Test- void testThreadStarvation() throws InterruptedException {- final ControllableLockByKey lockByKey = new ControllableLockByKey();- final String key = "testKey";- final ExecutorService executor = Executors.newFixedThreadPool(3);- final CountDownLatch threadWaitingLatch = new CountDownLatch(2);- final CountDownLatch threadResumeLatch = new CountDownLatch(1);-- // Thread 1: Acquires and releases the lock, pausing in the middle of unlock- Future<?> future1 =- executor.submit(- () -> {- lockByKey.lock(key);- lockByKey.unlock(key);- });-- // Wait for Thread 1 to pause in the unlock method- lockByKey.waitForPause();-- // Thread 2: Tries to acquire the lock while Thread 1 is trying to unlock- Future<?> future2 =- executor.submit(- () -> {- try {- threadWaitingLatch.countDown();- lockByKey.lock(key);- threadResumeLatch.await(5, TimeUnit.SECONDS);- } catch (InterruptedException e) {- throw new RuntimeException(e);- }- lockByKey.unlock(key);- });-- // Thread 3: Tries to acquire the lock while Thread 1 is trying to unlock- Future<?> future3 =- executor.submit(- () -> {- try {- Thread.sleep(1000);- threadWaitingLatch.countDown();- lockByKey.lock(key);- threadResumeLatch.await(5, TimeUnit.SECONDS);- } catch (InterruptedException e) {- throw new RuntimeException(e);- }- lockByKey.unlock(key);- });-- // Wait for Thread 2 & 3 to try and acquire the lock- threadWaitingLatch.await(5, TimeUnit.SECONDS);-- var counter = 0;- while (lockByKey.getQueueSize(key) != 2 && counter < 10) {- Thread.sleep(100);- counter++;- }-- // Allow Thread 1 to complete its unlock and remove the LockWrapper- lockByKey.resume();-- // Wait for Thread 1 to finish- try {- future1.get(1, TimeUnit.SECONDS);- } catch (Exception e) {- fail("Thread 1 failed to complete", e);- }- assertTrue(future1.isDone(), "Thread 1 should have completed");-- // Allow Thread 2 & 3 to continue- threadResumeLatch.countDown();-- // Wait for Thread 2 & 3 to finish- try {- future2.get(1, TimeUnit.SECONDS);- future3.get(1, TimeUnit.SECONDS);- } catch (TimeoutException e) {- // We expect a timeout here, which indicates a thread is stuck- } catch (Exception e) {- fail("An unexpected exception occurred", e);- }-- assertTrue(future2.isDone(), "Thread 2 should have completed");-- // Thread 3 should complete- assertTrue(future3.isDone(), "Thread 3 should have completed");-- executor.shutdownNow();- }-}diff --git a/model/src/test/java/org/openremote/model/value/ValueUtilTest.java b/model/src/test/java/org/openremote/model/value/ValueUtilTest.javadeleted file mode 100644index 671a58193..000000000--- a/model/src/test/java/org/openremote/model/value/ValueUtilTest.java+++ /dev/null@@ -1,320 +0,0 @@-/*- * Copyright 2026, OpenRemote Inc.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- *- * SPDX-License-Identifier: AGPL-3.0-or-later- */-package org.openremote.model.value;--import static org.junit.jupiter.api.Assertions.assertFalse;-import static org.junit.jupiter.api.Assertions.assertTrue;-import static org.mockito.ArgumentMatchers.any;-import static org.mockito.ArgumentMatchers.anyString;-import static org.mockito.Mockito.mock;-import static org.mockito.Mockito.when;--import jakarta.validation.ConstraintValidatorContext;-import java.time.Instant;-import java.util.Map;-import org.junit.jupiter.api.BeforeEach;-import org.junit.jupiter.api.Test;-import org.openremote.model.attribute.Attribute;-import org.openremote.model.util.ValueUtil;--public class ValueUtilTest {-- ConstraintValidatorContext context;- ConstraintValidatorContext.ConstraintViolationBuilder builder;- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext node1;- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext node2;- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext- containerBuilder;- ConstraintValidatorContext.ConstraintViolationBuilder.NodeContextBuilder containerBuilder2;- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderDefinedContext containerBuilder3;-- @BeforeEach- void setup() {- context = mock(ConstraintValidatorContext.class);- builder = mock(ConstraintValidatorContext.ConstraintViolationBuilder.class);- node1 =- mock(- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext- .class);- node2 =- mock(- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext- .class);- containerBuilder =- mock(- ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext- .class);- containerBuilder2 =- mock(ConstraintValidatorContext.ConstraintViolationBuilder.NodeContextBuilder.class);- containerBuilder3 =- mock(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderDefinedContext.class);-- when(context.buildConstraintViolationWithTemplate(anyString())).thenReturn(builder);-- when(builder.addPropertyNode("attributes")).thenReturn(node1);-- when(node1.addPropertyNode("value")).thenReturn(node2);-- when(node2.inContainer(Map.class, 1)).thenReturn(containerBuilder);-- when(containerBuilder.inIterable()).thenReturn(containerBuilder2);-- when(containerBuilder2.atKey(any())).thenReturn(containerBuilder3);- }-- @Test- public void validatePositiveInteger() {- AttributeDescriptor<Integer> attributeDescriptor =- new AttributeDescriptor<>("positiveNumber", ValueType.POSITIVE_INTEGER);-- Attribute<Integer> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(1);-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertTrue(valid);- }-- @Test- public void validatePositiveIntegerEmptyValue() {- AttributeDescriptor<Integer> attributeDescriptor =- new AttributeDescriptor<>("positiveNumber", ValueType.POSITIVE_INTEGER);-- Attribute<Integer> attribute = new Attribute<>(attributeDescriptor);-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertTrue(valid);- }-- @Test- public void validatePositiveIntegerFalse() {- AttributeDescriptor<Integer> attributeDescriptor =- new AttributeDescriptor<>("positiveNumber", ValueType.POSITIVE_INTEGER);-- Attribute<Integer> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(-1);-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertFalse(valid);- }-- @Test- public void validateArrayOfPositiveIntegers() {- AttributeDescriptor<Integer[]> attributeDescriptor =- new AttributeDescriptor<>("arrayOfPositiveNumbers", ValueType.POSITIVE_INTEGER.asArray());-- Attribute<Integer[]> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(new Integer[] {1, 2});-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertTrue(valid);- }-- @Test- public void validateArrayOfPositiveIntegersEmptyValue() {- AttributeDescriptor<Integer[]> attributeDescriptor =- new AttributeDescriptor<>("arrayOfPositiveNumbers", ValueType.POSITIVE_INTEGER.asArray());-- Attribute<Integer[]> attribute = new Attribute<>(attributeDescriptor);-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertTrue(valid);- }-- @Test- public void validateArrayOfPositiveIntegersFalse() {- AttributeDescriptor<Integer[]> attributeDescriptor =- new AttributeDescriptor<>("arrayOfPositiveNumbers", ValueType.POSITIVE_INTEGER.asArray());-- Attribute<Integer[]> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(new Integer[] {1, -2});-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertFalse(valid);- }-- @Test- public void validateArrayOfArrayOfPositiveIntegers() {- AttributeDescriptor<Integer[][]> attributeDescriptor =- new AttributeDescriptor<>(- "arrayOfArrayOfPositiveNumbers", ValueType.POSITIVE_INTEGER.asArray().asArray());-- Attribute<Integer[][]> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(new Integer[][] {{1, 2}, {5, 2}});-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertTrue(valid);- }-- @Test- public void validateArrayOfArrayOfPositiveIntegersFalse() {- AttributeDescriptor<Integer[][]> attributeDescriptor =- new AttributeDescriptor<>(- "arrayOfArrayOfPositiveNumbers", ValueType.POSITIVE_INTEGER.asArray().asArray());-- Attribute<Integer[][]> attribute = new Attribute<>(attributeDescriptor);- attribute.setValue(new Integer[][] {{1, 2}, {-5, 2}});-- ValueUtil.ConstraintViolationPathProvider pathProvider =- (constraintViolationBuilder) ->- constraintViolationBuilder- .addPropertyNode("attributes")- .addPropertyNode("value")- .inContainer(Map.class, 1)- .inIterable()- .atKey(attribute.getName());-- Boolean valid =- ValueUtil.validateValue(- attributeDescriptor,- attributeDescriptor.getType(),- attribute,- Instant.now(),- context,- pathProvider,- attribute.getValue().orElse(null));-- assertFalse(valid);- }-}diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.jsonindex 794b3194a..43ae68852 100644--- a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json@@ -3,7 +3,8 @@"title" : "Object Map","type" : "object","additionalProperties" : {+ "title" : "Any Type","type" : [ "null", "number", "integer", "boolean", "string", "array", "object" ],"additionalProperties" : true}-}\ No newline at end of file+}