Skip to content

armgit / core

Public Imported from GitHub
0

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

Updated demo assets and users for the new demo enviroment

Michael Rademakerd946cf3b6ffc
diff --git a/README.md b/README.md
index 7d9f3ff0d..f58fb48c8 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Username: admin
Password: secret
```
-The console app of `customerA` can be accessed on https://localhost/customerA/ with username `testuser3` and password `testuser3`.
+The console app of `tenantA` can be accessed on https://localhost/tenantA/ with username `testuser3` and password `testuser3`.
Stop the stack and remove all unused data volumes (alternatively delete only the openremote volumes if you don't want all unused volumes to be removed) with:
diff --git a/deployment/map/mapsettings.json b/deployment/map/mapsettings.json
index 05c307817..9ec8624fe 100644
--- a/deployment/map/mapsettings.json
+++ b/deployment/map/mapsettings.json
@@ -7,7 +7,7 @@
"maxZoom": 19,
"boxZoom": false
},
- "customerA": {
+ "tenantA": {
"center": [5.4774, 51.4370],
"bounds": [5.343, 51.378, 5.591, 51.509],
"zoom": 13,
diff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
index fafc98d41..25aec2464 100644
--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java
@@ -504,4 +504,243 @@ public abstract class AbstractManagerSetup implements Setup {
)
);
}
+
+ protected Asset createDemoCameraAsset(String name, Asset area, Supplier<MetaItem[]> agentLinker) {
+ Asset cameraAsset = new Asset(name, THING, area);
+ cameraAsset.addAttributes(
+ new AssetAttribute("cameraCountIn", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count In")),
+ new MetaItem(DESCRIPTION, Values.create("Cumulative number of people going into area")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("cameraCountOut", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Out")),
+ new MetaItem(DESCRIPTION, Values.create("Cumulative number of people leaving area")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("cameraCountInMinute", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count In Minute")),
+ new MetaItem(DESCRIPTION, Values.create("Number of people going into area per minute")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("cameraCountOutMinute", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Out Minute")),
+ new MetaItem(DESCRIPTION, Values.create("Number of people leaving area per minute")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("cameraCountTotal", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Total")),
+ new MetaItem(DESCRIPTION, Values.create("cameraCountIn - cameraCountOut")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("cameraCountGrowth", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Growth")),
+ new MetaItem(DESCRIPTION, Values.create("cameraCountIn - cameraCountOut")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("cameraCountTotalAlertLevel", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Total Alert Level")),
+ new MetaItem(DESCRIPTION, Values.create("When Camera Count Total equals or passes this value, an alert will be sent")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("cameraCountTotalAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Total Alert")),
+ new MetaItem(DESCRIPTION, Values.create("True when alert rule is triggered")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("cameraCountGrowthAlertLevel", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Growth Alert Level")),
+ new MetaItem(DESCRIPTION, Values.create("When Camera Count Growth equals or passes this value, an alert will be sent")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("cameraCountGrowthAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Camera Count Growth Alert")),
+ new MetaItem(DESCRIPTION, Values.create("True when alert rule is triggered")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ )
+ );
+
+ return cameraAsset;
+ }
+
+ protected Asset createDemoMicrophoneAsset(String name, Asset area, Supplier<MetaItem[]> agentLinker) {
+ Asset microphoneAsset = new Asset(name, THING, area);
+ microphoneAsset.addAttributes(
+ new AssetAttribute("microphoneLevel", SOUND_DB)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Level")),
+ new MetaItem(DESCRIPTION, Values.create("dB")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("microphoneLevelAlertLevel", SOUND_DB)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Level Alert Level")),
+ new MetaItem(DESCRIPTION, Values.create("Level of dB when alert will be send")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("microphoneLevelAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Level Alert")),
+ new MetaItem(DESCRIPTION, Values.create("True when alert rule is triggered")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("microphoneGlassAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Glass Alert")),
+ new MetaItem(DESCRIPTION, Values.create("Input from microphone")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("microphoneGunshotAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Gunshot Alert")),
+ new MetaItem(DESCRIPTION, Values.create("Input from microphone")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("microphoneScreamAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Scream Alert")),
+ new MetaItem(DESCRIPTION, Values.create("Input from microphone")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("microphoneSoundTypeAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Microphone Sound Type Alert")),
+ new MetaItem(DESCRIPTION, Values.create("True when alert rule is triggered")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ )
+ );
+ return microphoneAsset;
+ }
+
+ protected Asset createDemoEnviromentAsset(String name, Asset area, Supplier<MetaItem[]> agentLinker) {
+ Asset enviromentAsset = new Asset(name, THING, area);
+ enviromentAsset.addAttributes(
+ new AssetAttribute("temperature", TEMPERATURE_CELCIUS)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Tempature Level")),
+ new MetaItem(DESCRIPTION, Values.create("oC")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("nO2", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Nitrogen Level")),
+ new MetaItem(DESCRIPTION, Values.create("µg/m3")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("relHumidity", PERCENTAGE)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Humidity")),
+ new MetaItem(DESCRIPTION, Values.create("Humidity in area")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("ozon", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Ozon Level")),
+ new MetaItem(DESCRIPTION, Values.create("µg/m3")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("ozonAlertLevel", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Ozon Alert Level")),
+ new MetaItem(DESCRIPTION, Values.create("µg/m3")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("ozonAlert", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Ozon Alert")),
+ new MetaItem(DESCRIPTION, Values.create("True when alert rule is triggered")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("particlesPM1", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Particles PM 1")),
+ new MetaItem(DESCRIPTION, Values.create("Particles PM 1")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("particlesPM2_5", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Particles PM 2.5")),
+ new MetaItem(DESCRIPTION, Values.create("Particles PM 2.5")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get()),
+ new AssetAttribute("particlesPM10", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Particles PM 10")),
+ new MetaItem(DESCRIPTION, Values.create("Particles PM 10")),
+ new MetaItem(READ_ONLY, Values.create(true)),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ).addMeta(agentLinker.get())
+ );
+
+ return enviromentAsset;
+ }
+
+ protected Asset createDemoLightAsset(String name, Asset area) {
+ Asset lightAsset = new Asset(name, THING, area);
+ lightAsset.addAttributes(
+ new AssetAttribute("lightStatus", BOOLEAN)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Light Status")),
+ new MetaItem(DESCRIPTION, Values.create("On or off")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("lightDimLevel", PERCENTAGE)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Light Dim Level")),
+ new MetaItem(DESCRIPTION, Values.create("The level of dimming of the light")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("colorRGB", COLOR_RGB)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Color RGB")),
+ new MetaItem(DESCRIPTION, Values.create("The RGB color of the light")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("groupNumber", NUMBER)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Group number")),
+ new MetaItem(DESCRIPTION, Values.create("Which group this lights belongs to")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ ),
+ new AssetAttribute("scene", STRING)
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Scene")),
+ new MetaItem(DESCRIPTION, Values.create("The scene this light is setup to")),
+ new MetaItem(RULE_STATE, Values.create(true))
+ )
+ );
+
+ return lightAsset;
+ }
}
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/KeycloakDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/KeycloakDemoSetup.java
index 9903b0fc4..b89a23ab2 100644
--- a/manager/src/main/java/org/openremote/manager/setup/builtin/KeycloakDemoSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/KeycloakDemoSetup.java
@@ -39,8 +39,10 @@ import java.util.logging.Logger;
* <ul>
* <li><code>admin</code> - The superuser in the "master" realm with all access</li>
* <li><code>testuser1</code> - (Password: testuser1) A user in the "master" realm with read/write access to assets and rules</li>
- * <li><code>testuser2</code> - (Password: testuser2) A user in the "customerA" realm with only read access to assets</li>
- * <li><code>testuser3</code> - (Password: testuser3) A user in the "customerA" realm with read/write access to a restricted set of assets and their rules</li>
+ * <li><code>testuser2</code> - (Password: testuser2) A user in the "tenantA" realm with only read access to assets</li>
+ * <li><code>testuser3</code> - (Password: testuser3) A user in the "tenantA" realm with read/write access to a restricted set of assets and their rules</li>
+ * <li><code>testuser4</code> - (Password: testuser4) A user in the "tenantB" realm with read/write access to a restricted set of assets and their rules</li>
+ *
* </ul>
*/
public class KeycloakDemoSetup extends AbstractKeycloakSetup {
@@ -50,9 +52,10 @@ public class KeycloakDemoSetup extends AbstractKeycloakSetup {
public String testuser1Id;
public String testuser2Id;
public String testuser3Id;
+ public String testuser4Id;
public Tenant masterTenant;
- public Tenant customerATenant;
- public Tenant customerBTenant;
+ public Tenant tenantA;
+ public Tenant tenantB;
public KeycloakDemoSetup(Container container) {
super(container);
@@ -65,19 +68,19 @@ public class KeycloakDemoSetup extends AbstractKeycloakSetup {
// Tenants
masterTenant = identityService.getIdentityProvider().getTenantForRealm(Constants.MASTER_REALM);
- Tenant customerA = new Tenant();
- customerA.setRealm("customerA");
- customerA.setDisplayName("Customer A");
- customerA.setEnabled(true);
- keycloakProvider.createTenant(new ClientRequestInfo(null, accessToken), customerA, emailConfig);
- customerATenant = keycloakProvider.getTenantForRealm(customerA.getRealm());
+ tenantA = new Tenant();
+ tenantA.setRealm("tenantA");
+ tenantA.setDisplayName("Tenant A");
+ tenantA.setEnabled(true);
+ keycloakProvider.createTenant(new ClientRequestInfo(null, accessToken), tenantA, emailConfig);
+ tenantA = keycloakProvider.getTenantForRealm(tenantA.getRealm());
- Tenant customerB = new Tenant();
- customerB.setRealm("customerB");
- customerB.setDisplayName("Customer B");
- customerB.setEnabled(true);
- keycloakProvider.createTenant(new ClientRequestInfo(null, accessToken), customerB, emailConfig);
- customerBTenant = keycloakProvider.getTenantForRealm(customerB.getRealm());
+ tenantB = new Tenant();
+ tenantB.setRealm("tenantB");
+ tenantB.setDisplayName("Tenant B");
+ tenantB.setEnabled(true);
+ keycloakProvider.createTenant(new ClientRequestInfo(null, accessToken), tenantB, emailConfig);
+ tenantB = keycloakProvider.getTenantForRealm(tenantB.getRealm());
// Users
@@ -86,8 +89,8 @@ public class KeycloakDemoSetup extends AbstractKeycloakSetup {
UserRepresentation testuser1 = new UserRepresentation();
testuser1.setUsername("testuser1");
- testuser1.setFirstName("Testuserfirst");
- testuser1.setLastName("Testuserlast");
+ testuser1.setFirstName("DemoMaster");
+ testuser1.setLastName("DemoLast");
testuser1.setEnabled(true);
masterUsersResource.create(testuser1);
testuser1 = masterUsersResource.search("testuser1", null, null, null, null, null).get(0);
@@ -107,54 +110,81 @@ public class KeycloakDemoSetup extends AbstractKeycloakSetup {
));
LOG.info("Added demo user '" + testuser1.getUsername() + "' with password '" + testuser1Credentials.getValue() + "'");
- UsersResource customerAUsersResource = keycloakProvider.getRealms(accessToken).realm("customerA").users();
- ClientsResource customerAClientsResource = keycloakProvider.getRealms(accessToken).realm("customerA").clients();
- String customerAClientObjectId = getClientObjectId(customerAClientsResource);
- RolesResource customerARolesResource = customerAClientsResource.get(customerAClientObjectId).roles();
+ UsersResource tenantAUsersResource = keycloakProvider.getRealms(accessToken).realm("tenantA").users();
+ ClientsResource tenantAClientsResource = keycloakProvider.getRealms(accessToken).realm("tenantA").clients();
+ String tenantAClientObjectId = getClientObjectId(tenantAClientsResource);
+ RolesResource tenantARolesResource = tenantAClientsResource.get(tenantAClientObjectId).roles();
UserRepresentation testuser2 = new UserRepresentation();
testuser2.setUsername("testuser2");
- testuser2.setFirstName("Testuserfirst");
- testuser2.setLastName("Testuserlast");
+ testuser2.setFirstName("DemoA2");
+ testuser2.setLastName("DemoLast");
testuser2.setEmail("[email protected]");
testuser2.setEnabled(true);
- customerAUsersResource.create(testuser2);
- testuser2 = customerAUsersResource.search("testuser2", null, null, null, null, null).get(0);
+ tenantAUsersResource.create(testuser2);
+ testuser2 = tenantAUsersResource.search("testuser2", null, null, null, null, null).get(0);
this.testuser2Id = testuser2.getId();
CredentialRepresentation testuser2Credentials = new CredentialRepresentation();
testuser2Credentials.setType("password");
testuser2Credentials.setValue("testuser2");
testuser2Credentials.setTemporary(false);
- customerAUsersResource.get(testuser2.getId()).resetPassword(testuser2Credentials);
- customerAUsersResource.get(testuser2.getId()).roles().clientLevel(customerAClientObjectId).add(Arrays.asList(
- customerARolesResource.get(ClientRole.WRITE_USER.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.READ_MAP.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.READ_ASSETS.getValue()).toRepresentation()
+ tenantAUsersResource.get(testuser2.getId()).resetPassword(testuser2Credentials);
+ tenantAUsersResource.get(testuser2.getId()).roles().clientLevel(tenantAClientObjectId).add(Arrays.asList(
+ tenantARolesResource.get(ClientRole.WRITE_USER.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.READ_MAP.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.READ_ASSETS.getValue()).toRepresentation()
));
LOG.info("Added demo user '" + testuser2.getUsername() + "' with password '" + testuser2Credentials.getValue() + "'");
UserRepresentation testuser3 = new UserRepresentation();
testuser3.setUsername("testuser3");
- testuser3.setFirstName("Testuserfirst");
- testuser3.setLastName("Testuserlast");
+ testuser3.setFirstName("DemoA3");
+ testuser3.setLastName("DemoLast");
testuser3.setEmail("[email protected]");
testuser3.setEnabled(true);
- customerAUsersResource.create(testuser3);
- testuser3 = customerAUsersResource.search("testuser3", null, null, null, null, null).get(0);
+ tenantAUsersResource.create(testuser3);
+ testuser3 = tenantAUsersResource.search("testuser3", null, null, null, null, null).get(0);
this.testuser3Id = testuser3.getId();
CredentialRepresentation testuser3Credentials = new CredentialRepresentation();
testuser3Credentials.setType("password");
testuser3Credentials.setValue("testuser3");
testuser3Credentials.setTemporary(false);
- customerAUsersResource.get(testuser3.getId()).resetPassword(testuser3Credentials);
- customerAUsersResource.get(testuser3.getId()).roles().clientLevel(customerAClientObjectId).add(Arrays.asList(
- customerARolesResource.get(ClientRole.WRITE_USER.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.READ_MAP.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.READ_ASSETS.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.WRITE_RULES.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.WRITE_ASSETS.getValue()).toRepresentation(),
- customerARolesResource.get(ClientRole.READ_RULES.getValue()).toRepresentation()
+ tenantAUsersResource.get(testuser3.getId()).resetPassword(testuser3Credentials);
+ tenantAUsersResource.get(testuser3.getId()).roles().clientLevel(tenantAClientObjectId).add(Arrays.asList(
+ tenantARolesResource.get(ClientRole.WRITE_USER.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.READ_MAP.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.READ_ASSETS.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.WRITE_RULES.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.WRITE_ASSETS.getValue()).toRepresentation(),
+ tenantARolesResource.get(ClientRole.READ_RULES.getValue()).toRepresentation()
));
LOG.info("Added demo user '" + testuser3.getUsername() + "' with password '" + testuser3Credentials.getValue() + "'");
+
+ UsersResource tenantBUsersResource = keycloakProvider.getRealms(accessToken).realm("tenantB").users();
+ ClientsResource tenantBClientsResource = keycloakProvider.getRealms(accessToken).realm("tenantB").clients();
+ String tenantBClientObjectId = getClientObjectId(tenantBClientsResource);
+ RolesResource tenantBRolesResource = tenantBClientsResource.get(tenantBClientObjectId).roles();
+
+ UserRepresentation testuser4 = new UserRepresentation();
+ testuser4.setUsername("testuser4");
+ testuser4.setFirstName("DemoB");
+ testuser4.setLastName("DemoLast");
+ testuser4.setEmail("[email protected]");
+ testuser4.setEnabled(true);
+ tenantBUsersResource.create(testuser4);
+ testuser4 = tenantBUsersResource.search("testuser4", null, null, null, null, null).get(0);
+ this.testuser4Id = testuser4.getId();
+ CredentialRepresentation testuser4Credentials = new CredentialRepresentation();
+ testuser4Credentials.setType("password");
+ testuser4Credentials.setValue("testuser4");
+ testuser4Credentials.setTemporary(false);
+ tenantBUsersResource.get(testuser4.getId()).resetPassword(testuser4Credentials);
+ tenantBUsersResource.get(testuser4.getId()).roles().clientLevel(tenantBClientObjectId).add(Arrays.asList(
+ tenantBRolesResource.get(ClientRole.WRITE_USER.getValue()).toRepresentation(),
+ tenantBRolesResource.get(ClientRole.READ_MAP.getValue()).toRepresentation(),
+ tenantBRolesResource.get(ClientRole.READ_ASSETS.getValue()).toRepresentation(),
+ tenantBRolesResource.get(ClientRole.READ_RULES.getValue()).toRepresentation()
+ ));
+ LOG.info("Added demo user '" + testuser4.getUsername() + "' with password '" + testuser4Credentials.getValue() + "'");
}
}
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 53cea7961..234a0c5a2 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
@@ -23,10 +23,7 @@ import org.openremote.agent.protocol.simulator.SimulatorProtocol;
import org.openremote.container.Container;
import org.openremote.manager.security.UserConfiguration;
import org.openremote.manager.setup.AbstractManagerSetup;
-import org.openremote.model.asset.Asset;
-import org.openremote.model.asset.AssetAttribute;
-import org.openremote.model.asset.AssetMeta;
-import org.openremote.model.asset.UserAsset;
+import org.openremote.model.asset.*;
import org.openremote.model.attribute.*;
import org.openremote.model.geo.GeoJSONPoint;
import org.openremote.model.security.Tenant;
@@ -54,15 +51,17 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
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;
- public static final int DEMO_RULE_STATES_SMART_HOME = DEMO_RULE_STATES_APARTMENT_1 + DEMO_RULE_STATES_APARTMENT_2 + DEMO_RULE_STATES_APARTMENT_3;
- public static final int DEMO_RULE_STATES_CUSTOMER_A = DEMO_RULE_STATES_SMART_HOME;
- public static final int DEMO_RULE_STATES_GLOBAL = DEMO_RULE_STATES_CUSTOMER_A + DEMO_RULE_STATES_SMART_OFFICE;
+ public static final int DEMO_RULE_STATES_SMART_BUILDING = DEMO_RULE_STATES_APARTMENT_1 + DEMO_RULE_STATES_APARTMENT_2 + DEMO_RULE_STATES_APARTMENT_3;
+ public static final int DEMO_RULE_STATES_SMART_CITY = 65;
+ public static final int DEMO_RULE_STATES_CUSTOMER_A = DEMO_RULE_STATES_SMART_BUILDING;
+ public static final int DEMO_RULE_STATES_GLOBAL = DEMO_RULE_STATES_CUSTOMER_A + DEMO_RULE_STATES_SMART_OFFICE + DEMO_RULE_STATES_SMART_CITY;
public static final int DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES = DEMO_RULE_STATES_APARTMENT_1 + 28;
public static final int DEMO_RULE_STATES_SMART_HOME_WITH_SCENES = DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES + DEMO_RULE_STATES_APARTMENT_2 + DEMO_RULE_STATES_APARTMENT_3;
public static final int DEMO_RULE_STATES_CUSTOMER_A_WITH_SCENES = DEMO_RULE_STATES_SMART_HOME_WITH_SCENES;
public static final int DEMO_RULE_STATES_GLOBAL_WITH_SCENES = DEMO_RULE_STATES_CUSTOMER_A_WITH_SCENES;
public static GeoJSONPoint SMART_OFFICE_LOCATION = new GeoJSONPoint(5.460315214821094, 51.44541688237109);
- public static GeoJSONPoint SMART_HOME_LOCATION = new GeoJSONPoint(5.470945, 51.438000);
+ public static GeoJSONPoint SMART_BUILDING_LOCATION = new GeoJSONPoint(5.470945, 51.438000);
+ public static GeoJSONPoint SMART_CITY_LOCATION = new GeoJSONPoint(5.670945, 51.435000);
public static final String agentProtocolConfigName = "simulator123";
public static final String thingLightToggleAttributeName = "light1Toggle";
final protected boolean importDemoScenes;
@@ -83,7 +82,11 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
public String apartment2BathroomId;
public String apartment3LivingroomId;
public String masterRealmId;
- public String customerARealmId;
+ public String realmATenantId;
+ public String realmBTenantId;
+ public String smartCityServiceAgentId;
+
+
public ManagerDemoSetup(Container container, boolean importDemoScenes) {
super(container);
@@ -95,16 +98,18 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
KeycloakDemoSetup keycloakDemoSetup = setupService.getTaskOfType(KeycloakDemoSetup.class);
Tenant masterTenant = keycloakDemoSetup.masterTenant;
- Tenant customerATenant = keycloakDemoSetup.customerATenant;
+ Tenant realmATenant = keycloakDemoSetup.tenantA;
+ Tenant realmBTenant = keycloakDemoSetup.tenantB;
masterRealmId = masterTenant.getId();
- customerARealmId = customerATenant.getId();
+ realmATenantId = realmATenant.getId();
+ realmBTenantId = realmBTenant.getId();
// ################################ Demo assets for 'master' realm ###################################
ObjectValue locationValue = SMART_OFFICE_LOCATION.toValue();
Asset smartOffice = new Asset();
- smartOffice.setRealmId(masterTenant.getId());
+ smartOffice.setRealmId(masterRealmId);
smartOffice.setName("Smart Office");
smartOffice.setType(BUILDING);
List<AssetAttribute> smartOfficeAttributes = Arrays.asList(
@@ -365,15 +370,15 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
AttributeEvent.Source.SENSOR);
});
- // ################################ Demo assets for 'customerA' realm ###################################
+ // ################################ Demo assets for 'tenantA' realm ###################################
- ObjectValue locationValueA = SMART_HOME_LOCATION.toValue();
+ ObjectValue locationValueA = SMART_BUILDING_LOCATION.toValue();
- Asset smartHome = new Asset();
- smartHome.setRealmId(customerATenant.getId());
- smartHome.setName("Smart Home");
- smartHome.setType(BUILDING);
- smartHome.addAttributes(
+ Asset smartBuilding = new Asset();
+ smartBuilding.setRealmId(realmATenantId);
+ smartBuilding.setName("Smart Building");
+ smartBuilding.setType(BUILDING);
+ smartBuilding.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("geoStreet", STRING, Values.create("Wilhelminaplein 21C"))
.setMeta(
@@ -396,11 +401,11 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
new MetaItem(ABOUT, Values.create("http://project-haystack.org/tag/geoCountry"))
)
);
- smartHome = assetStorageService.merge(smartHome);
- smartHomeId = smartHome.getId();
+ smartBuilding = assetStorageService.merge(smartBuilding);
+ smartHomeId = smartBuilding.getId();
// The "Apartment 1" is the demo apartment with complex scenes
- Asset apartment1 = createDemoApartment(smartHome, "Apartment 1")
+ Asset apartment1 = createDemoApartment(smartBuilding, "Apartment 1")
.addAttributes(new AssetAttribute(AttributeType.LOCATION, locationValueA));
apartment1 = assetStorageService.merge(apartment1);
apartment1Id = apartment1.getId();
@@ -522,7 +527,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
apartment1 = assetStorageService.merge(apartment1);
}
- Asset apartment2 = new Asset("Apartment 2", RESIDENCE, smartHome);
+ Asset apartment2 = new Asset("Apartment 2", RESIDENCE, smartBuilding);
apartment2.addAttributes(
new AssetAttribute(AttributeType.LOCATION, locationValueA),
new AssetAttribute("allLightsOffSwitch", AttributeValueType.BOOLEAN, Values.create(true))
@@ -619,7 +624,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
apartment2Bathroom = assetStorageService.merge(apartment2Bathroom);
apartment2BathroomId = apartment2Bathroom.getId();
- Asset apartment3 = new Asset("Apartment 3", RESIDENCE, smartHome)
+ Asset apartment3 = new Asset("Apartment 3", RESIDENCE, smartBuilding)
.addAttributes(new AssetAttribute(AttributeType.LOCATION, locationValueA));
apartment3 = assetStorageService.merge(apartment3);
apartment3Id = apartment3.getId();
@@ -635,19 +640,19 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
// ################################ Link demo users and assets ###################################
- assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.customerATenant.getId(),
+ assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1Id));
- assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.customerATenant.getId(),
+ assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1LivingroomId));
- assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.customerATenant.getId(),
+ assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1KitchenId));
- assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.customerATenant.getId(),
+ assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment1HallwayId));
- assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.customerATenant.getId(),
+ assetStorageService.storeUserAsset(new UserAsset(keycloakDemoSetup.tenantA.getId(),
keycloakDemoSetup.testuser3Id,
apartment2Id));
@@ -656,5 +661,100 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
UserConfiguration testuser3Config = identityService.getUserConfiguration(keycloakDemoSetup.testuser3Id);
testuser3Config.setRestricted(true);
testuser3Config = identityService.mergeUserConfiguration(testuser3Config);
+
+ // ################################ Realm B ###################################
+
+ ObjectValue locationValueB = SMART_CITY_LOCATION.toValue();
+
+
+ Asset smartCity = new Asset();
+ smartCity.setRealmId(realmBTenantId);
+ smartCity.setName("Smart City");
+ smartCity.setType(BUILDING);
+ smartCity.addAttributes(
+ new AssetAttribute(AttributeType.LOCATION, locationValueB),
+
+ new AssetAttribute("geoCity", STRING, Values.create("Eindhoven"))
+ .setMeta(
+ new MetaItem(LABEL, Values.create("City")),
+ new MetaItem(ABOUT, Values.create("http://project-haystack.org/tag/geoCity"))
+ ),
+ new AssetAttribute("geoCountry", STRING, Values.create("Netherlands"))
+ .setMeta(
+ new MetaItem(LABEL, Values.create("Country")),
+ new MetaItem(ABOUT, Values.create("http://project-haystack.org/tag/geoCountry"))
+ )
+ );
+ smartCity = assetStorageService.merge(smartCity);
+
+ Asset smartCityServiceAgent = new Asset("Service Agent (Simulator)", AGENT, smartCity);
+ smartCityServiceAgent.addAttributes(
+ initProtocolConfiguration(new AssetAttribute("citySimulator"), SimulatorProtocol.PROTOCOL_NAME)
+ .addMeta(
+ new MetaItem(
+ SimulatorProtocol.CONFIG_MODE,
+ Values.create(SimulatorProtocol.Mode.WRITE_THROUGH_IMMEDIATE.toString())
+ ))
+ );
+ smartCityServiceAgent = assetStorageService.merge(smartCityServiceAgent);
+ smartCityServiceAgentId = smartCityServiceAgent.getId();
+
+ // ################################ Realm B Area 1 ###################################
+
+ Asset assetArea1 = new Asset("Area 1", THING, smartCity);
+ assetArea1 = assetStorageService.merge(assetArea1);
+
+ Asset camera1Asset = createDemoCameraAsset("Camera1", assetArea1, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ camera1Asset = assetStorageService.merge(camera1Asset);
+
+ Asset microPhone1Asset = createDemoMicrophoneAsset("Microphone1", assetArea1, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ microPhone1Asset = assetStorageService.merge(microPhone1Asset);
+
+ Asset enviroment1Asset = createDemoEnviromentAsset("Enviroment1", assetArea1, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ enviroment1Asset = assetStorageService.merge(enviroment1Asset);
+
+ Asset light1Asset = createDemoLightAsset("Light1", assetArea1);
+ light1Asset = assetStorageService.merge(light1Asset);
+
+ // ################################ Realm B Area 2 ###################################
+
+ Asset assetArea2 = new Asset("Area 2", THING, smartCity);
+ assetArea2 = assetStorageService.merge(assetArea2);
+
+ Asset camera2Asset = createDemoCameraAsset("Camera2", assetArea2, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ camera2Asset = assetStorageService.merge(camera2Asset);
+
+ Asset enviroment2Asset = createDemoEnviromentAsset("Enviroment2", assetArea2, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ enviroment2Asset = assetStorageService.merge(enviroment2Asset);
+
+
+ // ################################ Realm B Area 3 ###################################
+
+ Asset assetArea3 = new Asset("Area 3", THING, smartCity);
+ assetArea3 = assetStorageService.merge(assetArea3);
+
+ Asset camera3Asset = createDemoCameraAsset("Camera3", assetArea3, () -> new MetaItem[]{
+ new MetaItem(AGENT_LINK, new AttributeRef(smartCityServiceAgentId, "citySimulator").toArrayValue()),
+ new MetaItem(SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(NumberSimulatorElement.ELEMENT_NAME))
+ });
+ camera3Asset = assetStorageService.merge(camera3Asset);
+
+ Asset light3Asset = createDemoLightAsset("Light3", assetArea3);
+ light3Asset = assetStorageService.merge(light3Asset);
}
}
\ No newline at end of file
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
index ceef54750..ff4bd4016 100644
--- a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java
@@ -39,7 +39,7 @@ public class RulesDemoSetup extends AbstractManagerSetup {
}
public Long apartmentActionsRulesetId;
- public Long customerARulesetId;
+ public Long tenantARulesetId;
@Override
public void onStart() throws Exception {
@@ -100,9 +100,9 @@ public class RulesDemoSetup extends AbstractManagerSetup {
try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoConsoleLocation.groovy")) {
String rules = IOUtils.toString(inputStream, Charset.forName("utf-8"));
Ruleset ruleset = new TenantRuleset(
- "Demo Console Location", keycloakDemoSetup.customerATenant.getId(), rules, Ruleset.Lang.GROOVY
+ "Demo Console Location", keycloakDemoSetup.tenantA.getId(), rules, Ruleset.Lang.GROOVY
);
- customerARulesetId = rulesetStorageService.merge(ruleset).getId();
+ tenantARulesetId = rulesetStorageService.merge(ruleset).getId();
}
}
}
diff --git a/manager/src/main/resources/demo/rules/DemoConsoleLocation.groovy b/manager/src/main/resources/demo/rules/DemoConsoleLocation.groovy
index bbb713221..b4d0e9899 100644
--- a/manager/src/main/resources/demo/rules/DemoConsoleLocation.groovy
+++ b/manager/src/main/resources/demo/rules/DemoConsoleLocation.groovy
@@ -28,7 +28,7 @@ rules.add()
def consoleIds = facts.matchAssetState(new AssetQuery()
.type(AssetType.CONSOLE)
.attributes(new LocationAttributePredicate(
- new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_HOME_LOCATION.y, ManagerDemoSetup.SMART_HOME_LOCATION.x))))
+ new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_BUILDING_LOCATION.y, ManagerDemoSetup.SMART_BUILDING_LOCATION.x))))
.filter({ !facts.getOptional("welcomeHome" + "_${it.id}").isPresent() })
.map({ it.id })
.collect()
diff --git a/model/src/main/java/org/openremote/model/ValueHolder.java b/model/src/main/java/org/openremote/model/ValueHolder.java
index 74bffae43..9a311aad2 100644
--- a/model/src/main/java/org/openremote/model/ValueHolder.java
+++ b/model/src/main/java/org/openremote/model/ValueHolder.java
@@ -39,7 +39,8 @@ public interface ValueHolder {
VALUE_INVALID_EMAIL_FORMAT,
VALUE_INVALID,
VALUE_MISMATCH,
- VALUE_REQUIRED
+ VALUE_REQUIRED,
+ VALUE_SOUND_OUT_OF_RANGE
}
void clearValue();
diff --git a/model/src/main/java/org/openremote/model/asset/Asset.java b/model/src/main/java/org/openremote/model/asset/Asset.java
index 2fafee1ae..4524e6f2f 100644
--- a/model/src/main/java/org/openremote/model/asset/Asset.java
+++ b/model/src/main/java/org/openremote/model/asset/Asset.java
@@ -94,12 +94,12 @@ import static org.openremote.model.attribute.AttributeType.LOCATION;
* "id": "0oI7Gf_kTh6WyRJFUTr8Lg",
* "version": 0,
* "createdOn": 1489042784142,
- * "name": "Smart Home",
+ * "name": "Smart Building",
* "type": "urn:openremote:asset:building",
* "accessPublicRead": false,
* "realmId": "c38a3fdf-9d74-4dac-940c-50d3dce1d248",
- * "tenantRealm": "customerA",
- * "tenantDisplayName": "Customer A",
+ * "tenantRealm": "tenantA",
+ * "tenantDisplayName": "Tenant A",
* "path": [
* "0oI7Gf_kTh6WyRJFUTr8Lg"
* ],
@@ -118,11 +118,11 @@ import static org.openremote.model.attribute.AttributeType.LOCATION;
* "type": "urn:openremote:asset:residence",
* "accessPublicRead": false,
* "parentId": "0oI7Gf_kTh6WyRJFUTr8Lg",
- * "parentName": "Smart Home",
+ * "parentName": "Smart Building",
* "parentType": "urn:openremote:asset:building",
* "realmId": "c38a3fdf-9d74-4dac-940c-50d3dce1d248",
- * "tenantRealm": "customerA",
- * "tenantDisplayName": "Customer A",
+ * "tenantRealm": "tenantA",
+ * "tenantDisplayName": "Tenant A",
* "path": [
* "B0x8ZOqZQHGjq_l0RxAJBA",
* "0oI7Gf_kTh6WyRJFUTr8Lg"
@@ -145,8 +145,8 @@ import static org.openremote.model.attribute.AttributeType.LOCATION;
* "parentName": "Apartment 1",
* "parentType": "urn:openremote:asset:residence",
* "realmId": "c38a3fdf-9d74-4dac-940c-50d3dce1d248",
- * "tenantRealm": "customerA",
- * "tenantDisplayName": "Customer A",
+ * "tenantRealm": "tenantA",
+ * "tenantDisplayName": "Tenant A",
* "path": [
* "bzlRiJmSSMCl8HIUt9-lMg",
* "B0x8ZOqZQHGjq_l0RxAJBA",
@@ -170,8 +170,8 @@ import static org.openremote.model.attribute.AttributeType.LOCATION;
* "parentName": "Living Room",
* "parentType": "urn:openremote:asset:room",
* "realmId": "c38a3fdf-9d74-4dac-940c-50d3dce1d248",
- * "tenantRealm": "customerA",
- * "tenantDisplayName": "Customer A",
+ * "tenantRealm": "tenantA",
+ * "tenantDisplayName": "Tenant A",
* "path": [
* "W7GV_lFeQVyHLlgHgE3dEQ",
* "bzlRiJmSSMCl8HIUt9-lMg",
diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
index 085aa9db0..9e52a1cd7 100644
--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
@@ -97,6 +97,12 @@ public enum AttributeValueType {
.map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))
),
+ SOUND_DB("file-sound-o", ValueType.NUMBER, value -> Values.getNumber(value)
+ .filter(n -> n < 0)
+ .map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_SOUND_OUT_OF_RANGE)),
+ new MetaItem(FORMAT, Values.create("%d dB"))
+ ),
+
TEMPERATURE_CELCIUS("thermometer", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(n -> n < -273.15)
.map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE)),
diff --git a/profile/deploy.yml b/profile/deploy.yml
index 7a2dda19c..c42f4cdd7 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -53,8 +53,8 @@ services:
# backend service. This can be used to give consoles a vanity domain name.
# PROXY_HOST_REDIRECT_1_NAME: www.my-console-master.tld
# PROXY_HOST_REDIRECT_1_TARGET: /console/master
- # PROXY_HOST_REDIRECT_2_NAME: www.my-console-customer-a.tld
- # PROXY_HOST_REDIRECT_2_TARGET: /console/customerA
+ # PROXY_HOST_REDIRECT_2_NAME: www.my-console-tenant-a.tld
+ # PROXY_HOST_REDIRECT_2_TARGET: /console/tenantA
# PROXY_HOST_REDIRECT_3_NAME: ...
# Customize proxy log, defaults to 'notice', requests are logged at 'info'.
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
index 33aa4e93b..91b6d3e1e 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
@@ -164,11 +164,11 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
assert rowData[0].icon == "group"
assert rowData[0].tenant.id == keycloakDemoSetup.masterTenant.id
assert rowData[1] instanceof TenantTreeNode
- assert rowData[1].label == "Customer A"
- assert rowData[1].tenant.id == keycloakDemoSetup.customerATenant.id
+ assert rowData[1].label == "Tenant A"
+ assert rowData[1].tenant.id == keycloakDemoSetup.tenantA.id
assert rowData[2] instanceof TenantTreeNode
- assert rowData[2].label == "Customer B"
- assert rowData[2].tenant.id == keycloakDemoSetup.customerBTenant.id
+ assert rowData[2].label == "Tenant B"
+ assert rowData[2].tenant.id == keycloakDemoSetup.tenantB.id
}
1 * treeDisplay.setRowCount(3, true)
@@ -400,7 +400,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
collectedSharedEvents.clear()
clientEventService.subscribe(
AssetTreeModifiedEvent.class,
- new TenantFilter(keycloakDemoSetup.customerATenant.id)
+ new TenantFilter(keycloakDemoSetup.tenantA.id)
)
then: "the server should return a failure"
@@ -427,7 +427,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
and: "an authenticated user"
- def realm = keycloakDemoSetup.customerATenant.realm
+ def realm = keycloakDemoSetup.tenantA.realm
def accessToken = {
authenticate(
container,
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 0accfc632..fcd638064 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
@@ -94,7 +94,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
when: "the root assets of the given realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .tenant(new TenantPredicate(keycloakDemoSetup.customerATenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
.parent(new ParentPredicate(true))
)
@@ -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 demoSmartHome = assetResource.get(null, managerDemoSetup.smartHomeId)
+ def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartHomeId)
then: "result should match"
- demoSmartHome.id == managerDemoSetup.smartHomeId
+ demoSmartBuilding.id == managerDemoSetup.smartHomeId
/* ############################################## WRITE ####################################### */
@@ -157,13 +157,13 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
testAsset.parentId == managerDemoSetup.groundFloorId
when: "an asset is moved to a foreign realm and made a root asset"
- testAsset.setRealmId(keycloakDemoSetup.customerATenant.id)
+ testAsset.setRealmId(keycloakDemoSetup.tenantA.id)
testAsset.setParentId(null)
assetResource.update(null, testAsset.id, testAsset)
testAsset = assetResource.get(null, testAsset.getId())
then: "the asset should be updated"
- testAsset.realmId == keycloakDemoSetup.customerATenant.id
+ testAsset.realmId == keycloakDemoSetup.tenantA.id
testAsset.parentId == null
when: "an asset is updated with a new parent in a foreign realm"
@@ -172,7 +172,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
testAsset = assetResource.get(null, testAsset.getId())
then: "the asset should be updated"
- testAsset.realmId == keycloakDemoSetup.customerATenant.id
+ testAsset.realmId == keycloakDemoSetup.tenantA.id
testAsset.parentId == managerDemoSetup.smartHomeId
when: "an asset is deleted in the authenticated realm"
@@ -298,7 +298,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
when: "the root assets of the given realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .tenant(new TenantPredicate(keycloakDemoSetup.customerATenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
.parent(new ParentPredicate(true))
)
@@ -349,7 +349,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
testAsset.parentId == managerDemoSetup.groundFloorId
when: "an asset is moved to a foreign realm and made a root asset"
- testAsset.setRealmId(keycloakDemoSetup.customerATenant.id)
+ testAsset.setRealmId(keycloakDemoSetup.tenantA.id)
testAsset.setParentId(null)
assetResource.update(null, testAsset.id, testAsset)
@@ -411,14 +411,14 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
and: "an authenticated test user"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser2",
"testuser2"
).token
and: "the asset resource"
- def assetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(AssetResource.class)
+ def assetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(AssetResource.class)
/* ############################################## READ ####################################### */
@@ -451,12 +451,12 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
then: "result should match"
assets.length == 1
assets[0].id == managerDemoSetup.smartHomeId
- assets[0].realmId == keycloakDemoSetup.customerATenant.id
+ assets[0].realmId == keycloakDemoSetup.tenantA.id
when: "the root assets of the given realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .tenant(new TenantPredicate(keycloakDemoSetup.customerBTenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantB.id))
.parent(new ParentPredicate(true))
)
@@ -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 demoSmartHome = assetResource.get(null, managerDemoSetup.smartHomeId)
+ def demoSmartBuilding = assetResource.get(null, managerDemoSetup.smartHomeId)
then: "result should match"
- demoSmartHome.id == managerDemoSetup.smartHomeId
+ demoSmartBuilding.id == managerDemoSetup.smartHomeId
when: "an asset is retrieved by ID in a foreign realm"
assetResource.get(null, managerDemoSetup.thingId)
@@ -505,7 +505,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
ex.response.status == 403
when: "an asset is created in the authenticated realm"
- testAsset = new Asset("Test Room", AssetType.ROOM, null, keycloakDemoSetup.customerATenant.id)
+ testAsset = new Asset("Test Room", AssetType.ROOM, null, keycloakDemoSetup.tenantA.id)
assetResource.create(null, testAsset)
then: "access should be forbidden"
@@ -555,14 +555,14 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
and: "an authenticated test user"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser3",
"testuser3"
).token
and: "the asset resource"
- def assetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(AssetResource.class)
+ def assetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(AssetResource.class)
/* ############################################## READ ####################################### */
@@ -575,7 +575,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
apartment1.id == managerDemoSetup.apartment1Id
apartment1.name == "Apartment 1"
apartment1.createdOn.getTime() < System.currentTimeMillis()
- apartment1.realmId == keycloakDemoSetup.customerATenant.id
+ apartment1.realmId == keycloakDemoSetup.tenantA.id
apartment1.type == AssetType.RESIDENCE.value
apartment1.parentId == managerDemoSetup.smartHomeId
apartment1.path == null
@@ -619,7 +619,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
when: "the root assets of the given realm are retrieved"
assets = assetResource.queryAssets(null,
new AssetQuery()
- .tenant(new TenantPredicate(keycloakDemoSetup.customerBTenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantB.id))
.parent(new ParentPredicate(true))
)
@@ -734,7 +734,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
assert testAsset.getName() == "Living Room"
when: "an asset is created in the authenticated realm"
- testAsset = new Asset("Test Room", AssetType.ROOM, null, keycloakDemoSetup.customerATenant.id)
+ testAsset = new Asset("Test Room", AssetType.ROOM, null, keycloakDemoSetup.tenantA.id)
assetResource.create(null, testAsset)
then: "access should be forbidden"
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 ea12ee155..6e5dc1872 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
@@ -22,7 +22,6 @@ import spock.util.concurrent.PollingConditions
import javax.persistence.EntityManager
import java.time.Instant
import java.time.LocalDateTime
-import java.time.ZoneId
import java.time.ZoneOffset
import java.util.function.Function
@@ -157,7 +156,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
then: "result should contain only ids, names and attribute names and label meta"
assets.size() == 11
assets[0].id == managerDemoSetup.smartHomeId
- assets[0].name == "Smart Home"
+ assets[0].name == "Smart Building"
assets[1].id == managerDemoSetup.apartment1Id
assets[1].createdOn == null
assets[1].name == "Apartment 1"
@@ -206,7 +205,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.parentId == managerDemoSetup.smartHomeId
asset.parentName == null
asset.parentType == null
- asset.realmId == keycloakDemoSetup.customerATenant.id
+ asset.realmId == keycloakDemoSetup.tenantA.id
asset.tenantRealm == null
asset.tenantDisplayName == null
asset.path.length == 2
@@ -319,11 +318,11 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets.get(0).name == "Apartment 1"
assets.get(0).wellKnownType == AssetType.RESIDENCE
assets.get(0).parentId == managerDemoSetup.smartHomeId
- assets.get(0).parentName == "Smart Home"
+ assets.get(0).parentName == "Smart Building"
assets.get(0).parentType == AssetType.BUILDING.value
- assets.get(0).realmId == keycloakDemoSetup.customerATenant.id
- assets.get(0).tenantRealm == keycloakDemoSetup.customerATenant.realm
- assets.get(0).tenantDisplayName == keycloakDemoSetup.customerATenant.displayName
+ assets.get(0).realmId == keycloakDemoSetup.tenantA.id
+ assets.get(0).tenantRealm == keycloakDemoSetup.tenantA.realm
+ assets.get(0).tenantDisplayName == keycloakDemoSetup.tenantA.displayName
assets.get(0).path == null
assets.get(0).attributesList.size() == 0
assets.get(1).id == managerDemoSetup.apartment2Id
@@ -333,7 +332,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets = assetStorageService.findAll(
new AssetQuery()
.parent(new ParentPredicate(managerDemoSetup.smartHomeId))
- .tenant(new TenantPredicate(keycloakDemoSetup.customerATenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
)
then: "result should match"
@@ -346,7 +345,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
assets = assetStorageService.findAll(
new AssetQuery()
.parent(new ParentPredicate(managerDemoSetup.smartHomeId))
- .tenant(new TenantPredicate(keycloakDemoSetup.customerATenant.id))
+ .tenant(new TenantPredicate(keycloakDemoSetup.tenantA.id))
.orderBy(new OrderBy(NAME, true))
)
@@ -437,9 +436,10 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
)
then: "result should match"
- assets.size() == 2
+ assets.size() == 3
assets.get(0).id == managerDemoSetup.agentId
assets.get(1).id == managerDemoSetup.apartment1ServiceAgentId
+ assets.get(2).id == managerDemoSetup.smartCityServiceAgentId
when: "a query is executed"
assets = assetStorageService.findAll(new AssetQuery()
@@ -586,9 +586,9 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.parentId != null
asset.parentName == "Apartment 1"
asset.parentType == AssetType.RESIDENCE.getValue()
- asset.realmId == keycloakDemoSetup.customerATenant.id
- asset.tenantRealm == keycloakDemoSetup.customerATenant.realm
- asset.tenantDisplayName == keycloakDemoSetup.customerATenant.displayName
+ asset.realmId == keycloakDemoSetup.tenantA.id
+ asset.tenantRealm == keycloakDemoSetup.tenantA.realm
+ asset.tenantDisplayName == keycloakDemoSetup.tenantA.displayName
asset.path != null
asset.getAttributesList().size() == 3
asset.getAttribute("co2Level").isPresent()
@@ -614,9 +614,9 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
asset.parentId != null
asset.parentName == "Apartment 1"
asset.parentType == AssetType.RESIDENCE.getValue()
- asset.realmId == keycloakDemoSetup.customerATenant.id
- asset.tenantRealm == keycloakDemoSetup.customerATenant.realm
- asset.tenantDisplayName == keycloakDemoSetup.customerATenant.displayName
+ asset.realmId == keycloakDemoSetup.tenantA.id
+ asset.tenantRealm == keycloakDemoSetup.tenantA.realm
+ asset.tenantDisplayName == keycloakDemoSetup.tenantA.displayName
asset.path != null
asset.getAttributesList().size() == 1
asset.getAttribute("co2Level").isPresent()
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 751c32dd1..edc37c06f 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy
@@ -48,59 +48,59 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
identityService.getIdentityProvider().isRestrictedUser(keycloakDemoSetup.testuser3Id)
when: "all user assets are retrieved of a realm"
- def userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, null, null)
+ def userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, null, null)
then: "result should match"
userAssets.length == 5
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1Id &&
it.assetName == "Apartment 1" &&
- it.parentAssetName == "Smart Home" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.parentAssetName == "Smart Building" &&
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1LivingroomId &&
it.assetName == "Living Room" &&
it.parentAssetName == "Apartment 1" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1KitchenId &&
it.assetName == "Kitchen" &&
it.parentAssetName == "Apartment 1" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1HallwayId &&
it.assetName == "Hallway" &&
it.parentAssetName == "Apartment 1" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment2Id &&
it.assetName == "Apartment 2" &&
- it.parentAssetName == "Smart Home" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.parentAssetName == "Smart Building" &&
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
when: "all user assets are retrieved of a realm and user"
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser3Id, null)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser3Id, null)
then: "result should match"
userAssets.length == 5
when: "the realm and user don't match"
- assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerBTenant.id, keycloakDemoSetup.testuser3Id, null)
+ assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantB.id, keycloakDemoSetup.testuser3Id, null)
then: "an error response should be returned"
WebApplicationException ex = thrown()
@@ -114,35 +114,35 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
ex.response.status == 404
when: "all user assets are retrieved of a realm and user"
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, null, managerDemoSetup.apartment1Id)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, null, managerDemoSetup.apartment1Id)
then: "result should match"
userAssets.length == 1
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1Id &&
it.assetName == "Apartment 1" &&
- it.parentAssetName == "Smart Home" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.parentAssetName == "Smart Building" &&
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
when: "all user assets are retrieved of a realm and user and asset"
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1Id)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser3Id, managerDemoSetup.apartment1Id)
then: "result should match"
userAssets.length == 1
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser3Id &&
it.id.assetId == managerDemoSetup.apartment1Id &&
it.assetName == "Apartment 1" &&
- it.parentAssetName == "Smart Home" &&
- it.userFullName == "testuser3 (Testuserfirst Testuserlast)"
+ it.parentAssetName == "Smart Building" &&
+ it.userFullName == "testuser3 (DemoA3 DemoLast)"
}
when: "all user assets are retrieved of a realm and user and asset"
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment1Id)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment1Id)
then: "result should match"
userAssets.length == 0
@@ -150,25 +150,25 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTrai
/* ############################################## WRITE ####################################### */
when: "an asset is linked to a user"
- UserAsset userAsset = new UserAsset(keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment2Id)
+ UserAsset userAsset = new UserAsset(keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment2Id)
assetResource.createUserAsset(null, userAsset)
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser2Id, null)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser2Id, null)
then: "result should match"
userAssets.length == 1
userAssets.any {
- it.id.realmId == keycloakDemoSetup.customerATenant.id &&
+ it.id.realmId == keycloakDemoSetup.tenantA.id &&
it.id.userId == keycloakDemoSetup.testuser2Id &&
it.id.assetId == managerDemoSetup.apartment2Id &&
it.assetName == "Apartment 2" &&
- it.parentAssetName == "Smart Home" &&
- it.userFullName == "testuser2 (Testuserfirst Testuserlast)" &&
+ it.parentAssetName == "Smart Building" &&
+ it.userFullName == "testuser2 (DemoA2 DemoLast)" &&
it.createdOn.time < timerService.currentTimeMillis
}
when: "an asset link is deleted"
- assetResource.deleteUserAsset(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment2Id)
- userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser2Id, null)
+ assetResource.deleteUserAsset(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser2Id, managerDemoSetup.apartment2Id)
+ userAssets = assetResource.getUserAssetLinks(null, keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser2Id, null)
then: "result should match"
userAssets.length == 0
diff --git a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
index 69cc3c411..34e8c5422 100644
--- a/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/console/ConsoleTest.groovy
@@ -4,7 +4,6 @@ import com.google.common.collect.Lists
import com.google.firebase.messaging.Message
import org.openremote.container.util.UniqueIdentifierGenerator
import org.openremote.manager.asset.AssetStorageService
-import org.openremote.manager.notification.NotificationService
import org.openremote.manager.notification.PushNotificationHandler
import org.openremote.manager.rules.RulesEngine
import org.openremote.manager.rules.RulesService
@@ -40,7 +39,7 @@ import javax.ws.rs.WebApplicationException
import java.util.stream.IntStream
import static org.openremote.manager.setup.builtin.ManagerDemoSetup.DEMO_RULE_STATES_CUSTOMER_A
-import static org.openremote.manager.setup.builtin.ManagerDemoSetup.SMART_HOME_LOCATION
+import static org.openremote.manager.setup.builtin.ManagerDemoSetup.SMART_BUILDING_LOCATION
import static org.openremote.model.Constants.KEYCLOAK_CLIENT_ID
import static org.openremote.model.asset.AssetMeta.RULE_STATE
import static org.openremote.model.asset.AssetResource.Util.WRITE_ATTRIBUTE_HTTP_METHOD
@@ -98,8 +97,8 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
and: "the demo location predicate console rules are loaded"
Ruleset ruleset = new TenantRuleset(
- "Demo Customer A - Console Location",
- keycloakDemoSetup.customerATenant.id,
+ "Demo Tenant A - Console Location",
+ keycloakDemoSetup.tenantA.id,
getClass().getResource("/demo/rules/DemoConsoleLocation.groovy").text,
Ruleset.Lang.GROOVY
)
@@ -107,28 +106,28 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
expect: "the rule engine to become available and be running"
conditions.eventually {
- def customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
- assert customerAEngine != null
- assert customerAEngine.isRunning()
- assert customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ def tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
+ assert tenantAEngine != null
+ assert tenantAEngine.isRunning()
+ assert tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
}
and: "an authenticated user"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser3",
"testuser3"
).token
and: "authenticated and anonymous console, rules and asset resources"
- def authenticatedConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(ConsoleResource.class)
- def authenticatedRulesResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(RulesResource.class)
- def authenticatedAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(AssetResource.class)
- def anonymousConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm).proxy(ConsoleResource.class)
- def anonymousRulesResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm).proxy(RulesResource.class)
- def anonymousAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm).proxy(AssetResource.class)
+ def authenticatedConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(ConsoleResource.class)
+ def authenticatedRulesResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(RulesResource.class)
+ def authenticatedAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(AssetResource.class)
+ def anonymousConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm).proxy(ConsoleResource.class)
+ def anonymousRulesResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm).proxy(RulesResource.class)
+ def anonymousAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm).proxy(AssetResource.class)
when: "a console registers with an authenticated user"
def consoleRegistration = new ConsoleRegistration(null,
@@ -180,7 +179,7 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
}.orElse(null) == "23123213ad2313b0897efd"
and: "the console should have been linked to the authenticated user"
- def userAssets = assetStorageService.findUserAssets(keycloakDemoSetup.customerATenant.id, keycloakDemoSetup.testuser3Id, consoleId)
+ def userAssets = assetStorageService.findUserAssets(keycloakDemoSetup.tenantA.id, keycloakDemoSetup.testuser3Id, consoleId)
assert userAssets.size() == 1
assert userAssets.get(0).assetName == "Test Console"
@@ -372,8 +371,8 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
// ex = thrown()
// ex.response.status == 403
- when: "a console's location is updated to be at the smart home"
- authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_HOME_LOCATION.toValue().toJson())
+ when: "a console's location is updated to be at the Smart Building"
+ authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_BUILDING_LOCATION.toValue().toJson())
long timestamp = Long.MAX_VALUE
then: "a welcome home alert should be sent to the console"
@@ -384,8 +383,8 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
timestamp = asset.getAttribute(LOCATION.name).flatMap { it.valueTimestamp }.orElse(Long.MAX_VALUE)
}
- when: "a console's location is updated to be at the smart home again"
- authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_HOME_LOCATION.toValue().toJson())
+ when: "a console's location is updated to be at the Smart Building again"
+ authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_BUILDING_LOCATION.toValue().toJson())
then: "no more alerts should have been sent"
conditions.eventually {
@@ -405,14 +404,14 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
assert asset != null
assert asset.getAttribute(LOCATION.name).flatMap { it.valueTimestamp }.orElse(Long.MIN_VALUE) > timestamp
assert notificationIds.size() == 1
- def customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
- assert customerAEngine != null
- assert customerAEngine.isRunning()
- assert !customerAEngine.facts.getOptional("welcomeHome_${testUser3Console2.id}").isPresent()
+ def tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
+ assert tenantAEngine != null
+ assert tenantAEngine.isRunning()
+ assert !tenantAEngine.facts.getOptional("welcomeHome_${testUser3Console2.id}").isPresent()
}
- when: "a console's location is updated to be at the smart home again"
- authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_HOME_LOCATION.toValue().toJson())
+ when: "a console's location is updated to be at the Smart Building again"
+ authenticatedAssetResource.writeAttributeValue(null, testUser3Console2.id, LOCATION.name, SMART_BUILDING_LOCATION.toValue().toJson())
then: "another alert should have been sent"
conditions.eventually {
@@ -425,7 +424,7 @@ class ConsoleTest extends Specification implements ManagerContainerTrait {
when: "the geofences of a user linked console are requested by the authenticated user"
def geofences = authenticatedRulesResource.getAssetGeofences(null, testUser3Console1.id)
- def expectedLocationPredicate = new RadialGeofencePredicate(100, SMART_HOME_LOCATION.y, SMART_HOME_LOCATION.x)
+ def expectedLocationPredicate = new RadialGeofencePredicate(100, SMART_BUILDING_LOCATION.y, SMART_BUILDING_LOCATION.x)
then: "the welcome home geofence should be retrieved"
assert expectedLocationPredicate.centrePoint.size() == 2
diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy
index 02c3eef16..e969f89c4 100644
--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy
@@ -78,7 +78,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
def consoleResource = (ConsoleResourceImpl)container.getService(WebService.class).getApiSingletons().find {it instanceof ConsoleResourceImpl}
and: "an authenticated test user"
- def realm = keycloakDemoSetup.customerATenant.realm
+ def realm = keycloakDemoSetup.tenantA.realm
def testuser1AccessToken = authenticate(
container,
MASTER_REALM,
@@ -125,7 +125,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
def testuser2NotificationResource = getClientApiTarget(serverUri(serverPort), realm, testuser2AccessToken).proxy(NotificationResource.class)
def testuser3NotificationResource = getClientApiTarget(serverUri(serverPort), realm, testuser3AccessToken).proxy(NotificationResource.class)
def adminNotificationResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, adminAccessToken).proxy(NotificationResource.class)
- def anonymousNotificationResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm).proxy(NotificationResource.class)
+ def anonymousNotificationResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm).proxy(NotificationResource.class)
def testuser1ConsoleResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, testuser1AccessToken).proxy(ConsoleResource.class)
def testuser2ConsoleResource = getClientApiTarget(serverUri(serverPort), realm, testuser2AccessToken).proxy(ConsoleResource.class)
def testuser3ConsoleResource = getClientApiTarget(serverUri(serverPort), realm, testuser3AccessToken).proxy(ConsoleResource.class)
@@ -169,7 +169,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
anonymousConsole.id != null
when: "the admin user sends a push notification to an entire realm"
- notification.targets = new Notification.Targets(Notification.TargetType.TENANT, keycloakDemoSetup.customerATenant.id)
+ notification.targets = new Notification.Targets(Notification.TargetType.TENANT, keycloakDemoSetup.tenantA.id)
adminNotificationResource.sendNotification(null, notification)
then: "all consoles in that realm should have been sent a notification"
@@ -189,7 +189,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
ex.response.status == 403
when: "the admin user sends a notification to a user in a different realm"
- notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.testuser2Id)
+ notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.realmAUser)
advancePseudoClock(1, TimeUnit.HOURS, container)
adminNotificationResource.sendNotification(null, notification)
@@ -197,7 +197,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
notificationIds.size() == 5
when: "a regular user sends a push notification to a user in a different realm"
- notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.testuser2Id)
+ notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.realmAUser)
testuser1NotificationResource.sendNotification(null, notification)
then: "access should be forbidden"
@@ -205,7 +205,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
ex.response.status == 403
when: "a restricted user sends a push notification to another user in the same realm"
- notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.testuser2Id)
+ notification.targets = new Notification.Targets(Notification.TargetType.USER, keycloakDemoSetup.realmAUser)
testuser3NotificationResource.sendNotification(null, notification)
then: "access should be forbidden"
@@ -219,7 +219,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
ex = thrown()
ex.response.status == 403
- when: "the admin user sends a push notification to the console assets in customerA realm"
+ when: "the admin user sends a push notification to the console assets in tenantA realm"
notification.targets = new Notification.Targets(Notification.TargetType.ASSET,
testuser2Console.id,
testuser3Console1.id,
@@ -289,7 +289,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
// Check notification resource
// -----------------------------------------------
- when: "the admin user requests the notifications for customer A consoles"
+ when: "the admin user requests the notifications for Tenant A consoles"
def notifications = []
notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))
notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))
@@ -306,7 +306,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
n.acknowledgedOn == null
} == 19
- when: "the admin user marks a customer A console notification as delivered and requests the notifications for customer A consoles"
+ when: "the admin user marks a Tenant A console notification as delivered and requests the notifications for Tenant A consoles"
adminNotificationResource.notificationDelivered(null, testuser2Console.id, notifications.find {n -> n.targetId == testuser2Console.id}.id)
notifications = []
notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))
@@ -318,7 +318,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
assert notifications.size() == 19
assert notifications.count {n -> n.deliveredOn != null} == 1
- when: "the admin user marks a customer A console notification as delivered and requests the notifications for customer A consoles"
+ when: "the admin user marks a Tenant A console notification as delivered and requests the notifications for Tenant A consoles"
adminNotificationResource.notificationAcknowledged(null, testuser2Console.id, notifications.find {n -> n.targetId == testuser2Console.id && n.deliveredOn != null}.id, Values.create("dismissed"))
notifications = []
notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))
@@ -571,8 +571,8 @@ class NotificationTest extends Specification implements ManagerContainerTrait {
def notification = new Notification(
"Test",
new EmailNotificationMessage().setSubject("Test").setText("Hello world!"),
- new Notification.Targets(Notification.TargetType.TENANT, managerDemoSetup.customerARealmId), null, null)
- notificationService.sendNotification(notification, Notification.Source.TENANT_RULESET, managerDemoSetup.customerARealmId)
+ new Notification.Targets(Notification.TargetType.TENANT, managerDemoSetup.realmATenantId), null, null)
+ notificationService.sendNotification(notification, Notification.Source.TENANT_RULESET, managerDemoSetup.realmATenantId)
then: "the email should have been sent to all tenant users"
conditions.eventually {
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 8fc76f0e2..f8ada6ed3 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
@@ -71,73 +71,73 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
assert rulesService.globalEngine.deployments.values().any({ it.name == "Some more global rules" && it.status == DEPLOYED})
}
- when: "a new tenant rule definition is added to customer A"
+ when: "a new tenant rule definition is added to Tenant A"
ruleset = new TenantRuleset(
- "Some more customerA tenant rules",
- keycloakDemoSetup.customerATenant.id,
+ "Some more tenantA tenant rules",
+ keycloakDemoSetup.tenantA.id,
getClass().getResource("/org/openremote/test/rules/BasicMatchAllAssetStates2.groovy").text,
GROOVY
)
rulesetStorageService.merge(ruleset)
- then: "customer A rules engine should load this definition and restart successfully"
+ then: "Tenant A rules engine should load this definition and restart successfully"
conditions.eventually {
- def customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
- assert customerAEngine != null
- assert customerAEngine.isRunning()
- assert customerAEngine.deployments.size() == 2
- assert customerAEngine.deployments.values().any({ it.name == "Some customerA tenant demo rules" && it.status == DEPLOYED})
- assert customerAEngine.deployments.values().any({ it.name == "Some more customerA tenant rules" && it.status == DEPLOYED})
+ def tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
+ assert tenantAEngine != null
+ assert tenantAEngine.isRunning()
+ assert tenantAEngine.deployments.size() == 2
+ assert tenantAEngine.deployments.values().any({ it.name == "Some tenantA tenant demo rules" && it.status == DEPLOYED})
+ assert tenantAEngine.deployments.values().any({ it.name == "Some more tenantA tenant rules" && it.status == DEPLOYED})
}
- when: "a new tenant rule definition is added to customer B"
+ when: "a new tenant rule definition is added to Tenant B"
ruleset = new TenantRuleset(
- "Some more customerB tenant rules",
- keycloakDemoSetup.customerBTenant.id,
+ "Some more tenantB tenant rules",
+ keycloakDemoSetup.tenantB.id,
getClass().getResource("/org/openremote/test/rules/BasicMatchAllAssetStates2.groovy").text,
GROOVY
)
rulesetStorageService.merge(ruleset)
- then: "a tenant rules engine should be created for customer B and load this definition and start successfully"
+ then: "a tenant rules engine should be created for Tenant B and load this definition and start successfully"
conditions.eventually {
- def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
+ def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
assert rulesService.tenantEngines.size() == 3
- assert customerBEngine != null
- assert customerBEngine.isRunning()
- assert customerBEngine.deployments.size() == 1
- assert customerBEngine.deployments.values().any({ it.name == "Some more customerB tenant rules" && it.status == DEPLOYED})
+ assert tenantBEngine != null
+ assert tenantBEngine.isRunning()
+ assert tenantBEngine.deployments.size() == 1
+ assert tenantBEngine.deployments.values().any({ it.name == "Some more tenantB tenant rules" && it.status == DEPLOYED})
}
- when: "the disabled rule definition for customer B is enabled"
- ruleset = rulesetStorageService.findById(TenantRuleset.class, rulesImport.customerBRulesetId)
+ when: "the disabled rule definition for Tenant B is enabled"
+ ruleset = rulesetStorageService.findById(TenantRuleset.class, rulesImport.tenantBRulesetId)
ruleset.setEnabled(true)
rulesetStorageService.merge(ruleset)
- then: "customer B rule engine should load this definition and restart successfully"
+ then: "Tenant B rule engine should load this definition and restart successfully"
conditions.eventually {
- def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
+ def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
assert rulesService.tenantEngines.size() == 3
- assert customerBEngine != null
- assert customerBEngine.isRunning()
- assert customerBEngine.deployments.size() == 2
- assert customerBEngine.deployments.values().any({ it.name == "Some more customerB tenant rules" && it.status == DEPLOYED})
- assert customerBEngine.deployments.values().any({ it.name == "Some customerB tenant demo rules" && it.status == DEPLOYED})
+ assert tenantBEngine != null
+ assert tenantBEngine.isRunning()
+ assert tenantBEngine.deployments.size() == 2
+ assert tenantBEngine.deployments.values().any({ it.name == "Some more tenantB tenant rules" && it.status == DEPLOYED})
+ assert tenantBEngine.deployments.values().any({ it.name == "Some tenantB tenant demo rules" && it.status == DEPLOYED})
}
- when: "the enabled rule definition for customer B is disabled"
+ when: "the enabled rule definition for Tenant B is disabled"
// TODO: Stop instances of rule definitions being passed around as rules engine nulls the rules property
- ruleset = rulesetStorageService.findById(TenantRuleset.class, rulesImport.customerBRulesetId)
+ ruleset = rulesetStorageService.findById(TenantRuleset.class, rulesImport.tenantBRulesetId)
ruleset.setEnabled(false)
rulesetStorageService.merge(ruleset)
- then: "customer B rule engine should remove it again"
+ then: "Tenant B rule engine should remove it again"
conditions.eventually {
- def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
- assert customerBEngine != null
- assert customerBEngine.isRunning()
- assert customerBEngine.deployments.size() == 1
- assert customerBEngine.deployments.values().any({ it.name == "Some more customerB tenant rules" && it.status == DEPLOYED})
+ def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
+ assert tenantBEngine != null
+ assert tenantBEngine.isRunning()
+ assert tenantBEngine.deployments.size() == 1
+ assert tenantBEngine.deployments.values().any({ it.name == "Some more tenantB tenant rules" && it.status == DEPLOYED})
}
when: "the asset rule definition for apartment 2 is deleted"
@@ -185,17 +185,17 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
}
when: "a tenant is disabled"
- def customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
+ def tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
def apartment3Engine = rulesService.assetEngines.get(managerDemoSetup.apartment3Id)
- def customerATenant = keycloakDemoSetup.customerATenant
- customerATenant.setEnabled(false)
- identityService.getIdentityProvider().updateTenant(new ClientRequestInfo(null, accessToken), customerATenant.getRealm(), customerATenant)
+ def tenantATenant = keycloakDemoSetup.tenantA
+ tenantATenant.setEnabled(false)
+ identityService.getIdentityProvider().updateTenant(new ClientRequestInfo(null, accessToken), tenantATenant.getRealm(), tenantATenant)
then: "the tenants rule engine should stop and all asset rule engines in this realm should also stop"
conditions.eventually {
- assert customerAEngine.isRunning() == false
- assert customerAEngine.deployments.size() == 2
- assert rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id) == null
+ assert tenantAEngine.isRunning() == false
+ assert tenantAEngine.deployments.size() == 2
+ assert rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id) == null
assert apartment3Engine.isRunning() == false
assert apartment3Engine.deployments.size() == 1
assert rulesService.assetEngines.get(managerDemoSetup.apartment3Id) == null
@@ -206,41 +206,41 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
assert rulesService.tenantEngines.size() == 2
assert rulesService.assetEngines.size() == 0
def masterEngine = rulesService.tenantEngines.get(keycloakDemoSetup.masterTenant.id)
- def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
+ def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
assert masterEngine != null
assert masterEngine.isRunning()
- assert customerBEngine != null
- assert customerBEngine.isRunning()
+ assert tenantBEngine != null
+ assert tenantBEngine.isRunning()
}
when: "the disabled tenant is re-enabled"
- customerATenant.setEnabled(true)
- identityService.getIdentityProvider().updateTenant(new ClientRequestInfo(null, accessToken), customerATenant.getRealm(), customerATenant)
+ tenantATenant.setEnabled(true)
+ identityService.getIdentityProvider().updateTenant(new ClientRequestInfo(null, accessToken), tenantATenant.getRealm(), tenantATenant)
then: "the tenants rule engine should start and all asset rule engines from this realm should also start"
conditions.eventually {
- customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
+ tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
apartment3Engine = rulesService.assetEngines.get(managerDemoSetup.apartment3Id)
assert rulesService.tenantEngines.size() == 3
assert rulesService.assetEngines.size() == 1
- assert customerAEngine != null
- assert customerAEngine.isRunning()
- assert customerAEngine.deployments.size() == 2
- assert customerAEngine.deployments.values().any({ it.name == "Some customerA tenant demo rules" && it.status == DEPLOYED})
- assert customerAEngine.deployments.values().any({ it.name == "Some more customerA tenant rules" && it.status == DEPLOYED})
+ assert tenantAEngine != null
+ assert tenantAEngine.isRunning()
+ assert tenantAEngine.deployments.size() == 2
+ assert tenantAEngine.deployments.values().any({ it.name == "Some tenantA tenant demo rules" && it.status == DEPLOYED})
+ assert tenantAEngine.deployments.values().any({ it.name == "Some more tenantA tenant rules" && it.status == DEPLOYED})
assert apartment3Engine.deployments.size() == 1
assert apartment3Engine.deployments.values().any({ it.name == "Some apartment 3 demo rules" && it.status == DEPLOYED})
}
//TODO: Reinstate the tenant delete test once tenant delete mechanism is finalised
// when: "a tenant is deleted"
-// identityService.deleteTenant(accessToken, customerATenant.getRealm())
+// identityService.deleteTenant(accessToken, tenantATenant.getRealm())
//
// then: "the tenants rule engine should stop and all asset rule engines in this realm should also stop"
// conditions.eventually {
-// assert customerAEngine.isRunning() == false
-// assert customerAEngine.allRulesets.length == 0
-// assert rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id) == null
+// assert tenantAEngine.isRunning() == false
+// assert tenantAEngine.allRulesets.length == 0
+// assert rulesService.tenantEngines.get(keycloakDemoSetup.tenantATenant.id) == null
// assert smartHomeEngine.isRunning() == false
// assert smartHomeEngine.allRulesets.length == 0
// assert rulesService.assetEngines.get(managerDemoSetup.smartHomeId) == null
@@ -254,11 +254,11 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
// assert rulesService.tenantEngines.size() == 2
// assert rulesService.assetEngines.size() == 0
// def masterEngine = rulesService.tenantEngines.get(Constants.MASTER_REALM)
-// def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
+// def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantBTenant.id)
// assert masterEngine != null
// assert masterEngine.isRunning()
-// assert customerBEngine != null
-// assert customerBEngine.isRunning()
+// assert tenantBEngine != null
+// assert tenantBEngine.isRunning()
// }
cleanup: "the server should be stopped"
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 0c069989a..6c8ee1159 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesImport.groovy
@@ -18,15 +18,15 @@ class BasicRulesImport {
final Long globalRulesetId
final Long globalRuleset2Id
final Long masterRulesetId
- final Long customerARulesetId
- final Long customerBRulesetId
+ final Long tenantARulesetId
+ final Long tenantBRulesetId
final Long apartment1RulesetId
final Long apartment2RulesetId
final Long apartment3RulesetId
RulesEngine globalEngine
RulesEngine masterEngine
- RulesEngine customerAEngine
+ RulesEngine tenantAEngine
RulesEngine apartment1Engine
RulesEngine apartment2Engine
RulesEngine apartment3Engine
@@ -59,21 +59,21 @@ class BasicRulesImport {
masterRulesetId = rulesetStorageService.merge(ruleset).id
ruleset = new TenantRuleset(
- "Some customerA tenant demo rules",
- keycloakDemoSetup.customerATenant.id,
+ "Some tenantA tenant demo rules",
+ keycloakDemoSetup.tenantA.id,
getClass().getResource("/org/openremote/test/rules/BasicMatchAllAssetStates.groovy").text,
GROOVY
)
- customerARulesetId = rulesetStorageService.merge(ruleset).id
+ tenantARulesetId = rulesetStorageService.merge(ruleset).id
ruleset = new TenantRuleset(
- "Some customerB tenant demo rules",
- keycloakDemoSetup.customerBTenant.id,
+ "Some tenantB tenant demo rules",
+ keycloakDemoSetup.tenantB.id,
getClass().getResource("/org/openremote/test/rules/BasicMatchAllAssetStates.groovy").text,
GROOVY
)
ruleset.setEnabled(false)
- customerBRulesetId = rulesetStorageService.merge(ruleset).id
+ tenantBRulesetId = rulesetStorageService.merge(ruleset).id
ruleset = new AssetRuleset(
"Some apartment 1 demo rules",
@@ -120,15 +120,15 @@ class BasicRulesImport {
assert masterEngine.deployments.size() == 1
assert masterEngine.deployments.values().iterator().next().name == "Some master tenant demo rules"
assert masterEngine.deployments.values().iterator().next().status == DEPLOYED
- customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
- assert customerAEngine != null
- customerAEngine.disableTemporaryFactExpiration = true
- assert customerAEngine.isRunning()
- assert customerAEngine.deployments.size() == 1
- assert customerAEngine.deployments.values().iterator().next().name == "Some customerA tenant demo rules"
- assert customerAEngine.deployments.values().iterator().next().status == DEPLOYED
- def customerBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerBTenant.id)
- assert customerBEngine == null
+ tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
+ assert tenantAEngine != null
+ tenantAEngine.disableTemporaryFactExpiration = true
+ assert tenantAEngine.isRunning()
+ assert tenantAEngine.deployments.size() == 1
+ assert tenantAEngine.deployments.values().iterator().next().name == "Some tenantA tenant demo rules"
+ assert tenantAEngine.deployments.values().iterator().next().status == DEPLOYED
+ def tenantBEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantB.id)
+ assert tenantBEngine == null
assert rulesService.assetEngines.size() == 2
apartment1Engine = rulesService.assetEngines.get(managerDemoSetup.apartment1Id)
@@ -153,7 +153,7 @@ class BasicRulesImport {
void resetRulesFired(RulesEngine... engine) {
// Remove all named facts (those are the only ones inserted by basic test rules)
- Collection<RulesEngine> engines = [globalEngine, masterEngine, customerAEngine, apartment2Engine, apartment3Engine]
+ Collection<RulesEngine> engines = [globalEngine, masterEngine, tenantAEngine, apartment2Engine, apartment3Engine]
engines.addAll(engine)
engines.forEach({ e ->
e.facts.namedFacts.keySet().forEach({ factName ->
@@ -163,7 +163,7 @@ class BasicRulesImport {
}
void assertNoRulesFired(RulesEngine... engine) {
- Collection<RulesEngine> engines = [globalEngine, masterEngine, customerAEngine, apartment2Engine, apartment3Engine]
+ Collection<RulesEngine> engines = [globalEngine, masterEngine, tenantAEngine, apartment2Engine, apartment3Engine]
engines.addAll(engine)
engines.forEach({ e ->
assert e.facts.namedFacts.size() == 0
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 a430db1fa..eb0fc7c11 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
@@ -56,7 +56,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
}
@@ -73,8 +73,8 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
def expectedFiredRules = ["All"]
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, expectedFiredRules)
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, expectedFiredRules)
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, expectedFiredRules)
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, expectedFiredRules)
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -122,14 +122,14 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
}
- when: "a LHS filtering test rule definition is loaded into the smart home asset"
+ when: "a LHS filtering test rule definition is loaded into the Smart Building asset"
def assetRuleset = new AssetRuleset(
- "Some smart home asset rules",
+ "Some Smart Building asset rules",
managerDemoSetup.smartHomeId,
getClass().getResource("/org/openremote/test/rules/BasicSmartHomeMatchAllAssetStates.groovy").text,
Ruleset.Lang.GROOVY
@@ -137,24 +137,24 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
rulesetStorageService.merge(assetRuleset)
RulesEngine smartHomeEngine = null
- then: "the smart home rule engine should have ben created, loaded the new rule definition and facts and started"
+ 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)
assert smartHomeEngine != null
assert smartHomeEngine.isRunning()
assert smartHomeEngine.deployments.size() == 1
assert smartHomeEngine.deployments.values().any({
- it.name == "Some smart home asset rules" && it.status == DEPLOYED
+ it.name == "Some Smart Building asset rules" && it.status == DEPLOYED
})
}
and: "the new rule engine is fully initialised"
conditions.eventually {
- assert smartHomeEngine.assetStates.size() == DEMO_RULE_STATES_SMART_HOME
+ assert smartHomeEngine.assetStates.size() == DEMO_RULE_STATES_SMART_BUILDING
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -173,8 +173,8 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
conditions.eventually {
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -211,7 +211,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
rulesImport.resetRulesFired()
def apartment2 = assetStorageService.find(managerDemoSetup.apartment2Id)
def asset = new Asset("Kitchen", AssetType.ROOM, apartment2)
- asset.setRealmId(keycloakDemoSetup.customerATenant.getId())
+ asset.setRealmId(keycloakDemoSetup.tenantA.getId())
def attributes = [
new AssetAttribute("testString", AttributeValueType.STRING, Values.create("test"))
.setMeta(
@@ -227,15 +227,15 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 1
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 1
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 1
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 1
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2 + 1
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
assertRulesFired(rulesImport.masterEngine, 1)
assertRulesFired(rulesImport.masterEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -258,11 +258,11 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 1
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 1
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 1
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 1
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2 + 1
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
assertRulesFired(rulesImport.globalEngine, 0)
- assertRulesFired(rulesImport.customerAEngine, 0)
+ assertRulesFired(rulesImport.tenantAEngine, 0)
assertRulesFired(rulesImport.apartment2Engine, 0)
assertRulesFired(rulesImport.apartment3Engine, 0)
}
@@ -284,13 +284,13 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -316,13 +316,13 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 2
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL + 2
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 2
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A + 2
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2 + 2
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -337,13 +337,13 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
assert rulesService.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.globalEngine.assetStates.size() == DEMO_RULE_STATES_GLOBAL
assert rulesImport.masterEngine.assetStates.size() == DEMO_RULE_STATES_SMART_OFFICE
- assert rulesImport.customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ assert rulesImport.tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
assert rulesImport.apartment2Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_2
assert rulesImport.apartment3Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_3
assertRulesFired(rulesImport.globalEngine, 1)
assertRulesFired(rulesImport.globalEngine, ["All"])
- assertRulesFired(rulesImport.customerAEngine, 1)
- assertRulesFired(rulesImport.customerAEngine, ["All"])
+ assertRulesFired(rulesImport.tenantAEngine, 1)
+ assertRulesFired(rulesImport.tenantAEngine, ["All"])
assertRulesFired(rulesImport.apartment2Engine, 1)
assertRulesFired(rulesImport.apartment2Engine, ["All"])
assertRulesFired(rulesImport.apartment3Engine, 0)
@@ -375,23 +375,23 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
rulesImport.assertEnginesReady(rulesService, keycloakDemoSetup, managerDemoSetup)
}
- when: "a broken RHS rule is loaded into the customerA engine"
+ when: "a broken RHS rule is loaded into the tenantA engine"
def ruleset = new TenantRuleset(
"Some broken test rules",
- keycloakDemoSetup.customerATenant.id,
+ keycloakDemoSetup.tenantA.id,
getClass().getResource("/org/openremote/test/rules/BasicBrokenRules.groovy").text,
Ruleset.Lang.GROOVY
)
rulesetStorageService.merge(ruleset)
- then: "the customerA engine should not run and the rule engine status should indicate the issue"
+ then: "the tenantA engine should not run and the rule engine status should indicate the issue"
conditions.eventually {
- assert rulesImport.customerAEngine.deployments.size() == 2
- assert !rulesImport.customerAEngine.running
- assert rulesImport.customerAEngine.deployments.values().any({
- it.name == "Some customerA tenant demo rules" && it.status == READY
+ assert rulesImport.tenantAEngine.deployments.size() == 2
+ assert !rulesImport.tenantAEngine.running
+ assert rulesImport.tenantAEngine.deployments.values().any({
+ it.name == "Some tenantA tenant demo rules" && it.status == READY
})
- assert rulesImport.customerAEngine.deployments.values().any({
+ assert rulesImport.tenantAEngine.deployments.values().any({
it.name == "Some broken test rules" && it.status == COMPILATION_ERROR && it.error instanceof RuntimeException
})
}
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 6cbc37011..11dc8ac33 100644
--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
@@ -72,11 +72,11 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ruleDefinitions[0].lang == GROOVY
when: "some tenant rules in a non-authenticated realm are retrieved"
- ruleDefinitions = rulesetResource.getTenantRulesets(null, keycloakDemoSetup.customerATenant.id)
+ ruleDefinitions = rulesetResource.getTenantRulesets(null, keycloakDemoSetup.tenantA.id)
then: "result should match"
ruleDefinitions.length == 1
- ruleDefinitions[0].name == "Some customerA tenant demo rules"
+ ruleDefinitions[0].name == "Some tenantA tenant demo rules"
ruleDefinitions[0].enabled
when: "some asset rules are retrieved"
@@ -198,9 +198,9 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 404
when: "a tenant ruleset is created in a non-authenticated realm"
- tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerATenant.id, "SomeRulesCode", GROOVY)
+ tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantA.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
- rulesetId = rulesetResource.getTenantRulesets(null, keycloakDemoSetup.customerATenant.id)[1].id
+ rulesetId = rulesetResource.getTenantRulesets(null, keycloakDemoSetup.tenantA.id)[1].id
tenantRuleset = rulesetResource.getTenantRuleset(null, rulesetId)
lastModified = tenantRuleset.lastModified
@@ -211,7 +211,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
lastModified.time < System.currentTimeMillis()
tenantRuleset.name == "Test tenant definition"
tenantRuleset.rules == "SomeRulesCode"
- tenantRuleset.realmId == keycloakDemoSetup.customerATenant.id
+ tenantRuleset.realmId == keycloakDemoSetup.tenantA.id
when: "an asset ruleset is created in the authenticated realm"
def assetRuleset = new AssetRuleset("Test asset definition", managerDemoSetup.smartOfficeId, "SomeRulesCode", GROOVY)
@@ -343,7 +343,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ruleDefinitions[0].name == "Some master tenant demo rules"
when: "some tenant rules in a non-authenticated realm are retrieved"
- rulesetResource.getTenantRulesets(null, keycloakDemoSetup.customerATenant.id)
+ rulesetResource.getTenantRulesets(null, keycloakDemoSetup.tenantA.id)
then: "access should be forbidden"
ex = thrown()
@@ -444,7 +444,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 404
when: "a tenant ruleset is created in a non-authenticated realm"
- tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerATenant.id, "SomeRulesCode", GROOVY)
+ tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantA.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
then: "access should be forbidden"
@@ -542,14 +542,14 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
and: "an authenticated test user"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser2",
"testuser2"
).token
and: "the ruleset resource"
- def rulesetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(RulesResource.class)
+ def rulesetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(RulesResource.class)
expect: "the rules engines to be ready"
new PollingConditions(initialDelay: 3, timeout: 20, delay: 1).eventually {
@@ -573,7 +573,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "some tenant rules in the authenticated realm are retrieved"
- rulesetResource.getTenantRulesets(null, keycloakDemoSetup.customerATenant.id)
+ rulesetResource.getTenantRulesets(null, keycloakDemoSetup.tenantA.id)
then: "access should be forbidden"
ex = thrown()
@@ -611,7 +611,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "a tenant ruleset is created in the authenticated realm"
- def tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerATenant.id, "SomeRulesCode", GROOVY)
+ def tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantA.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
then: "access should be forbidden"
@@ -633,7 +633,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "a tenant ruleset is created in a non-authenticated realm"
- tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerBTenant.id, "SomeRulesCode", GROOVY)
+ tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantB.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
then: "access should be forbidden"
@@ -641,7 +641,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "a tenant ruleset is created in the authenticated realm"
- def assetRuleset = new AssetRuleset("Test asset definition", keycloakDemoSetup.customerATenant.id, "SomeRulesCode", GROOVY)
+ def assetRuleset = new AssetRuleset("Test asset definition", keycloakDemoSetup.tenantA.id, "SomeRulesCode", GROOVY)
rulesetResource.createAssetRuleset(null, assetRuleset)
then: "access should be forbidden"
@@ -663,7 +663,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "a tenant ruleset is created in a non-authenticated realm"
- assetRuleset = new AssetRuleset("Test asset definition", keycloakDemoSetup.customerBTenant.id, "SomeRulesCode", GROOVY)
+ assetRuleset = new AssetRuleset("Test asset definition", keycloakDemoSetup.tenantB.id, "SomeRulesCode", GROOVY)
rulesetResource.createAssetRuleset(null, assetRuleset)
then: "access should be forbidden"
@@ -690,14 +690,14 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
and: "an authenticated test user"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser3",
"testuser3"
).token
and: "the ruleset resource"
- def rulesetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(RulesResource.class)
+ def rulesetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(RulesResource.class)
expect: "the rules engines to be ready"
new PollingConditions(initialDelay: 3, timeout: 20, delay: 1).eventually {
@@ -721,7 +721,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "some tenant rules in the authenticated realm are retrieved"
- rulesetResource.getTenantRulesets(null, keycloakDemoSetup.customerATenant.id)
+ rulesetResource.getTenantRulesets(null, keycloakDemoSetup.tenantA.id)
then: "access should be forbidden"
ex = thrown()
@@ -766,7 +766,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 403
when: "a tenant ruleset is created in the authenticated realm"
- def tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerATenant.id, "SomeRulesCode", GROOVY)
+ def tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantA.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
then: "access should be forbidden"
@@ -789,7 +789,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
ex.response.status == 404
when: "a tenant ruleset is created in a non-authenticated realm"
- tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.customerBTenant.id, "SomeRulesCode", GROOVY)
+ tenantRuleset = new TenantRuleset("Test tenant definition", keycloakDemoSetup.tenantB.id, "SomeRulesCode", GROOVY)
rulesetResource.createTenantRuleset(null, tenantRuleset)
then: "access should be forbidden"
diff --git a/test/src/test/groovy/org/openremote/test/rules/residence/JsonRulesTest.groovy b/test/src/test/groovy/org/openremote/test/rules/residence/JsonRulesTest.groovy
index c01efb42a..67aff4815 100644
--- a/test/src/test/groovy/org/openremote/test/rules/residence/JsonRulesTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/residence/JsonRulesTest.groovy
@@ -4,7 +4,6 @@ import com.google.common.collect.Lists
import com.google.firebase.messaging.Message
import org.openremote.container.timer.TimerService
import org.openremote.manager.asset.AssetStorageService
-import org.openremote.manager.notification.NotificationService
import org.openremote.manager.notification.PushNotificationHandler
import org.openremote.manager.rules.RulesEngine
import org.openremote.manager.rules.RulesService
@@ -21,7 +20,6 @@ import org.openremote.model.geo.GeoJSONPoint
import org.openremote.model.notification.AbstractNotificationMessage
import org.openremote.model.notification.Notification
import org.openremote.model.notification.NotificationSendResult
-import org.openremote.model.notification.PushNotificationMessage
import org.openremote.model.rules.Ruleset
import org.openremote.model.rules.TenantRuleset
import org.openremote.model.value.ObjectValue
@@ -72,12 +70,12 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
def rulesetStorageService = container.getService(RulesetStorageService.class)
def timerService = container.getService(TimerService.class)
def assetStorageService = container.getService(AssetStorageService.class)
- RulesEngine customerAEngine
+ RulesEngine tenantAEngine
and: "some rules"
Ruleset ruleset = new TenantRuleset(
"Demo Apartment - All Lights Off",
- keycloakDemoSetup.customerATenant.id,
+ keycloakDemoSetup.tenantA.id,
getClass().getResource("/org/openremote/test/rules/BasicJsonRules.json").text,
Ruleset.Lang.JSON
)
@@ -85,10 +83,10 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
expect: "the rule engines to become available and be running with asset states inserted"
conditions.eventually {
- customerAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerATenant.id)
- assert customerAEngine != null
- assert customerAEngine.isRunning()
- assert customerAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
+ tenantAEngine = rulesService.tenantEngines.get(keycloakDemoSetup.tenantA.id)
+ assert tenantAEngine != null
+ assert tenantAEngine.isRunning()
+ assert tenantAEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_A
}
and: "the room lights in an apartment to be on"
@@ -102,15 +100,15 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
when: "a user authenticates"
def accessToken = authenticate(
container,
- keycloakDemoSetup.customerATenant.realm,
+ keycloakDemoSetup.tenantA.realm,
KEYCLOAK_CLIENT_ID,
"testuser3",
"testuser3"
).token
and: "a console is registered by that user"
- def authenticatedConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(ConsoleResource.class)
- def authenticatedAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.customerATenant.realm, accessToken).proxy(AssetResource.class)
+ def authenticatedConsoleResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(ConsoleResource.class)
+ def authenticatedAssetResource = getClientApiTarget(serverUri(serverPort), keycloakDemoSetup.tenantA.realm, accessToken).proxy(AssetResource.class)
def consoleRegistration = new ConsoleRegistration(null,
"Test Console",
"1.0",
@@ -139,7 +137,7 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
assert consoleRegistration.id != null
when: "the console location is set to the apartment"
- authenticatedAssetResource.writeAttributeValue(null, consoleRegistration.id, LOCATION.name, ManagerDemoSetup.SMART_HOME_LOCATION.toValue().toJson())
+ authenticatedAssetResource.writeAttributeValue(null, consoleRegistration.id, LOCATION.name, ManagerDemoSetup.SMART_BUILDING_LOCATION.toValue().toJson())
then: "the consoles location should have been updated"
conditions.eventually {
@@ -149,16 +147,16 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
GeoJSONPoint.fromValue(it)
}.orElse(null)
assert assetLocation != null
- assert assetLocation.x == ManagerDemoSetup.SMART_HOME_LOCATION.x
- assert assetLocation.y == ManagerDemoSetup.SMART_HOME_LOCATION.y
- assert assetLocation.z == ManagerDemoSetup.SMART_HOME_LOCATION.z
+ assert assetLocation.x == ManagerDemoSetup.SMART_BUILDING_LOCATION.x
+ assert assetLocation.y == ManagerDemoSetup.SMART_BUILDING_LOCATION.y
+ assert assetLocation.z == ManagerDemoSetup.SMART_BUILDING_LOCATION.z
}
then: "the console location asset state should be in the rule engine"
conditions.eventually {
- assert customerAEngine.assetStates.find {
+ assert tenantAEngine.assetStates.find {
it.id == consoleRegistration.id && it.value.flatMap { GeoJSONPoint.fromValue(it) }.map {
- it.x == ManagerDemoSetup.SMART_HOME_LOCATION.x && it.y == ManagerDemoSetup.SMART_HOME_LOCATION.y ? it : null
+ it.x == ManagerDemoSetup.SMART_BUILDING_LOCATION.x && it.y == ManagerDemoSetup.SMART_BUILDING_LOCATION.y ? it : null
}.isPresent()
} != null
}
@@ -182,7 +180,7 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
and: "the rule reset fact should have been created"
conditions.eventually {
- assert customerAEngine.facts.getOptional("Test Rule_" + consoleRegistration.id + "_location").isPresent()
+ assert tenantAEngine.facts.getOptional("Test Rule_" + consoleRegistration.id + "_location").isPresent()
}
and: "after a few seconds the rule should not have fired again"
@@ -191,11 +189,11 @@ class JsonRulesTest extends Specification implements ManagerContainerTrait {
}
when: "the console device moves back inside the home geofence (as defined in the rule)"
- authenticatedAssetResource.writeAttributeValue(null, consoleRegistration.id, LOCATION.name, ManagerDemoSetup.SMART_HOME_LOCATION.toValue().toJson())
+ authenticatedAssetResource.writeAttributeValue(null, consoleRegistration.id, LOCATION.name, ManagerDemoSetup.SMART_BUILDING_LOCATION.toValue().toJson())
then: "the rule reset fact should be removed"
conditions.eventually {
- assert !customerAEngine.facts.getOptional("Test Rule_" + consoleRegistration.id + "_location").isPresent()
+ assert !tenantAEngine.facts.getOptional("Test Rule_" + consoleRegistration.id + "_location").isPresent()
}
when: "the console device moves outside the home geofence again (as defined in the rule)"
diff --git a/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceNotifyAlarmTriggerTest.groovy b/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceNotifyAlarmTriggerTest.groovy
index 8d158e4f0..6617ac7a2 100644
--- a/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceNotifyAlarmTriggerTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/rules/residence/ResidenceNotifyAlarmTriggerTest.groovy
@@ -100,7 +100,7 @@ class ResidenceNotifyAlarmTriggerTest extends Specification implements ManagerCo
assert !livingRoomAsset.getAttribute("presenceDetected").orElse(null).valueAsBoolean.orElse(null)
and: "an authenticated test user"
- def realm = "customerA"
+ def realm = "tenantA"
def accessToken = authenticate(
container,
realm,
diff --git a/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates.groovy b/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates.groovy
index febc098df..070ac2d8f 100644
--- a/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates.groovy
+++ b/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates.groovy
@@ -25,7 +25,7 @@ rules.add()
.name("Duplicate radial location predicate")
.when(
{ facts ->
- facts.matchFirstAssetState(new AssetQuery().attributes(new LocationAttributePredicate(new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_HOME_LOCATION.y, ManagerDemoSetup.SMART_HOME_LOCATION.x)))).isPresent() &&
+ facts.matchFirstAssetState(new AssetQuery().attributes(new LocationAttributePredicate(new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_BUILDING_LOCATION.y, ManagerDemoSetup.SMART_BUILDING_LOCATION.x)))).isPresent() &&
!facts.matchFirst("DuplicateLocation").isPresent()
})
.then(
diff --git a/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates2.groovy b/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates2.groovy
index 00c30927d..c83de786d 100644
--- a/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates2.groovy
+++ b/test/src/test/resources/org/openremote/test/rules/BasicLocationPredicates2.groovy
@@ -25,7 +25,7 @@ rules.add()
.name("Duplicate radial location predicate")
.when(
{ facts ->
- facts.matchFirstAssetState(new AssetQuery().attributes(new LocationAttributePredicate(new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_HOME_LOCATION.y, ManagerDemoSetup.SMART_HOME_LOCATION.x)))).isPresent() &&
+ facts.matchFirstAssetState(new AssetQuery().attributes(new LocationAttributePredicate(new RadialGeofencePredicate(100, ManagerDemoSetup.SMART_BUILDING_LOCATION.y, ManagerDemoSetup.SMART_BUILDING_LOCATION.x)))).isPresent() &&
!facts.matchFirst("Location").isPresent()
})
.then(
diff --git a/ui/app/customerA/smart-home/smart-home-body.html b/ui/app/customerA/smart-home/smart-home-body.html
deleted file mode 100644
index 66954a681..000000000
--- a/ui/app/customerA/smart-home/smart-home-body.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-
-<dom-module id="smart-home-body">
- <template>
- <style include="smart-home-style">
- </style>
-
- <slot></slot>
-
- </template>
-
- <script>
- class SmartHomeBody extends SmartHomeComponent {
- static get is() {
- return "smart-home-body";
- }
-
- ready() {
- super.ready();
- this.shadowRoot.host.classList.add("scroll", "layout", "vertical");
- }
- }
-
- defineAppElement(SmartHomeBody, SmartHomeBody.is, "SmartHomeBody");
- </script>
-
-</dom-module>
diff --git a/ui/app/customerA-new/build.gradle b/ui/app/realmA-new/build.gradle
similarity index 100%
rename from ui/app/customerA-new/build.gradle
rename to ui/app/realmA-new/build.gradle
diff --git a/ui/app/customerA-new/index.html b/ui/app/realmA-new/index.html
similarity index 93%
rename from ui/app/customerA-new/index.html
rename to ui/app/realmA-new/index.html
index 9fffdefc9..beb93acdf 100644
--- a/ui/app/customerA-new/index.html
+++ b/ui/app/realmA-new/index.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Customer A</title>
+ <title>Tenant A</title>
</head>
<body>
<h1>The OpenRemote console application of the <code>master</code> tenant</h1>
diff --git a/ui/app/customerA-new/package.json b/ui/app/realmA-new/package.json
similarity index 95%
rename from ui/app/customerA-new/package.json
rename to ui/app/realmA-new/package.json
index e47b54b3e..a4a6cb881 100644
--- a/ui/app/customerA-new/package.json
+++ b/ui/app/realmA-new/package.json
@@ -1,5 +1,5 @@
{
- "name": "@openremote/app-customerA",
+ "name": "@openremote/app-tenantA",
"version": "1.0.0",
"description": "Built in demo console application",
"private": true,
diff --git a/ui/app/customerA/.bowerrc b/ui/app/realmA/.bowerrc
similarity index 100%
rename from ui/app/customerA/.bowerrc
rename to ui/app/realmA/.bowerrc
diff --git a/ui/app/customerA/build.gradle b/ui/app/realmA/build.gradle
similarity index 100%
rename from ui/app/customerA/build.gradle
rename to ui/app/realmA/build.gradle
diff --git a/ui/app/customerA/index.html b/ui/app/realmA/index.html
similarity index 75%
rename from ui/app/customerA/index.html
rename to ui/app/realmA/index.html
index 8adb2e53d..33308eb4e 100644
--- a/ui/app/customerA/index.html
+++ b/ui/app/realmA/index.html
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>OpenRemote SmartHome Example</title>
+ <title>OpenRemote SmartBuilding Example</title>
<!-- Some sensible meta tags -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
@@ -9,14 +9,14 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
- <!-- The language of the SmartHome app -->
+ <!-- The language of the SmartBuilding app -->
<meta name="or-language" content="en">
<!-- ############## Required: Load WebComponents polyfill and components ############### -->
<script src="/static/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
- <!-- Load the SmartHome app -->
- <link rel="import" href="/console/customerA/smart-home/smart-home-app.html">
+ <!-- Load the SmartBuilding app -->
+ <link rel="import" href="/console/tenantA/smart-building/smart-building-app.html">
<style type="text/css">
/* Recommended: Avoid flickering during loading/styling by hiding children of or-app */
@@ -24,7 +24,7 @@
visibility: hidden;
}
- /* Styles for the SmartHome app */
+ /* Styles for the SmartBuilding app */
html, body {
margin: 0;
min-height: 100vh;
@@ -41,13 +41,13 @@
<body>
-<or-app login tenant-realm="customerA" console-auto-enable="true">
+<or-app login tenant-realm="tenantA" console-auto-enable="true">
- <smart-home-app>
+ <smart-building-app>
<!-- You can override the logo
<img slot="logo" height="20" src="mylogo.png"/>
-->
- </smart-home-app>
+ </smart-building-app>
</or-app>
diff --git a/ui/app/customerA/package.json b/ui/app/realmA/package.json
similarity index 81%
rename from ui/app/customerA/package.json
rename to ui/app/realmA/package.json
index 98e291a67..06988745f 100644
--- a/ui/app/customerA/package.json
+++ b/ui/app/realmA/package.json
@@ -2,7 +2,7 @@
"name": "smarthome-example",
"version": "3.0.0",
"homepage": "http://openremote.com/",
- "description": "OpenRemote SmartHome Example App",
+ "description": "OpenRemote SmartBuilding Example App",
"main": "index.html",
"author": "OpenRemote",
"license": "AGPL-3.0-or-later",
diff --git a/ui/app/customerA/smart-home/img/co2.png b/ui/app/realmA/smart-building/img/co2.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/co2.png
rename to ui/app/realmA/smart-building/img/co2.png
diff --git a/ui/app/customerA/smart-home/img/eye.png b/ui/app/realmA/smart-building/img/eye.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/eye.png
rename to ui/app/realmA/smart-building/img/eye.png
diff --git a/ui/app/customerA/smart-home/img/eye_large.png b/ui/app/realmA/smart-building/img/eye_large.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/eye_large.png
rename to ui/app/realmA/smart-building/img/eye_large.png
diff --git a/ui/app/customerA/smart-home/img/eye_large_active.png b/ui/app/realmA/smart-building/img/eye_large_active.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/eye_large_active.png
rename to ui/app/realmA/smart-building/img/eye_large_active.png
diff --git a/ui/app/customerA/smart-home/img/home_large_energy.png b/ui/app/realmA/smart-building/img/home_large_energy.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/home_large_energy.png
rename to ui/app/realmA/smart-building/img/home_large_energy.png
diff --git a/ui/app/customerA/smart-home/img/home_on.png b/ui/app/realmA/smart-building/img/home_on.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/home_on.png
rename to ui/app/realmA/smart-building/img/home_on.png
diff --git a/ui/app/customerA/smart-home/img/humidity.png b/ui/app/realmA/smart-building/img/humidity.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/humidity.png
rename to ui/app/realmA/smart-building/img/humidity.png
diff --git a/ui/app/customerA/smart-home/img/star.png b/ui/app/realmA/smart-building/img/star.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/star.png
rename to ui/app/realmA/smart-building/img/star.png
diff --git a/ui/app/customerA/smart-home/img/temperature.png b/ui/app/realmA/smart-building/img/temperature.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/temperature.png
rename to ui/app/realmA/smart-building/img/temperature.png
diff --git a/ui/app/customerA/smart-home/img/ventilation.png b/ui/app/realmA/smart-building/img/ventilation.png
similarity index 100%
rename from ui/app/customerA/smart-home/img/ventilation.png
rename to ui/app/realmA/smart-building/img/ventilation.png
diff --git a/ui/app/customerA/smart-home/locales.json b/ui/app/realmA/smart-building/locales.json
similarity index 100%
rename from ui/app/customerA/smart-home/locales.json
rename to ui/app/realmA/smart-building/locales.json
diff --git a/ui/app/customerA/smart-home/smart-home-app.html b/ui/app/realmA/smart-building/smart-home-app.html
similarity index 82%
rename from ui/app/customerA/smart-home/smart-home-app.html
rename to ui/app/realmA/smart-building/smart-home-app.html
index a199945fc..4b27f5dfe 100644
--- a/ui/app/customerA/smart-home/smart-home-app.html
+++ b/ui/app/realmA/smart-building/smart-home-app.html
@@ -3,19 +3,19 @@
<!-- You can add other dependencies in package.json and then load them here -->
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-header.html">
-<link rel="import" href="smart-home-body.html">
-<link rel="import" href="smart-home-scenes.html">
-<link rel="import" href="smart-home-energy.html">
-<link rel="import" href="smart-home-security.html">
-<link rel="import" href="smart-home-climate.html">
-<link rel="import" href="smart-home-settings.html">
-
-<dom-module id="smart-home-app">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-header.html">
+<link rel="import" href="smart-building-body.html">
+<link rel="import" href="smart-building-scenes.html">
+<link rel="import" href="smart-building-energy.html">
+<link rel="import" href="smart-building-security.html">
+<link rel="import" href="smart-building-climate.html">
+<link rel="import" href="smart-building-settings.html">
+
+<dom-module id="smart-building-app">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
:host {
min-height: 100vh;
}
@@ -23,7 +23,7 @@
<app-location use-hash-as-path route="{{appLocation}}"></app-location>
- <smart-home-header active-nav="[[view]]" hide-nav$="[[isActiveView(view, 'settings')]]">
+ <smart-building-header active-nav="[[view]]" hide-nav$="[[isActiveView(view, 'settings')]]">
<template is="dom-if" if="[[!isActiveView(view, 'settings')]]">
<slot slot="leftItem"
@@ -55,35 +55,35 @@
</div>
</template>
- </smart-home-header>
+ </smart-building-header>
- <smart-home-body>
+ <smart-building-body>
- <smart-home-scenes hidden$="[[!isActiveView(view, 'scenes')]]"
- residence="[[residence]]"></smart-home-scenes>
+ <smart-building-scenes hidden$="[[!isActiveView(view, 'scenes')]]"
+ residence="[[residence]]"></smart-building-scenes>
- <smart-home-energy hidden$="[[!isActiveView(view, 'energy')]]"
+ <smart-building-energy hidden$="[[!isActiveView(view, 'energy')]]"
residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-energy>
+ rooms="[[rooms]]"></smart-building-energy>
- <smart-home-security hidden$="[[!isActiveView(view, 'security')]]"
+ <smart-building-security hidden$="[[!isActiveView(view, 'security')]]"
residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-security>
+ rooms="[[rooms]]"></smart-building-security>
- <smart-home-climate hidden$="[[!isActiveView(view, 'climate')]]"
+ <smart-building-climate hidden$="[[!isActiveView(view, 'climate')]]"
residence="[[residence]]"
- rooms="[[rooms]]"></smart-home-climate>
+ rooms="[[rooms]]"></smart-building-climate>
- <smart-home-settings hidden$="[[!isActiveView(view, 'settings')]]"
- residence="[[residence]]"></smart-home-settings>
+ <smart-building-settings hidden$="[[!isActiveView(view, 'settings')]]"
+ residence="[[residence]]"></smart-building-settings>
- </smart-home-body>
+ </smart-building-body>
</template>
<script>
- class SmartHomeApp extends SmartHomeComponent {
+ class SmartBuildingApp extends SmartBuildingComponent {
static get is() {
- return "smart-home-app";
+ return "smart-building-app";
}
static get properties() {
@@ -182,7 +182,7 @@
}
}
- defineAppElement(SmartHomeApp, SmartHomeApp.is, "SmartHomeApp");
+ defineAppElement(SmartBuildingApp, SmartBuildingApp.is, "SmartBuildingApp");
</script>
</dom-module>
diff --git a/ui/app/realmA/smart-building/smart-home-body.html b/ui/app/realmA/smart-building/smart-home-body.html
new file mode 100644
index 000000000..39fce8977
--- /dev/null
+++ b/ui/app/realmA/smart-building/smart-home-body.html
@@ -0,0 +1,28 @@
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+
+<dom-module id="smart-building-body">
+ <template>
+ <style include="smart-building-style">
+ </style>
+
+ <slot></slot>
+
+ </template>
+
+ <script>
+ class SmartBuildingBody extends SmartBuildingComponent {
+ static get is() {
+ return "smart-building-body";
+ }
+
+ ready() {
+ super.ready();
+ this.shadowRoot.host.classList.add("scroll", "layout", "vertical");
+ }
+ }
+
+ defineAppElement(SmartBuildingBody, SmartBuildingBody.is, "SmartBuildingBody");
+ </script>
+
+</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-climate.html b/ui/app/realmA/smart-building/smart-home-climate.html
similarity index 88%
rename from ui/app/customerA/smart-home/smart-home-climate.html
rename to ui/app/realmA/smart-building/smart-home-climate.html
index 076b6b662..e4836599c 100644
--- a/ui/app/customerA/smart-home/smart-home-climate.html
+++ b/ui/app/realmA/smart-building/smart-home-climate.html
@@ -1,12 +1,12 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
-<link rel="import" href="smart-home-smart.html">
-<link rel="import" href="smart-home-temperature-select.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
+<link rel="import" href="smart-building-smart.html">
+<link rel="import" href="smart-building-temperature-select.html">
-<dom-module id="smart-home-climate">
+<dom-module id="smart-building-climate">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.roomLabel {
padding: 0 10px;
@@ -29,23 +29,23 @@
}
</style>
- <smart-home-smart residence="[[residence]]"></smart-home-smart>
+ <smart-building-smart residence="[[residence]]"></smart-building-smart>
- <smart-home-section>
+ <smart-building-section>
<template is="dom-repeat" items="[[roomsTemperature]]">
<div class="layout horizontal center roomItem">
<div class="layout vertical center-center">
- <img height="30" src="smart-home/img/temperature.png"/>
+ <img height="30" src="smart-building/img/temperature.png"/>
</div>
<div class="flex layout horizontal center roomLabel">
[[localize(item.roomName)]]
</div>
<template is="dom-if" if="[[item.roomHasTargetTemperature]]">
<div class="targetTemperature">
- <smart-home-temperature-select
+ <smart-building-temperature-select
temperature="[[item.targetTemperature]]"
on-change="onTargetTemperatureChange"
- temperature-format="[[item.targetTemperatureFormat]]"></smart-home-temperature-select>
+ temperature-format="[[item.targetTemperatureFormat]]"></smart-building-temperature-select>
</div>
</template>
<template is="dom-if" if="[[item.roomHasCurrentTemperature]]">
@@ -55,13 +55,13 @@
</template>
</div>
</template>
- </smart-home-section>
+ </smart-building-section>
- <smart-home-section>
+ <smart-building-section>
<template is="dom-repeat" items="[[roomsCO2]]">
<div class="layout horizontal center roomItem">
<div class="layout vertical center-center">
- <img height="30" src="smart-home/img/co2.png"/>
+ <img height="30" src="smart-building/img/co2.png"/>
</div>
<div class="flex layout horizontal center roomLabel">
[[localize(item.roomName)]]
@@ -71,13 +71,13 @@
</div>
</div>
</template>
- </smart-home-section>
+ </smart-building-section>
- <smart-home-section>
+ <smart-building-section>
<template is="dom-repeat" items="[[roomsHumidity]]">
<div class="layout horizontal center roomItem">
<div class="layout vertical center-center">
- <img height="30" src="smart-home/img/humidity.png"/>
+ <img height="30" src="smart-building/img/humidity.png"/>
</div>
<div class="flex layout horizontal center roomLabel">
[[localize(item.roomName)]]
@@ -87,13 +87,13 @@
</div>
</div>
</template>
- </smart-home-section>
+ </smart-building-section>
<template is="dom-if" if="[[ventilationMode]]">
- <smart-home-section>
+ <smart-building-section>
<div class="layout horizontal center ventilationItem">
<div class="layout vertical center-center">
- <img height="30" src="smart-home/img/ventilation.png"/>
+ <img height="30" src="smart-building/img/ventilation.png"/>
</div>
<div class="flex layout horizontal ventilationLabel">
[[localize('Ventilation')]]
@@ -110,15 +110,15 @@
</div>
</div>
</div>
- </smart-home-section>
+ </smart-building-section>
</template>
</template>
<script>
- class SmartHomeClimate extends SmartHomeComponent {
+ class SmartBuildingClimate extends SmartBuildingComponent {
static get is() {
- return "smart-home-climate";
+ return "smart-building-climate";
}
static get properties() {
@@ -267,7 +267,7 @@
}
}
- defineAppElement(SmartHomeClimate, SmartHomeClimate.is, "SmartHomeClimate");
+ defineAppElement(SmartBuildingClimate, SmartBuildingClimate.is, "SmartBuildingClimate");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-component.html b/ui/app/realmA/smart-building/smart-home-component.html
similarity index 72%
rename from ui/app/customerA/smart-home/smart-home-component.html
rename to ui/app/realmA/smart-building/smart-home-component.html
index 7f7c7e769..9cb4483e9 100644
--- a/ui/app/customerA/smart-home/smart-home-component.html
+++ b/ui/app/realmA/smart-building/smart-home-component.html
@@ -1,6 +1,6 @@
-<dom-module id="smart-home-component">
+<dom-module id="smart-building-component">
<script>
- class SmartHomeComponent extends OpenRemoteComponent {
+ class SmartBuildingComponent extends OpenRemoteComponent {
static get properties() {
return {
diff --git a/ui/app/customerA/smart-home/smart-home-energy.html b/ui/app/realmA/smart-building/smart-home-energy.html
similarity index 91%
rename from ui/app/customerA/smart-home/smart-home-energy.html
rename to ui/app/realmA/smart-building/smart-home-energy.html
index fd5d1c381..d56786426 100644
--- a/ui/app/customerA/smart-home/smart-home-energy.html
+++ b/ui/app/realmA/smart-building/smart-home-energy.html
@@ -1,11 +1,11 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
-<link rel="import" href="smart-home-smart.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
+<link rel="import" href="smart-building-smart.html">
-<dom-module id="smart-home-energy">
+<dom-module id="smart-building-energy">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.smartSwitchItem {
margin: 10px 0;
@@ -29,12 +29,12 @@
</style>
- <smart-home-smart residence="[[residence]]"></smart-home-smart>
+ <smart-building-smart residence="[[residence]]"></smart-building-smart>
- <smart-home-section>
+ <smart-building-section>
<template is="dom-repeat" items="[[smartSwitches]]">
<div class="layout horizontal center smartSwitchItem">
- <div><img height="30" src="smart-home/img/home_on.png"/></div>
+ <div><img height="30" src="smart-building/img/home_on.png"/></div>
<div class="flex layout horizontal smartSwitchLabel">
[[item.label]]
</div>
@@ -65,17 +65,17 @@
</template>
</div>
</template>
- </smart-home-section>
+ </smart-building-section>
<!-- TODO This section is not functional, not bound to any assets
- <smart-home-section>
+ <smart-building-section>
<div class="layout horizontal center">
<div class="flex" style="position: relative; padding-left: 10px;">
<div style="position: absolute;">
<div style="position: relative; left: 40px; top: 65px;">12%</div>
<div style="position: relative; top: 65px; left: 41px; font-size: x-small;">[[localize('Green')]]</div>
</div>
- <img width="110" height="110" src="smart-home/img/home_large_energy.png"/>
+ <img width="110" height="110" src="smart-building/img/home_large_energy.png"/>
</div>
<div class="layout vertical" style="font-size: smaller; margin-right: 5px;">
@@ -98,15 +98,15 @@
</div>
</div>
</div>
- </smart-home-section>
+ </smart-building-section>
-->
</template>
<script>
- class SmartHomeEnergy extends SmartHomeComponent {
+ class SmartBuildingEnergy extends SmartBuildingComponent {
static get is() {
- return "smart-home-energy";
+ return "smart-building-energy";
}
static get properties() {
@@ -225,7 +225,7 @@
}
- defineAppElement(SmartHomeEnergy, SmartHomeEnergy.is, "SmartHomeEnergy");
+ defineAppElement(SmartBuildingEnergy, SmartBuildingEnergy.is, "SmartBuildingEnergy");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-header.html b/ui/app/realmA/smart-building/smart-home-header.html
similarity index 87%
rename from ui/app/customerA/smart-home/smart-home-header.html
rename to ui/app/realmA/smart-building/smart-home-header.html
index 4649cbc2a..8394ff65f 100644
--- a/ui/app/customerA/smart-home/smart-home-header.html
+++ b/ui/app/realmA/smart-building/smart-home-header.html
@@ -1,9 +1,9 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
-<dom-module id="smart-home-header">
+<dom-module id="smart-building-header">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.header {
background-color: var(--theme-darkgrey);
@@ -66,9 +66,9 @@
</template>
<script>
- class SmartHomeHeader extends SmartHomeComponent {
+ class SmartBuildingHeader extends SmartBuildingComponent {
static get is() {
- return "smart-home-header";
+ return "smart-building-header";
}
static get properties() {
@@ -95,7 +95,7 @@
}
}
- defineAppElement(SmartHomeHeader, SmartHomeHeader.is, "SmartHomeHeader");
+ defineAppElement(SmartBuildingHeader, SmartBuildingHeader.is, "SmartBuildingHeader");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-scenes.html b/ui/app/realmA/smart-building/smart-home-scenes.html
similarity index 80%
rename from ui/app/customerA/smart-home/smart-home-scenes.html
rename to ui/app/realmA/smart-building/smart-home-scenes.html
index 60a98149a..fbf52c505 100644
--- a/ui/app/customerA/smart-home/smart-home-scenes.html
+++ b/ui/app/realmA/smart-building/smart-home-scenes.html
@@ -1,11 +1,11 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
-<link rel="import" href="smart-home-smart.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
+<link rel="import" href="smart-building-smart.html">
-<dom-module id="smart-home-scenes">
+<dom-module id="smart-building-scenes">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.sceneItem {
font-weight: 600;
@@ -37,9 +37,9 @@
</style>
- <smart-home-smart residence="[[residence]]"></smart-home-smart>
+ <smart-building-smart residence="[[residence]]"></smart-building-smart>
- <smart-home-section>
+ <smart-building-section>
<div class="layout horizontal center-center">
<div id="HOME"
class$="layout horizontal center-center sceneItem [[getItemClass(residence.attributes.lastExecutedScene.value, 'HOME')]]"
@@ -56,14 +56,14 @@
class$="layout horizontal center-center sceneItem [[getItemClass(residence.attributes.lastExecutedScene.value, 'NIGHT')]]"
on-click="switchScene">{{localize('Night')}}</div>
</div>
- </smart-home-section>
+ </smart-building-section>
</template>
<script>
- class SmartHomeScenes extends SmartHomeComponent {
+ class SmartBuildingScenes extends SmartBuildingComponent {
static get is() {
- return "smart-home-scenes";
+ return "smart-building-scenes";
}
getItemClass(lastExecutedScene, item) {
@@ -79,7 +79,7 @@
}
}
- defineAppElement(SmartHomeScenes, SmartHomeScenes.is, "SmartHomeScenes");
+ defineAppElement(SmartBuildingScenes, SmartBuildingScenes.is, "SmartBuildingScenes");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-section.html b/ui/app/realmA/smart-building/smart-home-section.html
similarity index 86%
rename from ui/app/customerA/smart-home/smart-home-section.html
rename to ui/app/realmA/smart-building/smart-home-section.html
index fc20cffd0..3a3fc2665 100644
--- a/ui/app/customerA/smart-home/smart-home-section.html
+++ b/ui/app/realmA/smart-building/smart-home-section.html
@@ -1,9 +1,9 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
-<dom-module id="smart-home-section">
+<dom-module id="smart-building-section">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
:host {
background-color: var(--theme-white);
border-radius: 10px;
@@ -59,9 +59,9 @@
</template>
<script>
- class SmartHomeSection extends SmartHomeComponent {
+ class SmartBuildingSection extends SmartBuildingComponent {
static get is() {
- return "smart-home-section";
+ return "smart-building-section";
}
static get properties() {
@@ -87,7 +87,7 @@
}
}
- defineAppElement(SmartHomeSection, SmartHomeSection.is, "SmartHomeSection");
+ defineAppElement(SmartBuildingSection, SmartBuildingSection.is, "SmartBuildingSection");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-security.html b/ui/app/realmA/smart-building/smart-home-security.html
similarity index 79%
rename from ui/app/customerA/smart-home/smart-home-security.html
rename to ui/app/realmA/smart-building/smart-home-security.html
index 95ac3c5bf..83fe14549 100644
--- a/ui/app/customerA/smart-home/smart-home-security.html
+++ b/ui/app/realmA/smart-building/smart-home-security.html
@@ -1,12 +1,12 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
-<link rel="import" href="smart-home-smart.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
+<link rel="import" href="smart-building-smart.html">
<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
-<dom-module id="smart-home-security">
+<dom-module id="smart-building-security">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.alarm {
margin: 10px 0;
@@ -30,16 +30,16 @@
</style>
- <smart-home-smart residence="[[residence]]"></smart-home-smart>
+ <smart-building-smart residence="[[residence]]"></smart-building-smart>
- <smart-home-section>
+ <smart-building-section>
<div class="layout horizontal center alarm">
<template is="dom-if" if="[[residence.attributes.presenceDetected.value]]">
- <img height="80" src="smart-home/img/eye_large_active.png"/>
+ <img height="80" src="smart-building/img/eye_large_active.png"/>
</template>
<template is="dom-if" if="[[!residence.attributes.presenceDetected.value]]">
- <img height="80" src="smart-home/img/eye_large.png"/>
+ <img height="80" src="smart-building/img/eye_large.png"/>
</template>
<div class="flex layout vertical residencePresenceStatus">
<div>[[localize('Alarm')]]</div>
@@ -57,7 +57,7 @@
<template is="dom-repeat" items="[[roomsPresenceStatus]]">
<div class="layout horizontal center roomPresenceStatusItem">
<div class="layout vertical center-center">
- <img height="30" src="smart-home/img/eye.png"/>
+ <img height="30" src="smart-building/img/eye.png"/>
</div>
<div class="flex layout horizontal roomLabel">
[[localize(item.roomName)]]
@@ -69,14 +69,14 @@
</template>
</div>
- </smart-home-section>
+ </smart-building-section>
</template>
<script>
- class SmartHomeSecurity extends SmartHomeComponent {
+ class SmartBuildingSecurity extends SmartBuildingComponent {
static get is() {
- return "smart-home-security";
+ return "smart-building-security";
}
static get properties() {
@@ -115,7 +115,7 @@
}
}
- defineAppElement(SmartHomeSecurity, SmartHomeSecurity.is, "SmartHomeSecurity");
+ defineAppElement(SmartBuildingSecurity, SmartBuildingSecurity.is, "SmartBuildingSecurity");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-settings.html b/ui/app/realmA/smart-building/smart-home-settings.html
similarity index 90%
rename from ui/app/customerA/smart-home/smart-home-settings.html
rename to ui/app/realmA/smart-building/smart-home-settings.html
index f7a8f7637..40279061b 100644
--- a/ui/app/customerA/smart-home/smart-home-settings.html
+++ b/ui/app/realmA/smart-building/smart-home-settings.html
@@ -1,12 +1,12 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
-<link rel="import" href="smart-home-temperature-select.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
+<link rel="import" href="smart-building-temperature-select.html">
<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
-<dom-module id="smart-home-settings">
+<dom-module id="smart-building-settings">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.infoLabel {
font-size: smaller;
font-style: italic;
@@ -43,7 +43,7 @@
</style>
- <smart-home-section title="[[localize('Vacation')]]" collapsed>
+ <smart-building-section title="[[localize('Vacation')]]" collapsed>
<div class="layout horizontal center" style="margin-bottom: 10px;">
<div class="flex">[[localize('On vacation until')]]</div>
<input class="or-Input or-InputDate"
@@ -53,9 +53,9 @@
value="[[vacationUntil]]"
on-input="onVacationUntilChange"/>
</div>
- </smart-home-section>
+ </smart-building-section>
- <smart-home-section title="[[localize('Weekly Schedule')]]" collapsed>
+ <smart-building-section title="[[localize('Weekly Schedule')]]" collapsed>
<div class="layout horizontal">
<div class="layout horizontal first row">
<div class="first field">[[localize('Scene')]]</div>
@@ -86,9 +86,9 @@
</template>
</div>
</template>
- </smart-home-section>
+ </smart-building-section>
- <smart-home-section title="[[localize('Scene Configuration')]]" collapsed>
+ <smart-building-section title="[[localize('Scene Configuration')]]" collapsed>
<div class="layout horizontal">
<div class="layout horizontal first row">
<div class="first field">[[localize('Alarm')]]</div>
@@ -130,25 +130,25 @@
<template is="dom-repeat" items="{{scenes}}" as="scene">
<div class="flex layout horizontal center-center row">
<div class="field">
- <smart-home-temperature-select
+ <smart-building-temperature-select
temperature="[[getSceneTemperature(residence.attributes, scene.name)]]"
on-change="onSceneTemperatureChange"
- temperature-format="%0f° C"></smart-home-temperature-select>
+ temperature-format="%0f° C"></smart-building-temperature-select>
</div>
</div>
</template>
</div>
- </smart-home-section>
+ </smart-building-section>
<div class="layout horizontal center-center infoLabel">[[residence.name]]</div>
</template>
<script>
- class SmartHomeSettings extends SmartHomeComponent {
+ class SmartBuildingSettings extends SmartBuildingComponent {
static get is() {
- return "smart-home-settings";
+ return "smart-building-settings";
}
static get properties() {
@@ -248,7 +248,7 @@
}
}
- defineAppElement(SmartHomeSettings, SmartHomeSettings.is, "SmartHomeSettings");
+ defineAppElement(SmartBuildingSettings, SmartBuildingSettings.is, "SmartBuildingSettings");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-smart.html b/ui/app/realmA/smart-building/smart-home-smart.html
similarity index 66%
rename from ui/app/customerA/smart-home/smart-home-smart.html
rename to ui/app/realmA/smart-building/smart-home-smart.html
index 269601eda..d36563dc2 100644
--- a/ui/app/customerA/smart-home/smart-home-smart.html
+++ b/ui/app/realmA/smart-building/smart-home-smart.html
@@ -1,19 +1,19 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
-<link rel="import" href="smart-home-section.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
+<link rel="import" href="smart-building-section.html">
<link rel="import" href="/static/src/or-checkbox/or-checkbox.html">
-<dom-module id="smart-home-smart">
+<dom-module id="smart-building-smart">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
.smartLabel {
margin: 0 10px;
}
</style>
- <smart-home-section>
+ <smart-building-section>
<div class="layout horizontal center">
- <img height="30" src="smart-home/img/star.png"/>
+ <img height="30" src="smart-building/img/star.png"/>
<!-- "All Smart" currently means enabling/disabling automatic scene switching based on schedule -->
<div class="flex layout horizontal smartLabel">[[localize('All Smart')]]</div>
<div class="layout horizontal">
@@ -21,14 +21,14 @@
on-change="onSmartToggleChange"></or-checkbox>
</div>
</div>
- </smart-home-section>
+ </smart-building-section>
</template>
<script>
- class SmartHomeSmart extends SmartHomeComponent {
+ class SmartBuildingSmart extends SmartBuildingComponent {
static get is() {
- return "smart-home-smart";
+ return "smart-building-smart";
}
ready() {
@@ -43,7 +43,7 @@
}
}
- defineAppElement(SmartHomeSmart, SmartHomeSmart.is, "SmartHomeSmart");
+ defineAppElement(SmartBuildingSmart, SmartBuildingSmart.is, "SmartBuildingSmart");
</script>
</dom-module>
diff --git a/ui/app/customerA/smart-home/smart-home-style.html b/ui/app/realmA/smart-building/smart-home-style.html
similarity index 61%
rename from ui/app/customerA/smart-home/smart-home-style.html
rename to ui/app/realmA/smart-building/smart-home-style.html
index 9f860fd2f..0c8d00c0c 100644
--- a/ui/app/customerA/smart-home/smart-home-style.html
+++ b/ui/app/realmA/smart-building/smart-home-style.html
@@ -1,4 +1,4 @@
-<dom-module id="smart-home-style">
+<dom-module id="smart-building-style">
<template>
<style include="or-style">
</style>
diff --git a/ui/app/customerA/smart-home/smart-home-temperature-select.html b/ui/app/realmA/smart-building/smart-home-temperature-select.html
similarity index 79%
rename from ui/app/customerA/smart-home/smart-home-temperature-select.html
rename to ui/app/realmA/smart-building/smart-home-temperature-select.html
index 65334173e..555e8da6f 100644
--- a/ui/app/customerA/smart-home/smart-home-temperature-select.html
+++ b/ui/app/realmA/smart-building/smart-home-temperature-select.html
@@ -1,9 +1,9 @@
-<link rel="import" href="smart-home-component.html">
-<link rel="import" href="smart-home-style.html">
+<link rel="import" href="smart-building-component.html">
+<link rel="import" href="smart-building-style.html">
-<dom-module id="smart-home-temperature-select">
+<dom-module id="smart-building-temperature-select">
<template>
- <style include="smart-home-style">
+ <style include="smart-building-style">
</style>
<div class="or-Select">
@@ -20,9 +20,9 @@
</template>
<script>
- class SmartHomeTemperatureSelect extends SmartHomeComponent {
+ class SmartBuildingTemperatureSelect extends SmartBuildingComponent {
static get is() {
- return "smart-home-temperature-select";
+ return "smart-building-temperature-select";
}
static get properties() {
@@ -62,7 +62,7 @@
}
}
- defineAppElement(SmartHomeTemperatureSelect, SmartHomeTemperatureSelect.is, "SmartHomeTemperatureSelect");
+ defineAppElement(SmartBuildingTemperatureSelect, SmartBuildingTemperatureSelect.is, "SmartBuildingTemperatureSelect");
</script>
</dom-module>
diff --git a/ui/app/customerA/yarn.lock b/ui/app/realmA/yarn.lock
similarity index 100%
rename from ui/app/customerA/yarn.lock
rename to ui/app/realmA/yarn.lock
diff --git a/ui/demo/demo-or-map/src/index.ts b/ui/demo/demo-or-map/src/index.ts
index 78fe5a255..4262a2296 100644
--- a/ui/demo/demo-or-map/src/index.ts
+++ b/ui/demo/demo-or-map/src/index.ts
@@ -9,5 +9,5 @@ openremote.init({
autoLogin: true,
keycloakUrl: "http://localhost:8080/auth",
managerUrl: "http://localhost:8080",
- realm: "customerA"
+ realm: "tenantA"
});
diff --git a/ui/demo/demo-rest/src/index.ts b/ui/demo/demo-rest/src/index.ts
index f87c0652d..f01e867ea 100644
--- a/ui/demo/demo-rest/src/index.ts
+++ b/ui/demo/demo-rest/src/index.ts
@@ -37,5 +37,5 @@ openremote.init({
keycloakUrl: "http://localhost:8080/auth",
auth: Auth.KEYCLOAK,
autoLogin: true,
- realm: "customerA"
+ realm: "tenantA"
}).then(renderUi);
\ No newline at end of file