Add optional rule UID to DSL Rule file syntax (#5449)

* add optional rule UID to DSL file syntax
* avoid notifying the rule registry for isolated models
* check other model files for rule with same name before rule removal

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Also-by: Ravi Nadahar <nadahar@rediffmail.com>
This commit is contained in:
lolodomo
2026-04-15 22:54:49 +02:00
committed by GitHub
parent 911e102341
commit d405504e22
3 changed files with 147 additions and 85 deletions
@@ -103,7 +103,7 @@ public class DSLRuleProviderTest extends JavaOSGiTest {
Collection<Rule> rules = dslRuleProvider.getAll();
assertThat(rules.size(), is(0));
String model = "rule RuleNumberOne [ Test, \"my test\" ]\n" + //
String model = "rule RuleNumberOne uid = rule1 [ Test, \"my test\" ]\n" + //
"when\n" + //
" System started\n" + //
"then\n" + //
@@ -125,7 +125,7 @@ public class DSLRuleProviderTest extends JavaOSGiTest {
Rule firstRule = it.next();
assertThat(firstRule.getUID(), is("dslruletest-1"));
assertThat(firstRule.getUID(), is("rule1"));
assertThat(firstRule.getName(), is("RuleNumberOne"));
assertThat(firstRule.getTags(), hasSize(2));
assertThat(firstRule.getTags(), hasItem("Test"));