diff --git a/drools-ansible-rulebook-integration-api/src/test/java/org/drools/ansible/rulebook/integration/api/TypeMismatchTest.java b/drools-ansible-rulebook-integration-api/src/test/java/org/drools/ansible/rulebook/integration/api/TypeMismatchTest.java index 3ea53e0..5fcdb75 100644 --- a/drools-ansible-rulebook-integration-api/src/test/java/org/drools/ansible/rulebook/integration/api/TypeMismatchTest.java +++ b/drools-ansible-rulebook-integration-api/src/test/java/org/drools/ansible/rulebook/integration/api/TypeMismatchTest.java @@ -421,7 +421,7 @@ public void alphaIndex() { RulesExecutor rulesExecutor = RulesExecutorFactory.createFromJson(JSON_ALPHA_INDEX); // incoming event.mera.headers is a map, not a string - List matchedRules = rulesExecutor.processEvents("{ \"meta\": {\"headers\": {\"Content-Length\": \"36\"}} } }").join(); + List matchedRules = rulesExecutor.processEvents("{ \"meta\": {\"headers\": {\"Content-Length\": \"36\" } } }").join(); // When alpha index is effective (= more than 3 Equals for the same property with literal values), constraint is not evaluated, so no error log. Just don't match. assertNumberOfErrorLogs(0); assertEquals(0, matchedRules.size()); @@ -438,18 +438,28 @@ public void alphaIndex() { "Rule": { "name": "r1", "condition": { - "AllCondition": [ - { - "EqualsExpression": { - "lhs": { - "Event": "meta.headers" - }, - "rhs": { - "Event": "mydata" - } - } - } - ] + "AllCondition": [ + { + "EqualsExpression": { + "lhs": { + "Event": "mydata" + }, + "rhs": { + "String": "AAA" + } + } + }, + { + "EqualsExpression": { + "lhs": { + "Event": "meta.headers" + }, + "rhs": { + "Events": "m_0.mydata" + } + } + } + ] }, "actions": [ { @@ -471,7 +481,9 @@ public void betaIndex() { RulesExecutor rulesExecutor = RulesExecutorFactory.createFromJson(JSON_BETA_INDEX); // incoming event.mera.headers is a map, not a string - List matchedRules = rulesExecutor.processEvents("{ \"meta\": {\"headers\": {\"Content-Length\": \"36\"}} }, \"mydata\": \"AAA\" }").join(); + rulesExecutor.processEvents("{ \"mydata\": \"AAA\" }").join(); + List matchedRules = rulesExecutor.processEvents("{ \"meta\": {\"headers\": {\"Content-Length\": \"36\" } } }").join(); + // When beta index is effective (= comparing 2 event properties with Equals), constraint is not evaluated, so no error log. Just doesn't match. assertNumberOfErrorLogs(0); assertEquals(0, matchedRules.size());