use of org.kie.api.event.rule.MatchCancelledEvent in project jbpm by kiegroup.
the class ActivityTest method testRuleTaskWithFacts.
@Test
@RequirePersistence(false)
public void testRuleTaskWithFacts() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-RuleTaskWithFact.bpmn2", "BPMN2-RuleTask3.drl");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(new AgendaEventListener() {
public void matchCreated(MatchCreatedEvent event) {
}
public void matchCancelled(MatchCancelledEvent event) {
}
public void beforeRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent event) {
}
public void beforeRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent event) {
}
public void beforeMatchFired(BeforeMatchFiredEvent event) {
}
public void agendaGroupPushed(org.kie.api.event.rule.AgendaGroupPushedEvent event) {
}
public void agendaGroupPopped(org.kie.api.event.rule.AgendaGroupPoppedEvent event) {
}
public void afterRuleFlowGroupDeactivated(org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent event) {
}
public void afterRuleFlowGroupActivated(org.kie.api.event.rule.RuleFlowGroupActivatedEvent event) {
ksession.fireAllRules();
}
public void afterMatchFired(AfterMatchFiredEvent event) {
}
});
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "SomeString");
ProcessInstance processInstance = ksession.startProcess("RuleTask", params);
assertProcessInstanceFinished(processInstance, ksession);
params = new HashMap<String, Object>();
try {
processInstance = ksession.startProcess("RuleTask", params);
fail("Should fail");
} catch (Exception e) {
e.printStackTrace();
}
params = new HashMap<String, Object>();
params.put("x", "SomeString");
processInstance = ksession.startProcess("RuleTask", params);
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations