Does Test Scenario delete it's fact objects automatically after running tests?
Issue
- Take an example of this simple rule.
package com.sample;
rule "FirstRule"
dialect "mvel"
when
then
Incoming fact1 = new Incoming();
fact1.setKey(1);
fact1.setTypeIn("Call");
insert(fact1);
Incoming fact1 = new Incoming();
fact2.setKey(2);
fact2.setTypeOut("Data");
insert(fact2);
end
Running a Test Scenario from BRMS 6.1 Business Central UI based on this rule with inserted facts works fine. The scenario just checks that the rule is executed and 2 new objects of Incoming fact are created. The scenario runs good but looking at the Audit Log of the Test Scenario it shows following chain of events.
==>[ActivationCreatedEvent: getActivation()=[[ FirstRule active=false ] [ [fact 0:0:1334980084:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl@4c3ae0d8]
Fact com.sample.Incoming inserted in rule FirstRule. Fact[ com.sample.Incoming@18f58cfd ].
Fact com.sample.Incoming inserted in rule FirstRule. Fact[ com.sample.Incoming@2d7fac01 ].
Object com.sample.Incoming deleted. Fact[ com.sample.Incoming@2d7fac01 ].
Rule [Rule name=FirstRule, agendaGroup=MAIN, salience=0, no-loop=false] fired.
Object com.sample.Incoming deleted. Fact[ com.sample.Incoming@18f58cfd ].
- Why does it show the following rows related to deletion of fact objects ?
Object com.sample.Incoming deleted. Fact[ com.sample.Incoming@2d7fac01 ].
Object com.sample.Incoming deleted. Fact[ com.sample.Incoming@18f58cfd ].
-
The rule does not delete any objects. Does the
Test Scenarioclean the memory after running the test? Isn't it a new statefulKieSessioncreated every time users run the test? -
Also, why doesn't the log appear in a logical order inside the
Audit Log?
Environment
- Red Hat JBoss BRMS (BRMS)
- 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
