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
Fix broken tests (AssetStorageService delete signature changed)
Rich Turnercc4f8dad4096
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovyindex 1949cdd7a..9cc6a55cb 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy@@ -359,7 +359,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaineassert rowData.size() == 1assert rowData[0] instanceof AssetTreeNodeassert rowData[0].label == "Smart Office"- assert rowData[0].icon == "building"+ assert rowData[0].icon == "office-building"assert rowData[0].asset.id == managerDemoSetup.smartOfficeId}1 * treeDisplay.setRowCount(1, true)@@ -375,7 +375,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaineassert rowData.size() == 1assert rowData[0] instanceof AssetTreeNodeassert rowData[0].label == "Ground Floor"- assert rowData[0].icon == "bars"+ assert rowData[0].icon == "stairs"assert rowData[0].asset.id == managerDemoSetup.groundFloorId}1 * treeDisplay.setRowCount(1, true)diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovyindex 90368a107..02e6cabbe 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy@@ -139,7 +139,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTraitex.response.status == 400when: "an asset is deleted but has children"- assetResource.delete(null, managerDemoSetup.apartment1Id)+ assetResource.delete(null, [managerDemoSetup.apartment1Id])then: "the request should be bad"ex = thrown()diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovyindex 4d68caad4..42873f0f0 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy@@ -176,7 +176,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraitestAsset.parentId == managerDemoSetup.smartBuildingIdwhen: "an asset is deleted in the authenticated realm"- assetResource.delete(null, managerDemoSetup.thingId)+ assetResource.delete(null, [managerDemoSetup.thingId])assetResource.get(null, managerDemoSetup.thingId)then: "the asset should not be found"@@ -184,7 +184,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiex.response.status == 404when: "an asset is deleted in a foreign realm"- assetResource.delete(null, managerDemoSetup.apartment2LivingroomId)+ assetResource.delete(null, [managerDemoSetup.apartment2LivingroomId])assetResource.get(null, managerDemoSetup.apartment2LivingroomId)then: "the asset should be not found"@@ -366,7 +366,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiex.response.status == 403when: "an asset is deleted in the authenticated realm"- assetResource.delete(null, managerDemoSetup.thingId)+ assetResource.delete(null, [managerDemoSetup.thingId])assetResource.get(null, managerDemoSetup.thingId)then: "the asset should not be found"@@ -374,7 +374,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiex.response.status == 404when: "an asset is deleted in a foreign realm"- assetResource.delete(null, managerDemoSetup.apartment2LivingroomId)+ assetResource.delete(null, [managerDemoSetup.apartment2LivingroomId])then: "access should be forbidden"ex = thrown()@@ -513,14 +513,14 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiex.response.status == 403when: "an asset is deleted in the authenticated realm"- assetResource.delete(null, managerDemoSetup.apartment2LivingroomId)+ assetResource.delete(null, [managerDemoSetup.apartment2LivingroomId])then: "access should be forbidden"ex = thrown()ex.response.status == 403when: "an asset is deleted in a foreign realm"- assetResource.delete(null, managerDemoSetup.thingId)+ assetResource.delete(null, [managerDemoSetup.thingId])then: "access should be forbidden"ex = thrown()@@ -746,14 +746,14 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiex.response.status == 403when: "an asset is deleted in the authenticated realm"- assetResource.delete(null, managerDemoSetup.apartment1LivingroomId)+ assetResource.delete(null, [managerDemoSetup.apartment1LivingroomId])then: "access should be forbidden"ex = thrown()ex.response.status == 403when: "an asset is deleted in a foreign realm"- assetResource.delete(null, managerDemoSetup.thingId)+ assetResource.delete(null, [managerDemoSetup.thingId])then: "access should be forbidden"ex = thrown()diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovyindex bfb7953fb..123827889 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy@@ -17,6 +17,7 @@ import org.openremote.model.calendar.RecurrenceRuleimport org.openremote.model.geo.GeoJSONPointimport org.openremote.model.query.AssetQueryimport org.openremote.model.query.AssetQuery.OrderBy+import org.openremote.model.query.LogicGroupimport org.openremote.model.query.filter.*import org.openremote.model.value.Valuesimport org.openremote.test.ManagerContainerTrait@@ -636,7 +637,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {!asset.getAttribute("lastPresenceDetected").isPresent()!asset.getAttribute("motionSensor").isPresent()- when: "a query is executed to select an asset with an attribute of a certain value"+ when: "a query is executed to select an asset with multiple attribute predicates 'ANDED'"asset = assetStorageService.find(new AssetQuery().select(Select.selectExcludePathAndParentAndRealm()).attributes(new AttributePredicate(@@ -655,6 +656,70 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {assert asset.getAttribute("co2Level").isPresent()assert asset.getAttribute("co2Level").get().valueAsNumber.get() == 350+ when: "a query is executed to select an asset with multiple attribute predicates 'ANDED' where one predicate is false"+ asset = assetStorageService.find(+ new AssetQuery().select(Select.selectExcludePathAndParentAndRealm()).attributes(+ new AttributePredicate(+ new StringPredicate("windowOpen"), new BooleanPredicate(false)+ ),+ new AttributePredicate(+ new StringPredicate("co2Level"), new NumberPredicate(360, Operator.GREATER_THAN, NumberType.INTEGER)+ )+ )+ )++ then: "no assets should match"+ assert asset == null++ when: "a query is executed to select an asset with multiple logic groups"+ asset = assetStorageService.find(+ new AssetQuery().select(Select.selectExcludePathAndParentAndRealm()).attributes(+ new LogicGroup<AttributePredicate>(LogicGroup.Operator.AND, [+ new AttributePredicate(+ new StringPredicate("windowOpen"), new BooleanPredicate(false)+ )+ ], [+ new LogicGroup(LogicGroup.Operator.OR, [+ new AttributePredicate(+ new StringPredicate("co2Level"), new NumberPredicate(340, Operator.GREATER_THAN, NumberType.INTEGER)+ ),+ new AttributePredicate(+ new StringPredicate("co2Level"), new NumberPredicate(50, Operator.LESS_THAN, NumberType.INTEGER)+ )+ ], null)+ ])+ )+ )++ then: "result should contain an Asset with the expected values"+ assert asset != null+ assert asset.getAttribute("windowOpen").isPresent()+ assert !asset.getAttribute("windowOpen").get().valueAsBoolean.get()+ assert asset.getAttribute("co2Level").isPresent()+ assert asset.getAttribute("co2Level").get().valueAsNumber.get() == 350++ when: "a query is executed to select an asset with multiple logic groups where one of the groups is false"+ asset = assetStorageService.find(+ new AssetQuery().select(Select.selectExcludePathAndParentAndRealm()).attributes(+ new LogicGroup<AttributePredicate>(LogicGroup.Operator.AND, [+ new AttributePredicate(+ new StringPredicate("windowOpen"), new BooleanPredicate(false)+ )+ ], [+ new LogicGroup(LogicGroup.Operator.OR, [+ new AttributePredicate(+ new StringPredicate("co2Level"), new NumberPredicate(360, Operator.GREATER_THAN, NumberType.INTEGER)+ ),+ new AttributePredicate(+ new StringPredicate("co2Level"), new NumberPredicate(50, Operator.LESS_THAN, NumberType.INTEGER)+ )+ ], null)+ ])+ )+ )++ then: "no assets should match"+ assert asset == null}def "Location queries"() {diff --git a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovyindex 97a1d8aae..afca7efd8 100644--- a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy+++ b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy@@ -485,7 +485,7 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {assert geofences.size() == 0when: "a console is deleted"- assetStorageService.delete(testUser3Console2.id)+ assetStorageService.delete([testUser3Console2.id])then: "the deleted console should be removed from ORConsoleGeofenceAssetAdapter"conditions.eventually {diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovyindex 926492491..de8fd3593 100644--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy@@ -330,7 +330,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainerwhen: "the Kitchen room asset is deleted"rulesImport.resetRulesFired()- assetStorageService.delete(asset.getId())+ assetStorageService.delete([asset.getId()])then: "the facts should be removed from the rule engines and rules should have fired"conditions.eventually {