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
TimescaleDB min version check and datapoint purge bug fix (#2966)
Rich Turnerbd567d9a97d7
diff --git a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java b/container/src/main/java/org/openremote/container/persistence/PersistenceService.javaindex ad080b838..8936175f9 100644--- a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java+++ b/container/src/main/java/org/openremote/container/persistence/PersistenceService.java@@ -63,6 +63,7 @@ import org.openremote.model.security.User;import org.openremote.model.security.UserAttribute;import org.openremote.model.syslog.SyslogEvent;import org.openremote.model.util.ValueUtil;+import org.openremote.model.util.VersionUtil;import javax.sql.DataSource;import java.io.File;@@ -72,6 +73,10 @@ import java.nio.file.FileSystemNotFoundException;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Paths;+import java.sql.Connection;+import java.sql.PreparedStatement;+import java.sql.ResultSet;+import java.sql.SQLException;import java.util.*;import java.util.function.Consumer;import java.util.function.Function;@@ -242,6 +247,7 @@ public class PersistenceService implements ContainerService, Consumer<Persistencpublic static final int OR_DB_POOL_MAX_SIZE_DEFAULT = 20;public static final String OR_DB_CONNECTION_TIMEOUT_SECONDS = "OR_DB_CONNECTION_TIMEOUT_SECONDS";public static final int OR_DB_CONNECTION_TIMEOUT_SECONDS_DEFAULT = 300;+ public static final String TIMESCALE_DB_MIN_VERSION = "2.21.0";public static final String OR_STORAGE_DIR = "OR_STORAGE_DIR";public static final String OR_STORAGE_DIR_DEFAULT = "tmp";public static final String OR_DB_FLYWAY_OUT_OF_ORDER = "OR_DB_FLYWAY_OUT_OF_ORDER";@@ -352,6 +358,8 @@ public class PersistenceService implements ContainerService, Consumer<Persistenc@Overridepublic void start(Container container) throws Exception {+ verifyTimescaleDbVersion();+// Register standard entity classes and also any Entity ClassProvidersList<String> entityClasses = new ArrayList<>(50);entityClasses.add(Asset.class.getName());@@ -584,6 +592,42 @@ public class PersistenceService implements ContainerService, Consumer<Persistencflyway.validate();}+ protected void verifyTimescaleDbVersion() {+ Object dataSourceProperty = persistenceUnitProperties.get(AvailableSettings.DATASOURCE);++ if (!(dataSourceProperty instanceof DataSource dataSource)) {+ String msg = "Cannot validate TimescaleDB extension version as no database DataSource is configured";+ LOG.severe(msg);+ throw new IllegalStateException(msg);+ }++ try (Connection connection = dataSource.getConnection();+ PreparedStatement statement = connection.prepareStatement("SELECT extversion FROM pg_extension WHERE extname = 'timescaledb'");+ ResultSet resultSet = statement.executeQuery()) {++ if (!resultSet.next()) {+ String msg = "TimescaleDB extension is missing; please use a postgres image with TimescaleDB "+ + TIMESCALE_DB_MIN_VERSION + " or newer.";+ LOG.severe(msg);+ throw new IllegalStateException(msg);+ }++ String timescaleDbVersion = resultSet.getString(1);+ if (!VersionUtil.isVersionGreaterOrEqual(timescaleDbVersion, TIMESCALE_DB_MIN_VERSION)) {+ String msg = "TimescaleDB extension version " + timescaleDbVersion + " is not supported; version "+ + TIMESCALE_DB_MIN_VERSION + " or newer is required.";+ LOG.severe(msg);+ throw new IllegalStateException(msg);+ }++ LOG.info("TimescaleDB extension version detected: " + timescaleDbVersion);+ } catch (SQLException ex) {+ String msg = "Failed to validate TimescaleDB extension version";+ LOG.log(Level.SEVERE, msg, ex);+ throw new IllegalStateException(msg, ex);+ }+ }+protected void appendSchemaLocations(List<String> locations) {locations.addAll(defaultSchemaLocations);}diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.javaindex 31a594338..23b35899b 100644--- a/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java+++ b/manager/src/main/java/org/openremote/manager/asset/AssetStorageService.java@@ -888,6 +888,11 @@ public class AssetStorageService extends RouteBuilder implements ContainerServic}assets.sort(Comparator.comparingInt((Asset<?> asset) -> asset.getPath() == null ? 0 : asset.getPath().length).reversed());++ // TODO: Remove when https://github.com/timescale/timescaledb/issues/9916 is fixed+ // and the minimum supported TimescaleDB version includes that fix.+ em.createNativeQuery("SET LOCAL plan_cache_mode = force_custom_plan").executeUpdate();+assets.forEach(em::remove);em.flush();});diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.javaindex 1332e3e56..528c99786 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayConnector.java@@ -33,6 +33,7 @@ import org.openremote.model.gateway.*;import org.openremote.model.query.AssetQuery;import org.openremote.model.syslog.SyslogCategory;import org.openremote.model.util.Pair;+import org.openremote.model.util.VersionUtil;import java.util.*;import java.util.concurrent.*;@@ -266,7 +267,7 @@ public class GatewayConnector {sendMessageToGateway(new GatewayInitDoneEvent());tunnellingSupported = response != null && response.isTunnelingSupported();gatewayVersion = response != null ? response.getVersion() : null;- tunnelTimeoutManagementSupported = gatewayVersion != null && VersionInfo.isVersionGreaterOrEqual(gatewayVersion, "1.1.0");+ tunnelTimeoutManagementSupported = gatewayVersion != null && VersionUtil.isVersionGreaterOrEqual(gatewayVersion, "1.1.0");if (!Objects.equals(VersionInfo.getGatewayApiVersion(), gatewayVersion)) {LOG.warning("Remote gateway's Gateway API version does not match the central manager's gateway API version. Current Central Instance API version: " + VersionInfo.getGatewayApiVersion() + ", Remote Gateway API version: " + gatewayVersion + ". GatewayId: " + gatewayId);}diff --git a/manager/src/main/java/org/openremote/manager/system/VersionInfo.java b/manager/src/main/java/org/openremote/manager/system/VersionInfo.javaindex 96cb8f5cc..984650f51 100644--- a/manager/src/main/java/org/openremote/manager/system/VersionInfo.java+++ b/manager/src/main/java/org/openremote/manager/system/VersionInfo.java@@ -24,7 +24,6 @@ package org.openremote.manager.system;import java.io.IOException;import java.io.InputStream;-import java.util.Objects;import java.util.Properties;public class VersionInfo {@@ -54,62 +53,4 @@ public class VersionInfo {}}- // Compare two version strings like "1.2.3" by splitting on '.'- // Returns a negative value if v1 < v2, zero if equal, positive if v1 > v2- public static int compareVersions(String v1, String v2) {- Objects.requireNonNull(v1, "v1 must not be null");- Objects.requireNonNull(v2, "v2 must not be null");-- String[] parts1 = v1.split("\\.");- String[] parts2 = v2.split("\\.");-- int length = Math.max(parts1.length, parts2.length);- for (int i = 0; i < length; i++) {- int p1 = i < parts1.length && !parts1[i].isEmpty() ? parsePart(parts1[i]) : 0;- int p2 = i < parts2.length && !parts2[i].isEmpty() ? parsePart(parts2[i]) : 0;-- if (p1 != p2) {- return Integer.compare(p1, p2);- }- }- return 0;- }-- // Convenience methods- public static boolean isVersionGreater(String v1, String v2) {- return compareVersions(v1, v2) > 0;- }-- public static boolean isVersionGreaterOrEqual(String v1, String v2) {- return compareVersions(v1, v2) >= 0;- }-- public static boolean isVersionEqual(String v1, String v2) {- return compareVersions(v1, v2) == 0;- }-- public static boolean isVersionLess(String v1, String v2) {- return compareVersions(v1, v2) < 0;- }-- public static boolean isVersionLessOrEqual(String v1, String v2) {- return compareVersions(v1, v2) <= 0;- }-- // Helper that safely parses a numeric version segment, ignoring any trailing- // non-digit qualifiers (e.g. "1-SNAPSHOT" -> 1)- protected static int parsePart(String part) {- int end = 0;- while (end < part.length() && Character.isDigit(part.charAt(end))) {- end++;- }- if (end == 0) {- return 0;- }- try {- return Integer.parseInt(part.substring(0, end));- } catch (NumberFormatException e) {- return 0;- }- }}diff --git a/model/src/main/java/org/openremote/model/util/VersionUtil.java b/model/src/main/java/org/openremote/model/util/VersionUtil.javanew file mode 100644index 000000000..7838bb6b5--- /dev/null+++ b/model/src/main/java/org/openremote/model/util/VersionUtil.java@@ -0,0 +1,82 @@+/*+ * Copyright 2026, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * 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 <http://www.gnu.org/licenses/>.+ */+package org.openremote.model.util;++import java.util.Objects;++public class VersionUtil {++ // Compare two version strings like "1.2.3" by splitting on '.'+ // Returns a negative value if v1 < v2, zero if equal, positive if v1 > v2.+ public static int compareVersions(String v1, String v2) {+ Objects.requireNonNull(v1, "v1 must not be null");+ Objects.requireNonNull(v2, "v2 must not be null");++ String[] parts1 = v1.split("\\.");+ String[] parts2 = v2.split("\\.");++ int length = Math.max(parts1.length, parts2.length);+ for (int i = 0; i < length; i++) {+ int p1 = i < parts1.length && !parts1[i].isEmpty() ? parsePart(parts1[i]) : 0;+ int p2 = i < parts2.length && !parts2[i].isEmpty() ? parsePart(parts2[i]) : 0;++ if (p1 != p2) {+ return Integer.compare(p1, p2);+ }+ }+ return 0;+ }++ public static boolean isVersionGreater(String v1, String v2) {+ return compareVersions(v1, v2) > 0;+ }++ public static boolean isVersionGreaterOrEqual(String v1, String v2) {+ return compareVersions(v1, v2) >= 0;+ }++ public static boolean isVersionEqual(String v1, String v2) {+ return compareVersions(v1, v2) == 0;+ }++ public static boolean isVersionLess(String v1, String v2) {+ return compareVersions(v1, v2) < 0;+ }++ public static boolean isVersionLessOrEqual(String v1, String v2) {+ return compareVersions(v1, v2) <= 0;+ }++ // Ignore trailing non-digit qualifiers, for example "1-SNAPSHOT" -> 1.+ protected static int parsePart(String part) {+ int end = 0;+ while (end < part.length() && Character.isDigit(part.charAt(end))) {+ end++;+ }+ if (end == 0) {+ return 0;+ }+ try {+ return Integer.parseInt(part.substring(0, end));+ } catch (NumberFormatException e) {+ return 0;+ }+ }+}diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetDatapointPurgeTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetDatapointPurgeTest.groovyindex 1e3ae5a23..26824f5ac 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetDatapointPurgeTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetDatapointPurgeTest.groovy@@ -4,7 +4,6 @@ import org.hibernate.cfg.AvailableSettingsimport org.openremote.container.persistence.PersistenceServiceimport org.openremote.manager.asset.AssetStorageServiceimport org.openremote.manager.datapoint.AssetDatapointService-import org.openremote.manager.datapoint.AssetPredictedDatapointServiceimport org.openremote.manager.setup.SetupServiceimport org.openremote.model.asset.impl.ThingAssetimport org.openremote.model.attribute.Attribute@@ -20,7 +19,6 @@ import java.time.Instantimport java.time.temporal.ChronoUnitimport java.util.concurrent.TimeUnit-import static java.util.concurrent.TimeUnit.DAYSimport static org.openremote.manager.datapoint.AssetDatapointService.OR_DATA_POINTS_MAX_AGE_WEEKSclass AssetDatapointPurgeTest extends Specification implements ManagerContainerTrait {@@ -38,6 +36,7 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerTdef assetStorageService = container.getService(AssetStorageService.class)def assetDatapointService = container.getService(AssetDatapointService.class)def persistenceService = container.getService(PersistenceService.class)+ def originalMaxTuplesDecompressedPerDmlTransaction = getMaxTuplesDecompressedPerDmlTransaction(persistenceService)and: "the schema name is retrieved"def schemaName = persistenceService.persistenceUnitProperties.getProperty(AvailableSettings.DEFAULT_SCHEMA)@@ -47,24 +46,34 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerTstopPseudoClock()advancePseudoClock(Instant.ofEpochMilli(getClockTimeOf(container)).truncatedTo(ChronoUnit.HOURS).plus(1, ChronoUnit.HOURS).toEpochMilli() - getClockTimeOf(container), TimeUnit.MILLISECONDS, container)+ and: "the datapoint attributes are defined"+ def attributeNames = (1..10).collect { "attribute${it}" }+when: "a test asset is created with multiple attributes"def testAsset = new ThingAsset("Hypercore Test Asset").setRealm(keycloakTestSetup.realmMaster.name)- testAsset.addOrReplaceAttributes(- new Attribute<>("temperature", ValueType.NUMBER),- new Attribute<>("humidity", ValueType.NUMBER),- new Attribute<>("pressure", ValueType.NUMBER),- new Attribute<>("co2", ValueType.NUMBER)- )+ testAsset.addOrReplaceAttributes(numberAttributes(attributeNames))testAsset = assetStorageService.merge(testAsset)then: "the asset should be created"testAsset.id != nullgetLOG().info("Created test asset with ID: ${testAsset.id}")+ when: "ten assets for segment delete verification are created with the same attributes"+ def segmentDeleteAssets = (1..10).collect { index ->+ def asset = new ThingAsset("Hypercore Segment Delete Asset ${index}")+ .setRealm(keycloakTestSetup.realmMaster.name)+ asset.addOrReplaceAttributes(numberAttributes(attributeNames))+ assetStorageService.merge(asset)+ }+ def segmentDeleteAssetIds = segmentDeleteAssets.collect { it.id }++ then: "the segment delete assets should be created"+ segmentDeleteAssets.every { it.id != null }+ getLOG().info("Created ${segmentDeleteAssets.size()} segment delete assets with IDs: ${segmentDeleteAssetIds}")+when: "25.000 datapoints are inserted across multiple attributes with some within the 4-week retention window"def totalDatapoints = 25_000- def attributeNames = ["temperature", "humidity", "pressure", "co2"]def datapointsPerAttribute = (totalDatapoints / attributeNames.size()) as intdef recentDatapointsPerAttribute = (datapointsPerAttribute * 0.2) as intdef oldDatapointsPerAttribute = datapointsPerAttribute - recentDatapointsPerAttribute@@ -99,6 +108,18 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerT}}+ def segmentDeleteDatapointsPerAttribute = 250+ segmentDeleteAssets.eachWithIndex { asset, assetIndex ->+ attributeNames.each { attributeName ->+ def datapoints = []+ for (int index = 0; index < segmentDeleteDatapointsPerAttribute; index++) {+ def timestamp = oldBaseTimestamp.plus(index * 30, ChronoUnit.SECONDS).toEpochMilli()+ datapoints.add(new ValueDatapoint<>(timestamp, 100.0 + assetIndex + index))+ }+ assetDatapointService.upsertValues(asset.id, attributeName, datapoints)+ }+ }+def insertEndTime = System.currentTimeMillis()def insertDuration = (insertEndTime - insertStartTime) / 1000.0getLOG().info("Finished inserting ${totalDatapoints} datapoints in ${insertDuration} seconds")@@ -113,6 +134,7 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerTassert count >= totalDatapoints * 0.99 // Allow for 1% margingetLOG().info("Verified ${count} datapoints stored")}+ countDatapoints(persistenceService, segmentDeleteAssetIds, attributeNames) == segmentDeleteDatapointsPerAttribute * attributeNames.size() * segmentDeleteAssets.size()when: "storage usage is measured before enabling hypercore"def orDatabaseSizeBefore = persistenceService.doReturningTransaction { em ->@@ -165,6 +187,15 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerTthen: "storage should be smaller after hypercore"orDatabaseSizeBefore > orDatabaseSizeAfter+ when: "the segment-delete assets are deleted from compressed chunks with a low decompression limit"+ setMaxTuplesDecompressedPerDmlTransaction(persistenceService, 100)+ def segmentDeleteSucceeded = assetStorageService.delete(segmentDeleteAssetIds)+ def segmentDeleteDatapointsAfterDelete = countDatapoints(persistenceService, segmentDeleteAssetIds, attributeNames)++ then: "TimescaleDB should delete full segments without decompressing chunks"+ segmentDeleteSucceeded+ segmentDeleteDatapointsAfterDelete == 0+when: "Purging will be called, count datapoints before purging"def countBeforePurge = 0attributeNames.each { attributeName ->@@ -242,5 +273,42 @@ class AssetDatapointPurgeTest extends Specification implements ManagerContainerTthen: "No exception should have occurred"true++ cleanup: "restore TimescaleDB decompression limit"+ if (persistenceService != null && originalMaxTuplesDecompressedPerDmlTransaction != null) {+ setMaxTuplesDecompressedPerDmlTransaction(persistenceService, originalMaxTuplesDecompressedPerDmlTransaction)+ }+ }++ private static Attribute<?>[] numberAttributes(List<String> attributeNames) {+ return attributeNames.collect { new Attribute<>(it, ValueType.NUMBER) } as Attribute<?>[]+ }++ private static long countDatapoints(PersistenceService persistenceService, List<String> assetIds, List<String> attributeNames) {+ return persistenceService.doReturningTransaction { em ->+ def query = em.createNativeQuery("""+ SELECT count(*)+ FROM asset_datapoint+ WHERE entity_id = ANY(string_to_array(:assetIds, ','))+ AND attribute_name = ANY(string_to_array(:attributeNames, ','));+ """)+ query.setParameter("assetIds", assetIds.join(","))+ query.setParameter("attributeNames", attributeNames.join(","))+ return (query.getSingleResult() as Number).longValue()+ }+ }++ private static String getMaxTuplesDecompressedPerDmlTransaction(PersistenceService persistenceService) {+ return persistenceService.doReturningTransaction { em ->+ em.createNativeQuery("SHOW timescaledb.max_tuples_decompressed_per_dml_transaction").getSingleResult() as String+ }+ }++ private static void setMaxTuplesDecompressedPerDmlTransaction(PersistenceService persistenceService, Object limit) {+ persistenceService.doTransaction { em ->+ def query = em.createNativeQuery("SELECT set_config('timescaledb.max_tuples_decompressed_per_dml_transaction', :limit, false)")+ query.setParameter("limit", limit.toString())+ query.getSingleResult()+ }}}diff --git a/test/src/test/groovy/org/openremote/test/system/VersionInfoTest.groovy b/test/src/test/groovy/org/openremote/test/system/VersionUtilTest.groovysimilarity index 51%rename from test/src/test/groovy/org/openremote/test/system/VersionInfoTest.groovyrename to test/src/test/groovy/org/openremote/test/system/VersionUtilTest.groovyindex d8cdf1af3..b0b2675ff 100644--- a/test/src/test/groovy/org/openremote/test/system/VersionInfoTest.groovy+++ b/test/src/test/groovy/org/openremote/test/system/VersionUtilTest.groovy@@ -1,15 +1,16 @@package org.openremote.test.systemimport org.openremote.manager.system.VersionInfo+import org.openremote.model.util.VersionUtilimport spock.lang.Specificationimport spock.lang.Unroll-class VersionInfoTest extends Specification {+class VersionUtilTest extends Specification {@Unrolldef "compareVersions('#v1', '#v2') should return #expected"() {expect:- Integer.signum(VersionInfo.compareVersions(v1, v2)) == Integer.signum(expected)+ Integer.signum(VersionUtil.compareVersions(v1, v2)) == Integer.signum(expected)where:v1 | v2 || expected@@ -30,7 +31,7 @@ class VersionInfoTest extends Specification {@Unrolldef "compareVersions with qualifiers: '#v1' vs '#v2'"() {expect:- Integer.signum(VersionInfo.compareVersions(v1, v2)) == Integer.signum(expected)+ Integer.signum(VersionUtil.compareVersions(v1, v2)) == Integer.signum(expected)where:v1 | v2 || expected@@ -42,19 +43,19 @@ class VersionInfoTest extends Specification {def "compareVersions should handle empty segments"() {expect:- VersionInfo.compareVersions("1..0", "1.0.0") == 0- VersionInfo.compareVersions("1.0.", "1.0.0") == 0+ VersionUtil.compareVersions("1..0", "1.0.0") == 0+ VersionUtil.compareVersions("1.0.", "1.0.0") == 0}def "compareVersions should throw NullPointerException for null inputs"() {when:- VersionInfo.compareVersions(null, "1.0.0")+ VersionUtil.compareVersions(null, "1.0.0")then:thrown(NullPointerException)when:- VersionInfo.compareVersions("1.0.0", null)+ VersionUtil.compareVersions("1.0.0", null)then:thrown(NullPointerException)@@ -62,47 +63,54 @@ class VersionInfoTest extends Specification {def "isVersionGreater should work correctly"() {expect:- VersionInfo.isVersionGreater("2.0.0", "1.0.0") == true- VersionInfo.isVersionGreater("1.0.0", "2.0.0") == false- VersionInfo.isVersionGreater("1.0.0", "1.0.0") == false+ VersionUtil.isVersionGreater("2.0.0", "1.0.0") == true+ VersionUtil.isVersionGreater("1.0.0", "2.0.0") == false+ VersionUtil.isVersionGreater("1.0.0", "1.0.0") == false}def "isVersionGreaterOrEqual should work correctly"() {expect:- VersionInfo.isVersionGreaterOrEqual("2.0.0", "1.0.0") == true- VersionInfo.isVersionGreaterOrEqual("1.0.0", "1.0.0") == true- VersionInfo.isVersionGreaterOrEqual("1.0.0", "2.0.0") == false+ VersionUtil.isVersionGreaterOrEqual("2.0.0", "1.0.0") == true+ VersionUtil.isVersionGreaterOrEqual("1.0.0", "1.0.0") == true+ VersionUtil.isVersionGreaterOrEqual("1.0.0", "2.0.0") == false}def "isVersionEqual should work correctly"() {expect:- VersionInfo.isVersionEqual("1.0.0", "1.0.0") == true- VersionInfo.isVersionEqual("1.0", "1.0.0") == true- VersionInfo.isVersionEqual("1.0.0", "1.0.1") == false+ VersionUtil.isVersionEqual("1.0.0", "1.0.0") == true+ VersionUtil.isVersionEqual("1.0", "1.0.0") == true+ VersionUtil.isVersionEqual("1.0.0", "1.0.1") == false}def "isVersionLess should work correctly"() {expect:- VersionInfo.isVersionLess("1.0.0", "2.0.0") == true- VersionInfo.isVersionLess("2.0.0", "1.0.0") == false- VersionInfo.isVersionLess("1.0.0", "1.0.0") == false+ VersionUtil.isVersionLess("1.0.0", "2.0.0") == true+ VersionUtil.isVersionLess("2.0.0", "1.0.0") == false+ VersionUtil.isVersionLess("1.0.0", "1.0.0") == false}def "isVersionLessOrEqual should work correctly"() {expect:- VersionInfo.isVersionLessOrEqual("1.0.0", "2.0.0") == true- VersionInfo.isVersionLessOrEqual("1.0.0", "1.0.0") == true- VersionInfo.isVersionLessOrEqual("2.0.0", "1.0.0") == false+ VersionUtil.isVersionLessOrEqual("1.0.0", "2.0.0") == true+ VersionUtil.isVersionLessOrEqual("1.0.0", "1.0.0") == true+ VersionUtil.isVersionLessOrEqual("2.0.0", "1.0.0") == false}def "parsePart should handle various formats"() {expect:- VersionInfo.parsePart("123") == 123- VersionInfo.parsePart("1-SNAPSHOT") == 1- VersionInfo.parsePart("42-alpha") == 42- VersionInfo.parsePart("0") == 0- VersionInfo.parsePart("") == 0- VersionInfo.parsePart("beta") == 0+ VersionUtil.parsePart("123") == 123+ VersionUtil.parsePart("1-SNAPSHOT") == 1+ VersionUtil.parsePart("42-alpha") == 42+ VersionUtil.parsePart("0") == 0+ VersionUtil.parsePart("") == 0+ VersionUtil.parsePart("beta") == 0+ }++ def "loadVersion should load manager version from resources"() {+ expect:+ !VersionInfo.loadVersion().isBlank()+ VersionInfo.loadVersion() == VersionInfo.VERSION+ VersionInfo.loadVersion() == VersionInfo.getManagerVersion()}}