Search in sources :

Example 1 with DefaultAgenda

use of org.drools.kiesession.agenda.DefaultAgenda in project drools by kiegroup.

the class UseOfRuleFlowGroupPlusLockOnTest method test.

@Test
public void test() {
    KieHelper kieHelper = new KieHelper().addContent(drl, ResourceType.DRL);
    KieBase kbase = kieHelper.build();
    KieSession ksession = kbase.newKieSession();
    ReteDumper.dumpRete(ksession);
    ksession.addEventListener(new DebugAgendaEventListener());
    try {
        ksession.insert(new Person());
        ksession.insert(new Cheese("eidam"));
        ((DefaultAgenda) ksession.getAgenda()).activateRuleFlowGroup("group1");
        int rulesFired = ksession.fireAllRules();
        Assert.assertEquals(1, rulesFired);
    } finally {
        ksession.dispose();
    }
}
Also used : DebugAgendaEventListener(org.kie.api.event.rule.DebugAgendaEventListener) KieBase(org.kie.api.KieBase) DefaultAgenda(org.drools.kiesession.agenda.DefaultAgenda) KieHelper(org.kie.internal.utils.KieHelper) KieSession(org.kie.api.runtime.KieSession) Test(org.junit.Test)

Aggregations

DefaultAgenda (org.drools.kiesession.agenda.DefaultAgenda)1 Test (org.junit.Test)1 KieBase (org.kie.api.KieBase)1 DebugAgendaEventListener (org.kie.api.event.rule.DebugAgendaEventListener)1 KieSession (org.kie.api.runtime.KieSession)1 KieHelper (org.kie.internal.utils.KieHelper)1