Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Fix tests for latest version of demo assets

Rich Turnere829a06e306b
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java
index 15c5bdc0c..9fbe4cb8d 100644
--- a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java
@@ -50,7 +50,7 @@ import static org.openremote.model.rules.Ruleset.Lang.GROOVY;
public class ManagerDemoSetup extends AbstractManagerSetup {
// Update these numbers whenever you change a RULE_STATE flag in test data
- public static final int DEMO_RULE_STATES_APARTMENT_1 = 37;
+ public static final int DEMO_RULE_STATES_APARTMENT_1 = 44;
public static final int DEMO_RULE_STATES_APARTMENT_2 = 11;
public static final int DEMO_RULE_STATES_APARTMENT_3 = 0;
public static final int DEMO_RULE_STATES_SMART_OFFICE = 1;
@@ -73,7 +73,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
public String lobbyId;
public String agentId;
public String thingId;
- public String smartHomeId;
+ public String smartBuildingId;
public String apartment1Id;
public String apartment1ServiceAgentId;
public String apartment1LivingroomId;
@@ -407,7 +407,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
)
);
smartBuilding = assetStorageService.merge(smartBuilding);
- smartHomeId = smartBuilding.getId();
+ smartBuildingId = smartBuilding.getId();
// The "Apartment 1" is the demo apartment with complex scenes
Asset apartment1 = createDemoApartment(smartBuilding, "Apartment 1")
diff --git a/manager/src/main/resources/demo/rules/DemoResidenceVacationMode.groovy b/manager/src/main/resources/demo/rules/DemoResidenceVacationMode.groovy
index cc4e49ed8..5c2e93c40 100644
--- a/manager/src/main/resources/demo/rules/DemoResidenceVacationMode.groovy
+++ b/manager/src/main/resources/demo/rules/DemoResidenceVacationMode.groovy
@@ -51,7 +51,7 @@ rules.add()
def vacationModeExpiresMillis = vacationMode.until - facts.clock.timestamp
facts.putTemporary(vacationModeExpiresMillis, vacationMode)
- facts.updateAssetState(vacationMode.residenceId, "awayScene", REQUEST_START)
+ facts.updateAssetState(vacationMode.residenceId, "dayScene", REQUEST_START)
.updateAssetState(vacationMode.residenceId, "disableSceneTimer", REQUEST_START)
})
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
index ad9f1dbf3..acb62dc8f 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
@@ -131,7 +131,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTrait
when: "an asset is updated with a parent in a different realm"
testAsset = assetResource.get(null, testAsset.getId())
- testAsset.setParentId(managerDemoSetup.smartHomeId)
+ testAsset.setParentId(managerDemoSetup.smartBuildingId)
assetResource.update(null, testAsset.id, testAsset)
then: "the request should be bad"
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
index fcd638064..90ca35503 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
@@ -100,7 +100,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
then: "result should match"
assets.length == 1
- assets[0].id == managerDemoSetup.smartHomeId
+ assets[0].id == managerDemoSetup.smartBuildingId
when: "the child assets of an asset in a foreign realm are retrieved"
assets = assetResource.queryAssets(null,
@@ -122,10 +122,10 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
demoThing.id == managerDemoSetup.thingId
when: "an asset is retrieved by ID in a foreign realm"
- def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartHomeId)
+ def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartBuildingId)
then: "result should match"
- demoSmartBuilding.id == managerDemoSetup.smartHomeId
+ demoSmartBuilding.id == managerDemoSetup.smartBuildingId
/* ############################################## WRITE ####################################### */
@@ -167,13 +167,13 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
testAsset.parentId == null
when: "an asset is updated with a new parent in a foreign realm"
- testAsset.setParentId(managerDemoSetup.smartHomeId)
+ testAsset.setParentId(managerDemoSetup.smartBuildingId)
assetResource.update(null, testAsset.id, testAsset)
testAsset = assetResource.get(null, testAsset.getId())
then: "the asset should be updated"
testAsset.realmId == keycloakDemoSetup.tenantA.id
- testAsset.parentId == managerDemoSetup.smartHomeId
+ testAsset.parentId == managerDemoSetup.smartBuildingId
when: "an asset is deleted in the authenticated realm"
assetResource.delete(null, managerDemoSetup.thingId)
@@ -217,11 +217,11 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
ex.response.status == 404
when: "an asset attribute is written in a foreign realm"
- assetResource.writeAttributeValue(null, managerDemoSetup.smartHomeId, "geoStreet", Values.create("Teststreet 456").toJson())
+ assetResource.writeAttributeValue(null, managerDemoSetup.smartBuildingId, "geoStreet", Values.create("Teststreet 456").toJson())
then: "result should match"
conditions.eventually {
- asset = assetResource.get(null, managerDemoSetup.smartHomeId)
+ asset = assetResource.get(null, managerDemoSetup.smartBuildingId)
assert asset.getAttribute("geoStreet").get().getValue().isPresent()
assert asset.getAttribute("geoStreet").get().getValue().get().toJson() == Values.create("Teststreet 456").toJson()
}
@@ -308,7 +308,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
when: "the child assets of an asset in a foreign realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
)
then: "result should be empty"
@@ -321,7 +321,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
demoThing.id == managerDemoSetup.thingId
when: "an asset is retrieved by ID in a foreign realm"
- assetResource.get(null, managerDemoSetup.smartHomeId)
+ assetResource.get(null, managerDemoSetup.smartBuildingId)
then: "access should be forbidden"
WebApplicationException ex = thrown()
@@ -358,7 +358,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
ex.response.status == 403
when: "an asset is updated with a new parent in a foreign realm"
- testAsset.setParentId(managerDemoSetup.smartHomeId)
+ testAsset.setParentId(managerDemoSetup.smartBuildingId)
assetResource.update(null, testAsset.id, testAsset)
then: "access should be forbidden"
@@ -391,7 +391,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
}
when: "an asset attribute is written in a foreign realm"
- assetResource.writeAttributeValue(null, managerDemoSetup.smartHomeId, "geoStreet", Values.create("Teststreet 456").toJson())
+ assetResource.writeAttributeValue(null, managerDemoSetup.smartBuildingId, "geoStreet", Values.create("Teststreet 456").toJson())
then: "access should be forbidden"
ex = thrown()
@@ -427,7 +427,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
then: "result should match"
assets.length == 1
- assets[0].id == managerDemoSetup.smartHomeId
+ assets[0].id == managerDemoSetup.smartBuildingId
// Assets should not be completely loaded
assets[0].path == null
assets[0].attributesList.size() == 0
@@ -450,7 +450,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
then: "result should match"
assets.length == 1
- assets[0].id == managerDemoSetup.smartHomeId
+ assets[0].id == managerDemoSetup.smartBuildingId
assets[0].realmId == keycloakDemoSetup.tenantA.id
when: "the root assets of the given realm are retrieved"
@@ -473,10 +473,10 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
assets.length == 0
when: "an asset is retrieved by ID in the authenticated realm"
- def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartHomeId)
+ def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartBuildingId)
then: "result should match"
- demoSmartBuilding.id == managerDemoSetup.smartHomeId
+ demoSmartBuilding.id == managerDemoSetup.smartBuildingId
when: "an asset is retrieved by ID in a foreign realm"
assetResource.get(null, managerDemoSetup.thingId)
@@ -527,7 +527,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
ex.response.status == 403
when: "an asset attribute is written in the authenticated realm"
- assetResource.writeAttributeValue(null, managerDemoSetup.smartHomeId, "geoStreet", Values.create("Teststreet 123").toJson())
+ assetResource.writeAttributeValue(null, managerDemoSetup.smartBuildingId, "geoStreet", Values.create("Teststreet 123").toJson())
then: "access should be forbidden"
ex = thrown()
@@ -570,14 +570,14 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
def assets = assetResource.getCurrentUserAssets(null)
then: "result should match"
- assets.length == 5
+ assets.length == 6
Asset apartment1 = assets[0]
apartment1.id == managerDemoSetup.apartment1Id
apartment1.name == "Apartment 1"
apartment1.createdOn.getTime() < System.currentTimeMillis()
apartment1.realmId == keycloakDemoSetup.tenantA.id
apartment1.type == AssetType.RESIDENCE.value
- apartment1.parentId == managerDemoSetup.smartHomeId
+ apartment1.parentId == managerDemoSetup.smartBuildingId
apartment1.path == null
apartment1.attributesList.size() == 0
@@ -593,9 +593,13 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
apartment1Hallway.id == managerDemoSetup.apartment1HallwayId
apartment1Hallway.name == "Hallway"
- Asset apartment2 = assets[4]
- apartment2.id == managerDemoSetup.apartment2Id
- apartment2.name == "Apartment 2"
+ Asset apartment1Bedroom1 = assets[4]
+ apartment1Bedroom1.id == managerDemoSetup.apartment1Bedroom1Id
+ apartment1Bedroom1.name == "Bedroom"
+
+ Asset apartment1Bathroom = assets[5]
+ apartment1Bathroom.id == managerDemoSetup.apartment1BathroomId
+ apartment1Bathroom.name == "Bathroom"
when: "the root assets of a foreign realm are retrieved"
assets = assetResource.queryAssets(null,
@@ -633,16 +637,16 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
)
then: "result should match"
- assets.length == 3
+ assets.length == 5
when: "the child assets of an asset in the authenticated realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
)
then: "result should match"
- assets.length == 2
+ assets.length == 1
when: "the child assets of an asset in a foreign realm are retrieved"
assets = assetResource.queryAssets(null,
@@ -654,7 +658,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
assets.length == 0
when: "an asset is retrieved by ID in the authenticated realm"
- assetResource.get(null, managerDemoSetup.smartHomeId)
+ assetResource.get(null, managerDemoSetup.smartBuildingId)
then: "access should be forbidden"
WebApplicationException ex = thrown()
@@ -667,7 +671,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
apartment1Livingroom.id == managerDemoSetup.apartment1LivingroomId
apartment1Livingroom.name == "Living Room"
def resultAttributes = apartment1Livingroom.getAttributesList()
- resultAttributes.size() == 5
+ resultAttributes.size() == 7
def currentTemperature = apartment1Livingroom.getAttribute("currentTemperature").get()
currentTemperature.getType().get() == AttributeValueType.TEMPERATURE_CELCIUS
!currentTemperature.getValue().isPresent()
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
index 6e5dc1872..d14f2a7f5 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
@@ -96,10 +96,10 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "only the users assets should be retrieved"
- assets.size() == 5
+ assets.size() == 6
assets.get(0).id == managerDemoSetup.apartment1Id
assets.get(1).id == managerDemoSetup.apartment1LivingroomId
- assets.get(1).getAttributesList().size() == 9
+ assets.get(1).getAttributesList().size() == 11
assets.get(1).getAttribute("motionSensor").isPresent()
!assets.get(1).getAttribute("currentTemperature").get().getValue().isPresent()
assets.get(1).getAttribute("currentTemperature").get().meta.size() == 1
@@ -107,7 +107,8 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets.get(1).getAttribute("targetTemperature").get().meta.size() == 1
assets.get(2).id == managerDemoSetup.apartment1KitchenId
assets.get(3).id == managerDemoSetup.apartment1HallwayId
- assets.get(4).id == managerDemoSetup.apartment2Id
+ assets.get(4).id == managerDemoSetup.apartment1Bedroom1Id
+ assets.get(5).id == managerDemoSetup.apartment1BathroomId
when: "a user filtering query is executed that returns only IDs, names and attribute names and limits to protected attributes and meta"
assets = assetStorageService.findAll(
@@ -117,10 +118,10 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "only the users assets should be retrieved"
- assets.size() == 5
+ assets.size() == 6
assets.get(0).id == managerDemoSetup.apartment1Id
assets.get(1).id == managerDemoSetup.apartment1LivingroomId
- assets.get(1).getAttributesList().size() == 5
+ assets.get(1).getAttributesList().size() == 7
!assets.get(1).getAttribute("motionSensor").isPresent()
!assets.get(1).getAttribute("currentTemperature").get().getValue().isPresent()
assets.get(1).getAttribute("currentTemperature").get().meta.size() == 1
@@ -128,7 +129,8 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets.get(1).getAttribute("targetTemperature").get().meta.size() == 1
assets.get(2).id == managerDemoSetup.apartment1KitchenId
assets.get(3).id == managerDemoSetup.apartment1HallwayId
- assets.get(4).id == managerDemoSetup.apartment2Id
+ assets.get(4).id == managerDemoSetup.apartment1Bedroom1Id
+ assets.get(5).id == managerDemoSetup.apartment1BathroomId
when: "a query is executed that returns a protected attribute without any other meta items"
assets = assetStorageService.findAll(
@@ -148,14 +150,14 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
when: "a recursive query is executed to select asset id, name and attribute names for apartment 1 assets"
assets = assetStorageService.findAll(
new AssetQuery()
- .id(managerDemoSetup.smartHomeId)
+ .id(managerDemoSetup.smartBuildingId)
.select(new Select(Include.ONLY_ID_AND_NAME_AND_ATTRIBUTE_NAMES, true, RESTRICTED_READ))
.orderBy(new OrderBy(CREATED_ON))
)
then: "result should contain only ids, names and attribute names and label meta"
- assets.size() == 11
- assets[0].id == managerDemoSetup.smartHomeId
+ assets.size() == 13
+ assets[0].id == managerDemoSetup.smartBuildingId
assets[0].name == "Smart Building"
assets[1].id == managerDemoSetup.apartment1Id
assets[1].createdOn == null
@@ -182,11 +184,13 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets[3].id == managerDemoSetup.apartment1LivingroomId
assets[4].id == managerDemoSetup.apartment1KitchenId
assets[5].id == managerDemoSetup.apartment1HallwayId
- assets[6].id == managerDemoSetup.apartment2Id
- assets[7].id == managerDemoSetup.apartment2LivingroomId
- assets[8].id == managerDemoSetup.apartment2BathroomId
- assets[9].id == managerDemoSetup.apartment3Id
- assets[10].id == managerDemoSetup.apartment3LivingroomId
+ assets[6].id == managerDemoSetup.apartment1Bedroom1Id
+ assets[7].id == managerDemoSetup.apartment1BathroomId
+ assets[8].id == managerDemoSetup.apartment2Id
+ assets[9].id == managerDemoSetup.apartment2LivingroomId
+ assets[10].id == managerDemoSetup.apartment2BathroomId
+ assets[11].id == managerDemoSetup.apartment3Id
+ assets[12].id == managerDemoSetup.apartment3LivingroomId
when: "an asset is loaded by identifier through JPA"
def asset = persistenceService.doReturningTransaction(new Function<EntityManager, Asset>() {
@@ -202,7 +206,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.createdOn.time < System.currentTimeMillis()
asset.name == "Apartment 1"
asset.wellKnownType == AssetType.RESIDENCE
- asset.parentId == managerDemoSetup.smartHomeId
+ asset.parentId == managerDemoSetup.smartBuildingId
asset.parentName == null
asset.parentType == null
asset.realmId == keycloakDemoSetup.tenantA.id
@@ -210,7 +214,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.tenantDisplayName == null
asset.path.length == 2
asset.path[0] == managerDemoSetup.apartment1Id
- asset.path[1] == managerDemoSetup.smartHomeId
+ asset.path[1] == managerDemoSetup.smartBuildingId
asset.attributesList.size() > 0
when: "a query is executed"
@@ -308,7 +312,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
when: "a query is executed"
assets = assetStorageService.findAll(
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
)
then: "result should match"
@@ -317,7 +321,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets.get(0).createdOn.time < System.currentTimeMillis()
assets.get(0).name == "Apartment 1"
assets.get(0).wellKnownType == AssetType.RESIDENCE
- assets.get(0).parentId == managerDemoSetup.smartHomeId
+ assets.get(0).parentId == managerDemoSetup.smartBuildingId
assets.get(0).parentName == "Smart Building"
assets.get(0).parentType == AssetType.BUILDING.value
assets.get(0).realmId == keycloakDemoSetup.tenantA.id
@@ -331,7 +335,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
when: "a query is executed"
assets = assetStorageService.findAll(
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
.tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
)
@@ -344,7 +348,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
when: "a query is executed"
assets = assetStorageService.findAll(
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
.tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
.orderBy(new OrderBy(NAME, true))
)
@@ -358,7 +362,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
when: "a query is executed"
assets = assetStorageService.findAll(
new AssetQuery()
- .parent(new ParentPredicate(managerDemoSetup.smartHomeId))
+ .parent(new ParentPredicate(managerDemoSetup.smartBuildingId))
.tenant(new TenantPredicate(keycloakDemoSetup.masterTenant.id))
)
@@ -372,12 +376,14 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "result should match"
- assets.size() == 5
+ assets.size() == 7
assets.get(0).id == managerDemoSetup.apartment1Id
assets.get(1).id == managerDemoSetup.apartment1ServiceAgentId
assets.get(2).id == managerDemoSetup.apartment1LivingroomId
assets.get(3).id == managerDemoSetup.apartment1KitchenId
assets.get(4).id == managerDemoSetup.apartment1HallwayId
+ assets.get(5).id == managerDemoSetup.apartment1Bedroom1Id
+ assets.get(6).id == managerDemoSetup.apartment1BathroomId
when: "a query is executed"
assets = assetStorageService.findAll(
@@ -387,10 +393,12 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "result should match"
- assets.size() == 3
+ assets.size() == 5
assets.get(0).id == managerDemoSetup.apartment1LivingroomId
assets.get(1).id == managerDemoSetup.apartment1KitchenId
assets.get(2).id == managerDemoSetup.apartment1HallwayId
+ assets.get(3).id == managerDemoSetup.apartment1Bedroom1Id
+ assets.get(4).id == managerDemoSetup.apartment1BathroomId
when: "a query is executed"
assets = assetStorageService.findAll(
@@ -398,17 +406,18 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "result should match"
- assets.size() == 5
+ assets.size() == 6
assets.get(0).id == managerDemoSetup.apartment1Id
assets.get(1).id == managerDemoSetup.apartment1LivingroomId
- assets.get(1).getAttributesList().size() == 5
+ assets.get(1).getAttributesList().size() == 7
!assets.get(1).getAttribute("currentTemperature").get().getValue().isPresent()
assets.get(1).getAttribute("currentTemperature").get().meta.size() == 6
!assets.get(1).getAttribute("targetTemperature").get().getValue().isPresent()
assets.get(1).getAttribute("targetTemperature").get().meta.size() == 4
assets.get(2).id == managerDemoSetup.apartment1KitchenId
assets.get(3).id == managerDemoSetup.apartment1HallwayId
- assets.get(4).id == managerDemoSetup.apartment2Id
+ assets.get(4).id == managerDemoSetup.apartment1Bedroom1Id
+ assets.get(5).id == managerDemoSetup.apartment1BathroomId
when: "a query is executed"
assets = assetStorageService.findAll(
@@ -421,10 +430,13 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
expect: "a result to match the executed query "
assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1Id)
assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1LivingroomId)
- assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment2Id)
+ assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1HallwayId)
+ assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1KitchenId)
+ assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1Bedroom1Id)
+ assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1BathroomId)
+ !assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment2Id)
!assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment3Id)
!assetStorageService.isUserAsset(keycloakDemoSetup.testuser3Id, managerDemoSetup.smartOfficeId)
-
}
// Specs too large, split up features
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy
index edc37c06f..cf4eb367f 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy
@@ -51,7 +51,7 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
def userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, null, null)
then: "result should match"
- userAssets.length == 5
+ userAssets.length == 6
userAssets.any {
it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
@@ -87,9 +87,17 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
userAssets.any {
it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
- it.id.assetId == managerDemoSetup.apartment2Id &&
- it.assetName == "Apartment 2" &&
- it.parentAssetName == "Smart Building" &&
+ it.id.assetId == managerDemoSetup.apartment1Bedroom1Id &&
+ it.assetName == "Bedroom" &&
+ it.parentAssetName == "Apartment 1" &&
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
+ }
+ userAssets.any {
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
+ it.id.userId == keycloakDemoSetup.testuser3Id &&
+ it.id.assetId == managerDemoSetup.apartment1BathroomId &&
+ it.assetName == "Bathroom" &&
+ it.parentAssetName == "Apartment 1" &&
it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
@@ -97,7 +105,7 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser3Id, null)
then: "result should match"
- userAssets.length == 5
+ userAssets.length == 6
when: "the realm and user don't match"
assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantB.id, keycloakDemoSetup.testuser3Id, null)
diff --git a/test/src/test/groovy/org/openremote/test/event/ClientEventTest.groovy b/test/src/test/groovy/org/openremote/test/event/ClientEventTest.groovy
index 5753080f6..871c34031 100644
--- a/test/src/test/groovy/org/openremote/test/event/ClientEventTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/event/ClientEventTest.groovy
@@ -198,7 +198,7 @@ class ClientEventTest extends Specification implements ManagerContainerTrait, Gw
AttributeEvent.class,
new AttributeEvent.EntityIdFilter(managerDemoSetup.thingId),
{ triggeredEventSubscription ->
- internalReceivedEvents.add(triggeredEventSubscription.event as AttributeEvent)
+ internalReceivedEvents.add(triggeredEventSubscription.events[0] as AttributeEvent)
}
))
diff --git a/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
index ddc9c3aa4..dd89ada80 100644
--- a/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
@@ -29,16 +29,16 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
assert noEventProcessedIn(assetProcessingService, 500)
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
- assert apartment1.getAttribute("homeScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
- assert apartment1.getAttribute("awayScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
+ assert apartment1.getAttribute("morningScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
+ assert apartment1.getAttribute("dayScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
assert apartment1.getAttribute("eveningScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
assert apartment1.getAttribute("nightScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
- assert !apartment1.getAttribute("homeSceneAlarmEnabled").get().getValueAsBoolean().orElse(true)
- assert apartment1.getAttribute("homeSceneTargetTemperature").get().getValueAsNumber().orElse(0d) == 21d
+ assert !apartment1.getAttribute("morningSceneAlarmEnabled").get().getValueAsBoolean().orElse(true)
+ assert apartment1.getAttribute("morningSceneTargetTemperature").get().getValueAsNumber().orElse(0d) == 21d
}
when: "Apartment 1 home scene is executed"
- def macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "homeScene", AttributeExecuteStatus.REQUEST_START.asValue())
+ def macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "morningScene", AttributeExecuteStatus.REQUEST_START.asValue())
assetProcessingService.sendAttributeEvent(macroExecute)
then: "Apartment 1 alarm enabled, last scene and living room target temp attribute values should be updated to match the scene"
@@ -46,18 +46,18 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
def livingRoom = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert !apartment1.getAttribute("alarmEnabled").get().getValueAsBoolean().orElse(true)
- assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "HOME"
+ assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "MORNING"
assert livingRoom.getAttribute("targetTemperature").get().getValueAsNumber().orElse(0d) == 21d
}
then: "Apartment 1 home scene attribute status should show as COMPLETED"
conditions.eventually {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
- assert apartment1.getAttribute("homeScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
+ assert apartment1.getAttribute("morningScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
}
when: "Apartment 1 away scene is executed"
- macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "awayScene", AttributeExecuteStatus.REQUEST_START.asValue())
+ macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "dayScene", AttributeExecuteStatus.REQUEST_START.asValue())
assetProcessingService.sendAttributeEvent(macroExecute)
then: "Apartment 1 alarm enabled, last scene and living room target temp attribute values should be update to match the scene"
@@ -72,23 +72,23 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
then: "Apartment 1 away scene attribute status should show as COMPLETED"
conditions.eventually {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
- assert apartment1.getAttribute("awayScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
+ assert apartment1.getAttribute("dayScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
}
when: "The target temperature of the home scene is modified via the apartment attribute"
- def updateTargetTemp = new AttributeEvent(managerDemoSetup.apartment1Id, "homeSceneTargetTemperature", Values.create(10d))
+ def updateTargetTemp = new AttributeEvent(managerDemoSetup.apartment1Id, "morningSceneTargetTemperature", Values.create(10d))
assetProcessingService.sendAttributeEvent(updateTargetTemp)
then: "Apartment 1 home scene attribute status should reset to show as READY and home target temp should show new value"
conditions.eventually {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
- assert apartment1.getAttribute("homeScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
- assert apartment1.getAttribute("homeSceneTargetTemperature").get().getValueAsNumber().orElse(0d) == 10d
- assert !apartment1.getAttribute("homeSceneAlarmEnabled").get().getValueAsBoolean().orElse(true)
+ assert apartment1.getAttribute("morningScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.READY.toString()
+ assert apartment1.getAttribute("morningSceneTargetTemperature").get().getValueAsNumber().orElse(0d) == 10d
+ assert !apartment1.getAttribute("morningSceneAlarmEnabled").get().getValueAsBoolean().orElse(true)
}
when: "Apartment 1 home scene is executed"
- macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "homeScene", AttributeExecuteStatus.REQUEST_START.asValue())
+ macroExecute = new AttributeEvent(managerDemoSetup.apartment1Id, "morningScene", AttributeExecuteStatus.REQUEST_START.asValue())
assetProcessingService.sendAttributeEvent(macroExecute)
then: "Apartment 1 alarm enabled, last scene and living room target temp attribute values should be updated to match the scene"
@@ -96,14 +96,14 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
def livingRoom = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert !apartment1.getAttribute("alarmEnabled").get().getValueAsBoolean().orElse(true)
- assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "HOME"
+ assert apartment1.getAttribute("lastExecutedScene").get().getValueAsString().orElse("") == "MORNING"
assert livingRoom.getAttribute("targetTemperature").get().getValueAsNumber().orElse(0d) == 10d
}
then: "Apartment 1 home scene attribute status should show as COMPLETED"
conditions.eventually {
def apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
- assert apartment1.getAttribute("homeScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
+ assert apartment1.getAttribute("morningScene").get().getValueAsString().orElse("") == AttributeExecuteStatus.COMPLETED.toString()
}
cleanup: "the server should be stopped"
diff --git a/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
index 16cba307b..4ad4249f9 100644
--- a/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
@@ -47,7 +47,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
apartment1 = assetStorageService.find(managerDemoSetup.apartment1Id, true)
sceneAgent = assetStorageService.find(new AssetQuery().name("Scene Agent").type(AssetType.AGENT).parent(managerDemoSetup.apartment1Id))
sceneAgent = assetStorageService.find(sceneAgent.id, true)
- assert apartment1.getAttribute("awaySceneTimeFRIDAY").get().getValueAsString().orElse("") == "08:30:00"
+ assert apartment1.getAttribute("daySceneTimeFRIDAY").get().getValueAsString().orElse("") == "08:30:00"
assert sceneAgent != null
}
@@ -61,7 +61,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
and: "the quartz job has the correct time"
conditions.eventually {
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
@@ -79,12 +79,12 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
}
when: "a trigger is disabled"
- def disableScene = new AttributeEvent(managerDemoSetup.apartment1Id, "awaySceneEnabledFRIDAY", Values.create(false))
+ def disableScene = new AttributeEvent(managerDemoSetup.apartment1Id, "daySceneEnabledFRIDAY", Values.create(false))
assetProcessingService.sendAttributeEvent(disableScene)
then: "the corresponding cron job should be removed from the cron scheduler"
conditions.eventually {
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
@@ -99,12 +99,12 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
}
when: "the trigger is re-enabled"
- def enableScene = new AttributeEvent(managerDemoSetup.apartment1Id, "awaySceneEnabledFRIDAY", Values.create(true))
+ def enableScene = new AttributeEvent(managerDemoSetup.apartment1Id, "daySceneEnabledFRIDAY", Values.create(true))
assetProcessingService.sendAttributeEvent(enableScene)
then: "the quartz job should be recreated and have the correct time"
conditions.eventually {
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
@@ -117,12 +117,12 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
}
when: "a trigger time is modified"
- def modifyTime = new AttributeEvent(managerDemoSetup.apartment1Id, "awaySceneTimeFRIDAY", Values.create("04:00:00"))
+ def modifyTime = new AttributeEvent(managerDemoSetup.apartment1Id, "daySceneTimeFRIDAY", Values.create("04:00:00"))
assetProcessingService.sendAttributeEvent(modifyTime)
then: "the quartz job should have the new trigger time"
conditions.eventually {
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
@@ -136,9 +136,9 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
when: "an attribute is added that links to a timers cron expression"
apartment1.addAttributes(
- new AssetAttribute("awaySceneCronFRIDAY", AttributeValueType.STRING)
+ new AssetAttribute("daySceneCronFRIDAY", AttributeValueType.STRING)
.addMeta(
- AgentLink.asAgentLinkMetaItem(new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")),
+ AgentLink.asAgentLinkMetaItem(new AttributeRef(sceneAgent.id, "daySceneFRIDAY")),
TimerValue.CRON_EXPRESSION.asMetaItem()
)
)
@@ -147,16 +147,16 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
then: "the attributes value should contain the timers cron expression"
conditions.eventually {
apartment1 = assetStorageService.find(apartment1.id, true)
- apartment1.getAttribute("awaySceneCronFRIDAY").get().getValueAsString().get() == "0 0 4 ? * FRI *"
+ apartment1.getAttribute("daySceneCronFRIDAY").get().getValueAsString().get() == "0 0 4 ? * FRI *"
}
when: "the trigger cron expression is modified"
- def modifyCron = new AttributeEvent(managerDemoSetup.apartment1Id, "awaySceneCronFRIDAY", Values.create("0 0 4 ? * MON,FRI *"))
+ def modifyCron = new AttributeEvent(managerDemoSetup.apartment1Id, "daySceneCronFRIDAY", Values.create("0 0 4 ? * MON,FRI *"))
assetProcessingService.sendAttributeEvent(modifyCron)
then: "the quartz job should have the new cron expression"
conditions.eventually {
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
@@ -169,24 +169,24 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
}
when: "a timer action is executed"
- timerProtocol.doTriggerAction(sceneAgent.getAttribute("awaySceneFRIDAY").get())
+ timerProtocol.doTriggerAction(sceneAgent.getAttribute("daySceneFRIDAY").get())
then: "the linked macro should have been executed"
conditions.eventually {
apartment1 = assetStorageService.find(apartment1.id, true)
- apartment1.getAttribute("awayScene").get().getValueAsString().get() == "COMPLETED"
+ apartment1.getAttribute("dayScene").get().getValueAsString().get() == "COMPLETED"
apartment1.getAttribute("lastExecutedScene").get().getValueAsString().get() == "DAY"
}
when: "a trigger is deleted"
sceneAgent = assetStorageService.find(sceneAgent.id)
- sceneAgent.removeAttribute("awaySceneFRIDAY")
+ sceneAgent.removeAttribute("daySceneFRIDAY")
sceneAgent = assetStorageService.merge(sceneAgent)
then: "the corresponding cron job should be removed from the cron scheduler"
conditions.eventually {
- assert !sceneAgent.getAttribute("awaySceneFRIDAY").isPresent()
- def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "awaySceneFRIDAY")
+ assert !sceneAgent.getAttribute("daySceneFRIDAY").isPresent()
+ def awaySceneFridayRef = new AttributeRef(sceneAgent.id, "daySceneFRIDAY")
def timerId = timerProtocol.getTimerId(awaySceneFridayRef)
def jobKey = JobKey.jobKey("cronJob1", timerId)
def jobDetail = timerProtocol.cronScheduler.scheduler.getJobDetail(jobKey)
diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
index f8ada6ed3..8212d18da 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
@@ -145,7 +145,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
then: "the apartment rules engine should be removed"
conditions.eventually {
- assert rulesService.assetEngines.size() == 1
+ assert rulesService.assetEngines.size() == 2
def apartment2Engine = rulesService.assetEngines.get(managerDemoSetup.apartment2Id)
def apartment3Engine = rulesService.assetEngines.get(managerDemoSetup.apartment3Id)
assert apartment2Engine == null
@@ -204,7 +204,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
and: "other rule engines should be unaffected"
conditions.eventually {
assert rulesService.tenantEngines.size() == 2
- assert rulesService.assetEngines.size() == 0
+ assert rulesService.assetEngines.size() == 1
def masterEngine = rulesService.tenantEngines.get(keycloakDemoSetup.masterTenant.id)
def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
assert masterEngine != null
@@ -222,7 +222,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
apartment3Engine = rulesService.assetEngines.get(managerDemoSetup.apartment3Id)
assert rulesService.tenantEngines.size() == 3
- assert rulesService.assetEngines.size() == 1
+ assert rulesService.assetEngines.size() == 2
assert tenantAEngine != null
assert tenantAEngine.isRunning()
assert tenantAEngine.deployments.size() == 2
@@ -243,7 +243,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
// assert rulesService.tenantEngines.get(keycloakDemoSetup.tenantATenant.id) == null
// assert smartHomeEngine.isRunning() == false
// assert smartHomeEngine.allRulesets.length == 0
-// assert rulesService.assetEngines.get(managerDemoSetup.smartHomeId) == null
+// assert rulesService.assetEngines.get(managerDemoSetup.smartBuildingId) == null
// assert apartment3Engine.isRunning() == false
// assert apartment3Engine.allRulesets.length == 0
// assert rulesService.assetEngines.get(managerDemoSetup.apartment3Id) == null
diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
index 6c8ee1159..91eacd234 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
@@ -130,7 +130,7 @@ class BasicRulesImport {
def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
assert tenantBEngine == null
- assert rulesService.assetEngines.size() == 2
+ assert rulesService.assetEngines.size() == 3
apartment1Engine = rulesService.assetEngines.get(managerDemoSetup.apartment1Id)
assert apartment1Engine == null
apartment2Engine = rulesService.assetEngines.get(managerDemoSetup.apartment2Id)
diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
index eb0fc7c11..dc147156d 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
@@ -130,7 +130,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
when: "a LHS filtering test rule definition is loaded into the Smart Building asset"
def assetRuleset = new AssetRuleset(
"Some Smart Building asset rules",
- managerDemoSetup.smartHomeId,
+ managerDemoSetup.smartBuildingId,
getClass().getResource("/org/openremote/test/rules/BasicSmartHomeMatchAllAssetStates.groovy").text,
Ruleset.Lang.GROOVY
)
@@ -139,7 +139,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
then: "the Smart Building rule engine should have ben created, loaded the new rule definition and facts and started"
conditions.eventually {
- smartHomeEngine = rulesService.assetEngines.get(managerDemoSetup.smartHomeId)
+ smartHomeEngine = rulesService.assetEngines.get(managerDemoSetup.smartBuildingId)
assert smartHomeEngine != null
assert smartHomeEngine.isRunning()
assert smartHomeEngine.deployments.size() == 1
diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
index 11dc8ac33..2e5356ae6 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
@@ -728,14 +728,14 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "some asset rules of a protected assigned asset are retrieved"
- def ruleDefinitions = rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment2Id)
+ def ruleDefinitions = rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment1Id)
then: "result should match"
ruleDefinitions.length == 1
- ruleDefinitions[0].name == "Some apartment 2 demo rules"
+ ruleDefinitions[0].name == "Some apartment 1 demo rules"
when: "some asset rules of a protected but not assigned asset are retrieved"
- rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment3Id)
+ rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment2Id)
then: "access should be forbidden"
ex = thrown()
@@ -797,9 +797,9 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "an asset ruleset is created in the authenticated realm"
- def assetRuleset = new AssetRuleset("Test asset definition", managerDemoSetup.apartment2Id, "SomeRulesCode", GROOVY)
+ def assetRuleset = new AssetRuleset("Test asset definition", managerDemoSetup.apartment1Id, "SomeRulesCode", GROOVY)
rulesetResource.createAssetRuleset(null, assetRuleset)
- def rulesetId = rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment2Id)[1].id
+ def rulesetId = rulesetResource.getAssetRulesets(null, managerDemoSetup.apartment1Id)[1].id
assetRuleset = rulesetResource.getAssetRuleset(null, rulesetId)
def lastModified = assetRuleset.lastModified
@@ -810,7 +810,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
lastModified.time < System.currentTimeMillis()
assetRuleset.name == "Test asset definition"
assetRuleset.rules == "SomeRulesCode"
- assetRuleset.assetId == managerDemoSetup.apartment2Id
+ assetRuleset.assetId == managerDemoSetup.apartment1Id
when: "an asset ruleset is updated"
assetRuleset.name = "Renamed test asset definition"
@@ -825,7 +825,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
lastModified.time < System.currentTimeMillis()
assetRuleset.name == "Renamed test asset definition"
assetRuleset.rules == "SomeRulesCodeModified"
- assetRuleset.assetId == managerDemoSetup.apartment2Id
+ assetRuleset.assetId == managerDemoSetup.apartment1Id
when: "an asset ruleset is updated with a changed asset ID"
assetRuleset.assetId = managerDemoSetup.apartment3Id
@@ -844,7 +844,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 400
when: "an asset ruleset is updated with an invalid id"
- assetRuleset.assetId = managerDemoSetup.apartment2Id
+ assetRuleset.assetId = managerDemoSetup.apartment1Id
assetRuleset.id = 1234567890l
rulesetResource.updateAssetRuleset(null, rulesetId, assetRuleset)
diff --git a/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceVacationModeTest.groovy b/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceVacationModeTest.groovy
index 223a93bd5..9dbad61bb 100644
--- a/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceVacationModeTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceVacationModeTest.groovy
@@ -57,7 +57,7 @@ class ResidenceVacationModeTest extends Specification implements ManagerContaine
// The macro should be ready
def asset = assetStorageService.find(managerDemoSetup.apartment1Id, true)
def executionStatus = AttributeExecuteStatus.fromString(
- asset.getAttribute("awayScene").get().getValueAsString().get()
+ asset.getAttribute("dayScene").get().getValueAsString().get()
).get()
assert executionStatus == AttributeExecuteStatus.READY
}
@@ -77,8 +77,8 @@ class ResidenceVacationModeTest extends Specification implements ManagerContaine
assert executionStatus == AttributeExecuteStatus.COMPLETED
assert !asset.getAttribute("sceneTimerEnabled").get().getValueAsBoolean().get()
DayOfWeek.values().each {
- assert !asset.getAttribute("homeSceneEnabled" + it.name()).get().getValueAsBoolean().get()
- assert !asset.getAttribute("awaySceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert !asset.getAttribute("morningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert !asset.getAttribute("daySceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert !asset.getAttribute("eveningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert !asset.getAttribute("nightSceneEnabled" + it.name()).get().getValueAsBoolean().get()
}
@@ -93,8 +93,8 @@ class ResidenceVacationModeTest extends Specification implements ManagerContaine
assert asset.getAttribute("vacationUntil").get().getValueAsNumber().get() == fiveDaysInFuture
assert !asset.getAttribute("sceneTimerEnabled").get().getValueAsBoolean().get()
DayOfWeek.values().each {
- assert !asset.getAttribute("homeSceneEnabled" + it.name()).get().getValueAsBoolean().get()
- assert !asset.getAttribute("awaySceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert !asset.getAttribute("morningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert !asset.getAttribute("daySceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert !asset.getAttribute("eveningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert !asset.getAttribute("nightSceneEnabled" + it.name()).get().getValueAsBoolean().get()
}
@@ -109,8 +109,8 @@ class ResidenceVacationModeTest extends Specification implements ManagerContaine
assert !asset.getAttribute("vacationUntil").get().getValue().isPresent()
assert asset.getAttribute("sceneTimerEnabled").get().getValueAsBoolean().get()
DayOfWeek.values().each {
- assert asset.getAttribute("homeSceneEnabled" + it.name()).get().getValueAsBoolean().get()
- assert asset.getAttribute("awaySceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert asset.getAttribute("morningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
+ assert asset.getAttribute("daySceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert asset.getAttribute("eveningSceneEnabled" + it.name()).get().getValueAsBoolean().get()
assert asset.getAttribute("nightSceneEnabled" + it.name()).get().getValueAsBoolean().get()
}