use of org.drools.core.audit.WorkingMemoryConsoleLogger in project drools by kiegroup.
the class FirstOrderLogicTest method testExists3.
@Test
public void testExists3() throws Exception {
KieBase kbase = loadKnowledgeBase("test_Exists_JBRULES_2810.drl");
KieSession ksession = createKnowledgeSession(kbase);
WorkingMemoryConsoleLogger logger = new WorkingMemoryConsoleLogger(ksession);
ksession.fireAllRules();
ksession.dispose();
}
use of org.drools.core.audit.WorkingMemoryConsoleLogger in project drools by kiegroup.
the class MapConstraintTest method testMapNullConstraint.
@Test
public void testMapNullConstraint() throws Exception {
final KieBase kbase = loadKnowledgeBase("test_mapNullConstraints.drl");
final KieSession ksession = createKnowledgeSession(kbase);
final org.kie.api.event.rule.AgendaEventListener ael = mock(org.kie.api.event.rule.AgendaEventListener.class);
ksession.addEventListener(ael);
new WorkingMemoryConsoleLogger((WorkingMemory) ksession);
final Map addresses = new HashMap();
addresses.put("home", new Address("home street"));
final Person bob = new Person("Bob");
bob.setNamedAddresses(addresses);
ksession.insert(bob);
ksession.fireAllRules();
final ArgumentCaptor<AfterMatchFiredEvent> arg = ArgumentCaptor.forClass(org.kie.api.event.rule.AfterMatchFiredEvent.class);
verify(ael, times(4)).afterMatchFired(arg.capture());
org.kie.api.event.rule.AfterMatchFiredEvent aaf = arg.getAllValues().get(0);
assertThat(aaf.getMatch().getRule().getName(), is("1. home != null"));
aaf = arg.getAllValues().get(1);
assertThat(aaf.getMatch().getRule().getName(), is("2. not home == null"));
aaf = arg.getAllValues().get(2);
assertThat(aaf.getMatch().getRule().getName(), is("7. work == null"));
aaf = arg.getAllValues().get(3);
assertThat(aaf.getMatch().getRule().getName(), is("8. not work != null"));
}
Aggregations