Skip to content

armgit / core

Public Imported from GitHub
0

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

Don't import scenes and rules for all tests, each test must deploy the rules it needs

Christian Bauer0aae4c1b2a15
diff --git a/container/src/main/groovy/org/openremote/test/ContainerTrait.groovy b/container/src/main/groovy/org/openremote/test/ContainerTrait.groovy
index 39495c541..94a452b9a 100644
--- a/container/src/main/groovy/org/openremote/test/ContainerTrait.groovy
+++ b/container/src/main/groovy/org/openremote/test/ContainerTrait.groovy
@@ -44,15 +44,8 @@ import javax.ws.rs.core.UriBuilder
import static java.util.concurrent.TimeUnit.SECONDS
trait ContainerTrait {
- private static Container container;
- static Map<String, String> defaultConfig(int serverPort) {
- [
- (WebService.WEBSERVER_LISTEN_PORT) : Integer.toString(serverPort),
- (IdentityService.IDENTITY_NETWORK_HOST) : IdentityService.KEYCLOAK_HOST_DEFAULT,
- (IdentityService.IDENTITY_NETWORK_WEBSERVER_PORT): Integer.toString(IdentityService.KEYCLOAK_PORT_DEFAULT)
- ]
- }
+ private static Container container;
static Container startContainer(Map<String, String> config, Iterable<ContainerService> services) {
container = new Container(config, services)
diff --git a/manager/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy b/manager/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy
index 59ff90e5f..66e76dff4 100644
--- a/manager/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy
+++ b/manager/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy
@@ -8,6 +8,7 @@ import org.openremote.container.ContainerService
import org.openremote.container.message.MessageBrokerService
import org.openremote.container.message.MessageBrokerSetupService
import org.openremote.container.persistence.PersistenceService
+import org.openremote.container.security.IdentityService
import org.openremote.container.timer.TimerService
import org.openremote.manager.server.agent.AgentService
import org.openremote.manager.server.apps.ConsoleAppService
@@ -28,12 +29,25 @@ import org.openremote.manager.server.web.ManagerWebService
import java.util.concurrent.TimeUnit
+import static org.openremote.container.security.IdentityService.IDENTITY_NETWORK_HOST
+import static org.openremote.container.security.IdentityService.IDENTITY_NETWORK_WEBSERVER_PORT
import static org.openremote.container.timer.TimerService.Clock.PSEUDO
import static org.openremote.container.timer.TimerService.TIMER_CLOCK_TYPE
+import static org.openremote.container.web.WebService.WEBSERVER_LISTEN_PORT
import static org.openremote.manager.server.setup.builtin.BuiltinSetupTasks.*
trait ManagerContainerTrait extends ContainerTrait {
+ static Map<String, String> defaultConfig(int serverPort) {
+ [
+ (WEBSERVER_LISTEN_PORT) : Integer.toString(serverPort),
+ (IDENTITY_NETWORK_HOST) : IdentityService.KEYCLOAK_HOST_DEFAULT,
+ (IDENTITY_NETWORK_WEBSERVER_PORT) : Integer.toString(IdentityService.KEYCLOAK_PORT_DEFAULT),
+ (SETUP_IMPORT_DEMO_SCENES) : "false",
+ (SETUP_IMPORT_DEMO_RULES) : "false"
+ ]
+ }
+
static Iterable<ContainerService> defaultServices(Iterable<ContainerService> additionalServices) {
[
new TimerService(),
@@ -65,27 +79,18 @@ trait ManagerContainerTrait extends ContainerTrait {
defaultServices(Arrays.asList(additionalServices))
}
- static Container startContainerNoDemoScenes(Map<String, String> config, Iterable<ContainerService> services) {
- config << [(SETUP_IMPORT_DEMO_SCENES): "false"]
- startContainer(config, services);
- }
-
- static Container startContainerNoDemoScenesOrRules(Map<String, String> config, Iterable<ContainerService> services) {
- config << [(SETUP_IMPORT_DEMO_SCENES): "false"]
- config << [(SETUP_IMPORT_DEMO_RULES): "false"]
+ static Container startContainerNoDemoAssets(Map<String, String> config, Iterable<ContainerService> services) {
+ config << [(SETUP_IMPORT_DEMO_ASSETS): "false"]
startContainer(config, services);
}
- static Container startContainerNoDemoScenesOrRulesOrAssets(Map<String, String> config, Iterable<ContainerService> services) {
- config << [(SETUP_IMPORT_DEMO_SCENES): "false"]
- config << [(SETUP_IMPORT_DEMO_RULES): "false"]
- config << [(SETUP_IMPORT_DEMO_ASSETS): "false"]
+ static Container startContainerWithDemoScenesAndRules(Map<String, String> config, Iterable<ContainerService> services) {
+ config << [(SETUP_IMPORT_DEMO_SCENES): "true"]
+ config << [(SETUP_IMPORT_DEMO_RULES): "true"]
startContainer(config, services);
}
static Container startContainerNoDemoImport(Map<String, String> config, Iterable<ContainerService> services) {
- config << [(SETUP_IMPORT_DEMO_SCENES): "false"]
- config << [(SETUP_IMPORT_DEMO_RULES): "false"]
config << [(SETUP_IMPORT_DEMO_ASSETS): "false"]
config << [(SETUP_IMPORT_DEMO_USERS): "false"]
startContainer(config, services);
diff --git a/manager/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy b/manager/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy
index 94244626a..da79fd3ab 100644
--- a/manager/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy
@@ -46,7 +46,7 @@ class AdminTenantsActivityTest extends Specification implements ManagerContainer
given: "The server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRulesOrAssets(defaultConfig(serverPort), defaultServices())
+ def container = startContainerNoDemoAssets(defaultConfig(serverPort), defaultServices())
def identityService = container.getService(ManagerIdentityService.class)
and: "expected results"
diff --git a/manager/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy b/manager/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy
index 20bc7142f..7830d6267 100644
--- a/manager/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy
@@ -43,7 +43,7 @@ class AdminUsersActivityTest extends Specification implements ManagerContainerTr
given: "The server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRulesOrAssets(defaultConfig(serverPort), defaultServices())
+ def container = startContainerNoDemoAssets(defaultConfig(serverPort), defaultServices())
def identityService = container.getService(ManagerIdentityService.class)
and: "expected results"
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
index 651e86ef4..b57d8729f 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy
@@ -43,7 +43,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
given: "The server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def identityService = container.getService(ManagerIdentityService.class)
def assetStorageService = container.getService(AssetStorageService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
@@ -215,7 +215,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
given: "The server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def identityService = container.getService(ManagerIdentityService.class)
def assetStorageService = container.getService(AssetStorageService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
@@ -393,7 +393,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContaine
given: "The server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def identityService = container.getService(ManagerIdentityService.class)
def assetStorageService = container.getService(AssetStorageService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy
index 6c205b416..3ab011e6f 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy
@@ -20,7 +20,7 @@ class AssetDatapointTest extends Specification implements ManagerContainerTrait
when: "the demo agent and thing have been deployed"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def simulatorProtocol = container.getService(SimulatorProtocol.class)
def assetStorageService = container.getService(AssetStorageService.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
index 6b4a48d61..b9b14b71f 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy
@@ -26,7 +26,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTrait
def "Test asset changes as superuser"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
index eae5d8829..3ae3c1ff7 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy
@@ -28,7 +28,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
def "Access assets as superuser"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def conditions = new PollingConditions(delay: 1, timeout: 5)
@@ -203,7 +203,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def conditions = new PollingConditions(delay: 1, timeout: 10)
@@ -357,7 +357,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
def "Access assets as testuser2"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
@@ -488,7 +488,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTrai
def "Access assets as testuser3"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def conditions = new PollingConditions(delay: 1, timeout: 5)
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetProcessingTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetProcessingTest.groovy
index 04d6c5191..916838a8e 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetProcessingTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetProcessingTest.groovy
@@ -103,7 +103,7 @@ class AssetProcessingTest extends Specification implements ManagerContainerTrait
when: "the container is started with the mock protocol and consumers"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices(mockProtocol))
+ def container = startContainer(defaultConfig(serverPort), defaultServices(mockProtocol))
def assetStorageService = container.getService(AssetStorageService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/manager/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
index dcdd2bf6c..88657dd48 100644
--- a/manager/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
@@ -24,7 +24,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
def "Query assets"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def assetStorageService = container.getService(AssetStorageService.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
index c09355341..6db8ff0b9 100644
--- a/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy
@@ -36,12 +36,10 @@ import org.openremote.test.ManagerContainerTrait
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
-import java.util.logging.Logger
/**
* This tests the basic protocol interface and abstract protocol implementation.
*/
class BasicProtocolTest extends Specification implements ManagerContainerTrait {
- Logger LOG = Logger.getLogger(BasicProtocolTest.class.getName())
def "Check processing of asset updates"() {
@@ -305,23 +303,24 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait {
assert protocolMethodCalls[11] == "LINK_ATTRIBUTE"
assert protocolMethodCalls[12] == "LINK_ATTRIBUTE"
- when: "the mock thing is retrieved from the DB"
- mockThing = assetStorageService.find(mockThing.getId(), true)
-
- then: "the linked attributes values should have been updated by the protocol"
- // Check all valid linked attributes have the new values
- assert mockThing.getAttribute("lightToggle1").get().getValueAsBoolean().orElse(false)
- assert mockThing.getAttribute("tempTarget1").get().getValueAsNumber().orElse(0d) == 25.5d
- // Check disabled linked attributes don't have the new values
- assert !mockThing.getAttribute("lightToggle4").get().getValue().isPresent()
- assert !mockThing.getAttribute("tempTarget4").get().getValue().isPresent()
- // Check invalid attributes don't have the new values
- assert !mockThing.getAttribute("lightToggle2").get().getValue().isPresent()
- assert !mockThing.getAttribute("tempTarget2").get().getValue().isPresent()
- assert !mockThing.getAttribute("lightToggle3").get().getValue().isPresent()
- assert !mockThing.getAttribute("tempTarget3").get().getValue().isPresent()
+ expect: "the linked attributes values should have been updated by the protocol"
+ conditions.eventually {
+ def mockAsset = assetStorageService.find(mockThing.getId(), true)
+ // Check all valid linked attributes have the new values
+ assert mockAsset.getAttribute("lightToggle1").get().getValueAsBoolean().orElse(false)
+ assert mockAsset.getAttribute("tempTarget1").get().getValueAsNumber().orElse(0d) == 25.5d
+ // Check disabled linked attributes don't have the new values
+ assert !mockAsset.getAttribute("lightToggle4").get().getValue().isPresent()
+ assert !mockAsset.getAttribute("tempTarget4").get().getValue().isPresent()
+ // Check invalid attributes don't have the new values
+ assert !mockAsset.getAttribute("lightToggle2").get().getValue().isPresent()
+ assert !mockAsset.getAttribute("tempTarget2").get().getValue().isPresent()
+ assert !mockAsset.getAttribute("lightToggle3").get().getValue().isPresent()
+ assert !mockAsset.getAttribute("tempTarget3").get().getValue().isPresent()
+ }
when: "a linked attribute is removed"
+ mockThing = assetStorageService.find(mockThing.getId(), true)
protocolMethodCalls.clear()
mockThing.removeAttribute("tempTarget3")
mockThing = assetStorageService.merge(mockThing)
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
index 8dd52f155..7315ee436 100644
--- a/manager/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/MacroProtocolTest.groovy
@@ -19,7 +19,7 @@ class MacroProtocolTest extends Specification implements ManagerContainerTrait {
when: "the container starts"
def serverPort = findEphemeralPort()
- def container = startContainer(defaultConfig(serverPort), defaultServices())
+ def container = startContainerWithDemoScenesAndRules(defaultConfig(serverPort), defaultServices())
def assetStorageService = container.getService(AssetStorageService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy b/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
index d4fec1616..e3b9ca1f4 100644
--- a/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/protocol/TimerProtocolTest.groovy
@@ -22,7 +22,7 @@ class TimerProtocolTest extends Specification implements ManagerContainerTrait {
when: "the container starts"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def assetStorageService = container.getService(AssetStorageService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
index 00ca114a6..bb85a121e 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy
@@ -28,7 +28,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainer
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
index 81baee272..41355d635 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesProcessingTest.groovy
@@ -79,7 +79,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
@@ -187,7 +187,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
@@ -274,7 +274,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
@@ -446,7 +446,7 @@ class BasicRulesProcessingTest extends Specification implements ManagerContainer
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesTimedExecutionTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesTimedExecutionTest.groovy
index c39a763e6..4a9af6b4c 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesTimedExecutionTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesTimedExecutionTest.groovy
@@ -31,7 +31,7 @@ class BasicRulesTimedExecutionTest extends Specification implements ManagerConta
and: "the container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def rulesService = container.getService(RulesService.class)
def rulesetStorageService = container.getService(RulesetStorageService.class)
@@ -73,7 +73,7 @@ class BasicRulesTimedExecutionTest extends Specification implements ManagerConta
given: "the container environment is started"
def conditions = new PollingConditions(timeout: 30, delay: 1)
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort) << [(TIMER_CLOCK_TYPE): PSEUDO.name()], defaultServices())
+ def container = startContainerWithPseudoClock(defaultConfig(serverPort), defaultServices())
def rulesService = container.getService(RulesService.class)
def rulesetStorageService = container.getService(RulesetStorageService.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
index 3b82a123b..0f18737a5 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy
@@ -25,7 +25,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
def "Access rules as superuser"() {
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def rulesetStorageService = container.getService(RulesetStorageService.class)
def rulesService = container.getService(RulesService.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
@@ -295,7 +295,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def rulesetStorageService = container.getService(RulesetStorageService.class)
def rulesService = container.getService(RulesService.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
@@ -525,7 +525,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def rulesetStorageService = container.getService(RulesetStorageService.class)
def rulesService = container.getService(RulesService.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
@@ -673,7 +673,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainer
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def rulesetStorageService = container.getService(RulesetStorageService.class)
def rulesService = container.getService(RulesService.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentAllLightsOffTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentAllLightsOffTest.groovy
index 468607927..933a1a7b0 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentAllLightsOffTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentAllLightsOffTest.groovy
@@ -1,13 +1,16 @@
package org.openremote.test.rules.apartment
-import org.openremote.model.value.Values
import org.openremote.manager.server.asset.AssetProcessingService
import org.openremote.manager.server.asset.AssetStorageService
import org.openremote.manager.server.rules.RulesEngine
import org.openremote.manager.server.rules.RulesService
+import org.openremote.manager.server.rules.RulesetStorageService
import org.openremote.manager.server.setup.SetupService
import org.openremote.manager.server.setup.builtin.ManagerDemoSetup
import org.openremote.model.attribute.AttributeEvent
+import org.openremote.model.rules.AssetRuleset
+import org.openremote.model.rules.Ruleset
+import org.openremote.model.value.Values
import org.openremote.test.ManagerContainerTrait
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
@@ -25,10 +28,19 @@ class ApartmentAllLightsOffTest extends Specification implements ManagerContaine
def container = startContainerWithPseudoClock(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def rulesService = container.getService(RulesService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def assetStorageService = container.getService(AssetStorageService.class)
RulesEngine apartment2Engine
+ and: "some rules"
+ Ruleset ruleset = new AssetRuleset(
+ "Demo Apartment - All Lights Off",
+ managerDemoSetup.apartment2Id,
+ getClass().getResource("/demo/rules/DemoApartmentAllLightsOff.drl").text
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
apartment2Engine = rulesService.assetEngines.get(managerDemoSetup.apartment2Id)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentNotificationWhenAlarmTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentNotificationWhenAlarmTest.groovy
index 09e4e0c1e..d4b6f4d2e 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentNotificationWhenAlarmTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentNotificationWhenAlarmTest.groovy
@@ -5,17 +5,20 @@ import org.openremote.manager.server.asset.AssetStorageService
import org.openremote.manager.server.notification.NotificationService
import org.openremote.manager.server.rules.RulesEngine
import org.openremote.manager.server.rules.RulesService
+import org.openremote.manager.server.rules.RulesetStorageService
import org.openremote.manager.server.setup.SetupService
import org.openremote.manager.server.setup.builtin.KeycloakDemoSetup
import org.openremote.manager.server.setup.builtin.ManagerDemoSetup
import org.openremote.manager.shared.notification.NotificationResource
import org.openremote.model.attribute.AttributeEvent
+import org.openremote.model.rules.AssetRuleset
+import org.openremote.model.rules.Ruleset
import org.openremote.model.value.Values
import org.openremote.test.ManagerContainerTrait
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
-import static org.openremote.manager.server.setup.builtin.ManagerDemoSetup.DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
+import static org.openremote.manager.server.setup.builtin.ManagerDemoSetup.DEMO_RULE_STATES_APARTMENT_1
import static org.openremote.model.Constants.KEYCLOAK_CLIENT_ID
class ApartmentNotificationWhenAlarmTest extends Specification implements ManagerContainerTrait {
@@ -32,19 +35,24 @@ class ApartmentNotificationWhenAlarmTest extends Specification implements Manag
def assetProcessingService = container.getService(AssetProcessingService.class)
def assetStorageService = container.getService(AssetStorageService.class)
def notificationService = container.getService(NotificationService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
RulesEngine apartment1Engine
+ and: "some rules"
+ Ruleset ruleset = new AssetRuleset(
+ "Demo Apartment - Notification when Alarm",
+ managerDemoSetup.apartment1Id,
+ getClass().getResource("/demo/rules/DemoApartmentNotificationWhenAlarm.drl").text
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
apartment1Engine = rulesService.assetEngines.get(managerDemoSetup.apartment1Id)
assert apartment1Engine != null
assert apartment1Engine.isRunning()
- }
-
- and: "the demo attributes marked with RULE_STATE = true meta should be inserted into the engines"
- conditions.eventually {
- assert apartment1Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
- assert apartment1Engine.knowledgeSession.factCount == DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
+ assert apartment1Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_1
+ assert apartment1Engine.knowledgeSession.factCount == DEMO_RULE_STATES_APARTMENT_1
}
and: "the alarm enabled, presence detected flag and timestamp of the room should not be set"
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
index ba8a06ea4..8433ca30a 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentPresenceDetectionTest.groovy
@@ -1,14 +1,17 @@
package org.openremote.test.rules.apartment
-import org.openremote.model.value.Values
import org.openremote.manager.server.asset.AssetProcessingService
import org.openremote.manager.server.asset.AssetStorageService
import org.openremote.manager.server.rules.RulesEngine
import org.openremote.manager.server.rules.RulesService
+import org.openremote.manager.server.rules.RulesetStorageService
import org.openremote.manager.server.setup.SetupService
import org.openremote.manager.server.setup.builtin.ManagerDemoSetup
-import org.openremote.model.attribute.AttributeEvent
import org.openremote.model.asset.AssetEvent
+import org.openremote.model.attribute.AttributeEvent
+import org.openremote.model.rules.AssetRuleset
+import org.openremote.model.rules.Ruleset
+import org.openremote.model.value.Values
import org.openremote.test.ManagerContainerTrait
import spock.lang.Ignore
import spock.lang.Specification
@@ -32,8 +35,17 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
def rulesService = container.getService(RulesService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def assetStorageService = container.getService(AssetStorageService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
RulesEngine apartment1Engine = null
+ and: "some rules"
+ Ruleset ruleset = new AssetRuleset(
+ "Demo Apartment - Presence Detection with motion counter",
+ managerDemoSetup.apartment1Id,
+ getClass().getResource("/demo/rules/DemoApartmentPresenceDetectionCounter.drl").text
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
apartment1Engine = rulesService.assetEngines.get(managerDemoSetup.apartment1Id)
@@ -44,8 +56,8 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
and: "the presence detected flag and timestamp of the room should not be set"
def livingRoomAsset = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
- assert !livingRoomAsset.getAttribute("presenceDetected").get().getValueAsBoolean().get()
- assert !livingRoomAsset.getAttribute("lastPresenceDetected").get().value.isPresent()
+ assert !livingRoomAsset.getAttribute("presenceDetected").get().getValue().isPresent()
+ assert !livingRoomAsset.getAttribute("lastPresenceDetected").get().getValue().isPresent()
when: "we have an events consumer for collecting test data"
List<AssetEvent> insertedAssetEvents = []
@@ -58,6 +70,7 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
setPseudoClocksToRealTime(container, apartment1Engine)
// Send 5 triggers each 3 minutes apart
for (i in 1..5) {
+ // TODO Send event through sensor/simulator
def motionCountIncrement = new AttributeEvent(
managerDemoSetup.apartment1LivingroomId, "motionCount", Values.create(i), getClockTimeOf(apartment1Engine)
)
@@ -71,8 +84,8 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
then: "presence should not be detected"
new PollingConditions(initialDelay: 3).eventually {
def asset = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
- assert !asset.getAttribute("presenceDetected").get().getValueAsBoolean().get()
- assert !asset.getAttribute("lastPresenceDetected").get().value.isPresent()
+ assert !asset.getAttribute("presenceDetected").get().getValue().isPresent()
+ assert !asset.getAttribute("lastPresenceDetected").get().getValue().isPresent()
}
when: "time is advanced enough for event expiration"
@@ -103,8 +116,8 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
conditions.eventually {
def asset = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert asset.getAttribute("presenceDetected").get().getValueAsBoolean().get()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().isPresent()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().get() == expectedLastPresenceTimestamp
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().isPresent()
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().get() == expectedLastPresenceTimestamp
}
when: "time moves on and we keep incrementing the motion counter in short intervals "
@@ -126,8 +139,8 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
conditions.eventually {
def asset = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert asset.getAttribute("presenceDetected").get().getValueAsBoolean().get()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().isPresent()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().get() == expectedLastPresenceTimestamp
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().isPresent()
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().get() == expectedLastPresenceTimestamp
}
when: "time moves on without the motion sensor being triggered"
@@ -137,8 +150,8 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
conditions.eventually {
def asset = assetStorageService.find(managerDemoSetup.apartment1LivingroomId, true)
assert !asset.getAttribute("presenceDetected").get().getValueAsBoolean().get()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().isPresent()
- assert asset.getAttribute("lastPresenceDetected").get().getValueAsDecimal().get() == expectedLastPresenceTimestamp
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().isPresent()
+ assert asset.getAttribute("lastPresenceDetected").get().getValueAsNumber().get() == expectedLastPresenceTimestamp
}
when: "time is advanced enough for event expiration"
@@ -163,8 +176,17 @@ class ApartmentPresenceDetectionTest extends Specification implements ManagerCon
def rulesService = container.getService(RulesService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def assetStorageService = container.getService(AssetStorageService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
RulesEngine apartment2Engine = null
+ and: "some rules"
+ Ruleset ruleset = new AssetRuleset(
+ "Demo Apartment - Presence Detection with motion PIR",
+ managerDemoSetup.apartment2Id,
+ getClass().getResource("/demo/rules/DemoApartmentPresenceDetectionPIR.drl").text
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
apartment2Engine = rulesService.assetEngines.get(managerDemoSetup.apartment2Id)
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentVacationModeTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentVacationModeTest.groovy
index 7aa9214f7..09f8bff2a 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentVacationModeTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/apartment/ApartmentVacationModeTest.groovy
@@ -1,10 +1,13 @@
package org.openremote.test.rules.apartment
+import org.openremote.model.rules.AssetRuleset
+import org.openremote.model.rules.Ruleset
import org.openremote.model.value.Values
import org.openremote.manager.server.asset.AssetProcessingService
import org.openremote.manager.server.asset.AssetStorageService
import org.openremote.manager.server.rules.RulesEngine
import org.openremote.manager.server.rules.RulesService
+import org.openremote.manager.server.rules.RulesetStorageService
import org.openremote.manager.server.setup.SetupService
import org.openremote.manager.server.setup.builtin.ManagerDemoSetup
import org.openremote.model.attribute.AttributeEvent
@@ -14,7 +17,6 @@ import spock.util.concurrent.PollingConditions
import static java.util.concurrent.TimeUnit.*
import static org.openremote.manager.server.setup.builtin.ManagerDemoSetup.DEMO_RULE_STATES_APARTMENT_1
-import static org.openremote.manager.server.setup.builtin.ManagerDemoSetup.DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
class ApartmentVacationModeTest extends Specification implements ManagerContainerTrait {
@@ -28,19 +30,24 @@ class ApartmentVacationModeTest extends Specification implements ManagerContaine
def rulesService = container.getService(RulesService.class)
def assetProcessingService = container.getService(AssetProcessingService.class)
def assetStorageService = container.getService(AssetStorageService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
RulesEngine apartment1Engine
+ and: "some rules"
+ Ruleset ruleset = new AssetRuleset(
+ "Demo Apartment - Vacation Mode",
+ managerDemoSetup.apartment1Id,
+ getClass().getResource("/demo/rules/DemoApartmentVacationMode.drl").text
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
apartment1Engine = rulesService.assetEngines.get(managerDemoSetup.apartment1Id)
assert apartment1Engine != null
assert apartment1Engine.isRunning()
- }
-
- and: "the demo attributes marked with RULE_STATE = true meta should be inserted into the engines"
- conditions.eventually {
- assert apartment1Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
- assert apartment1Engine.knowledgeSession.factCount == DEMO_RULE_STATES_APARTMENT_1_WITH_SCENES
+ assert apartment1Engine.assetStates.size() == DEMO_RULE_STATES_APARTMENT_1
+ assert apartment1Engine.knowledgeSession.factCount == DEMO_RULE_STATES_APARTMENT_1
}
when: "the vacation days are set to 5"
diff --git a/manager/test/src/test/groovy/org/openremote/test/rules/flight/FlightPriorityTest.groovy b/manager/test/src/test/groovy/org/openremote/test/rules/flight/FlightPriorityTest.groovy
index 4a26aee24..6769b911b 100644
--- a/manager/test/src/test/groovy/org/openremote/test/rules/flight/FlightPriorityTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/rules/flight/FlightPriorityTest.groovy
@@ -1,12 +1,14 @@
package org.openremote.test.rules.flight
-import org.openremote.manager.server.asset.AssetProcessingService
import org.openremote.manager.server.asset.AssetStorageService
import org.openremote.manager.server.rules.RulesEngine
import org.openremote.manager.server.rules.RulesService
+import org.openremote.manager.server.rules.RulesetStorageService
import org.openremote.manager.server.setup.SetupService
import org.openremote.manager.server.setup.builtin.KeycloakDemoSetup
import org.openremote.manager.server.setup.builtin.ManagerDemoSetup
+import org.openremote.model.rules.Ruleset
+import org.openremote.model.rules.TenantRuleset
import org.openremote.test.ManagerContainerTrait
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
@@ -20,23 +22,28 @@ class FlightPriorityTest extends Specification implements ManagerContainerTrait
given: "the container environment is started"
def conditions = new PollingConditions(timeout: 15, delay: 1)
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenes(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def rulesService = container.getService(RulesService.class)
- def assetProcessingService = container.getService(AssetProcessingService.class)
+ def rulesetStorageService = container.getService(RulesetStorageService.class)
def assetStorageService = container.getService(AssetStorageService.class)
RulesEngine customerCEngine
+ and: "some rules template and template asset are deployed"
+ Ruleset ruleset = new TenantRuleset(
+ "Demo Flights - Mark flights as priority",
+ keycloakDemoSetup.customerCTenant.id,
+ getClass().getResource("/demo/rules/flight/DemoFlightPriorityFilter.drlt").text,
+ managerDemoSetup.flightPriorityFiltersId
+ )
+ rulesetStorageService.merge(ruleset)
+
expect: "the rule engines to become available and be running"
conditions.eventually {
customerCEngine = rulesService.tenantEngines.get(keycloakDemoSetup.customerCTenant.id)
assert customerCEngine != null
assert customerCEngine.isRunning()
- }
-
- and: "the demo attributes marked with RULE_STATE = true meta should be inserted into the engines"
- conditions.eventually {
assert customerCEngine.assetStates.size() == DEMO_RULE_STATES_CUSTOMER_C
assert customerCEngine.knowledgeSession.factCount == DEMO_RULE_STATES_CUSTOMER_C
}
diff --git a/manager/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy b/manager/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy
index df27370e3..dfc79f874 100644
--- a/manager/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy
+++ b/manager/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy
@@ -20,7 +20,7 @@ class NotificationServiceTest extends Specification implements ManagerContainerT
given: "the server container is started"
def serverPort = findEphemeralPort()
- def container = startContainerNoDemoScenesOrRules(defaultConfig(serverPort), defaultServices())
+ def container = startContainer(defaultConfig(serverPort), defaultServices())
def keycloakDemoSetup = container.getService(SetupService.class).getTaskOfType(KeycloakDemoSetup.class)
def managerDemoSetup = container.getService(SetupService.class).getTaskOfType(ManagerDemoSetup.class)
def notificationService = container.getService(NotificationService.class)