Hi all,
I'm dealing with a set of rules having the lock-on-active attribute and I'm not getting the (at least what I understand as) expected results.
I've created an isolated JUnit test. I'm attaching it to this email.
Basically, I have 2 rules:
rule "init"
lock-on-active true
when
$d: DataSample()
then
System.out.println("Setting predefined value");
modify($d){
addValue(Parameter.PARAM_A, 10.0)
}
end
rule "Rule 1"
lock-on-active true
when
DataSample($v: values[Parameter.PARAM_A] < 20)
then
System.out.println("Rule 1: "+$v);
end
DataSample is a Java class containing a Map<Parameter, Double> where Parameter is an enum.
In the test I'm creating a ksession and inserting an empty DataSample object.
I understand that as soon as the object is inserted, both rules are evaluated and the result is going to be an activation of rule "init"; and this is what is actually happening. So far so good.
Now, after I call fireAllRules() I expect that 'Rule 1' becomes active because of the modification of the fact in "init". Well, this is not the case. I don't see any activation for "Rule 1".
My understanding about lock-on-active is that a rule that WAS ACTIVATED is not going to be re-activated until the current agenda group is switched. The odd thing here is that I never had an activation for "Rule 1" so I don't see why it activation after "init" is executed should be prevented.
So my question is: Is my understanding wrong? What is the expected behavior of lock-on-active in this situation? I read the documentation but I couldn't get any hint:
Best Regards,