Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
0.3.0
-
None
-
2019 Week 38-40 (from Sep 16)
Description
See reproducer here: https://github.com/DuncanDoyle/kogito-ruleunit-reproducer
This project contains 2 simple, unrelated KieBases, "A" and "B". The unit test inserts a simple String which should fire 1 rule in RuleUnit A. For debugging purposes I use reflection to access the KieBase, which allows me to use the ReteDumper to dump the network.
If you run "mvn clean test" on this project, everything works fine. The dumped network looks like this:
[EntryPointNode(1) EntryPoint::DEFAULT ] on Partition(MAIN) [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ] on Partition(MAIN) [ObjectTypeNode(3)::EntryPoint::DEFAULT objectType=[ClassObjectType class=java.lang.String] expiration=-1ms ] on Partition(MAIN) [AlphaNode(4) constraint=Constraint for 9DB5D88104BA8353AC547D529E589C35] on Partition(7) d -1 i -1 [LeftInputAdapterNode(5)] on Partition(7) Ld 0 Li 0 [RuleTerminalNode(6): rule=Find Hello] on Partition(7) d -1 i -1 [AlphaNode(7) constraint=Constraint for 3EBB9AE19CCE98F9388D901D6E0E874B] on Partition(8) d -1 i -1 [LeftInputAdapterNode(8)] on Partition(8) Ld 0 Li 0 [RuleTerminalNode(9): rule=Find Goodbye] on Partition(8) d -1 i -1
Now, change the "Find Good Morning" rule in KieBase B (so, the KieBase we're not actually using in our test!!) in such a way that you introduce a syntax error, e.g.:
rule "Find Good Morning" when String(this == "Good Morning) then System.out.println("We've found a Good Morning"); end
Notice the missing " in the alpha constraint.
Run the test again. You will see that now 2 rules fire ("Hello" and"Goodbye"). What's even more interesting is that is actually correct if you look at the dumped network, as the network no longer contains the String OTN and Alpha Constraints:
[EntryPointNode(1) EntryPoint::DEFAULT ] on Partition(MAIN) [ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ] on Partition(MAIN) [LeftInputAdapterNode(3)] on Partition(2) Ld 0 Li 0 [RuleTerminalNode(4): rule=Find Hello] on Partition(2) d -1 i -1 [RuleTerminalNode(5): rule=Find Goodbye] on Partition(2) d -1 i -1
This is triggered by any syntax error. Something like this shows the same problem:
rule "Find Good Morning" when String(this WTF!! "Good Morning") then System.out.println("We've found a Good Morning"); end
Attachments
Issue Links
- is incorporated by
-
KOGITO-219 Accumulate over declared windows doesn't work
- Resolved