use of org.drools.kiesession.audit.WorkingMemoryConsoleLogger in project drools by kiegroup.
the class MapConstraintTest method testMapNullConstraint.
@Test
public void testMapNullConstraint() throws Exception {
KieBase kbase = KieBaseUtil.getKieBaseFromClasspathResources(getClass(), kieBaseTestConfiguration, "test_mapNullConstraints.drl");
KieSession ksession = kbase.newKieSession();
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"));
}
use of org.drools.kiesession.audit.WorkingMemoryConsoleLogger in project drools by kiegroup.
the class FirstOrderLogicTest method testExists3.
@Test
public void testExists3() throws Exception {
KieBase kbase = KieBaseUtil.getKieBaseFromClasspathResources(getClass(), kieBaseTestConfiguration, "test_Exists_JBRULES_2810.drl");
KieSession ksession = kbase.newKieSession();
WorkingMemoryConsoleLogger logger = new WorkingMemoryConsoleLogger(ksession);
ksession.fireAllRules();
ksession.dispose();
}
Aggregations