use of org.drools.compiler.integrationtests.DynamicRulesChangesTest.Sprinkler in project drools by kiegroup.
the class SegmentMemoryPrototypeTest method checkKieSession.
private void checkKieSession(KieSession ksession) {
final List<String> events = new ArrayList<String>();
ksession.setGlobal("events", events);
// phase 1
Room room1 = new Room("Room 1");
ksession.insert(room1);
FactHandle fireFact1 = ksession.insert(new Fire(room1));
ksession.fireAllRules();
assertEquals(1, events.size());
// phase 2
Sprinkler sprinkler1 = new Sprinkler(room1);
ksession.insert(sprinkler1);
ksession.fireAllRules();
assertEquals(2, events.size());
// phase 3
ksession.delete(fireFact1);
ksession.fireAllRules();
assertEquals(5, events.size());
}
Aggregations