use of org.jbpm.bpmn2.test.RequirePersistence in project jbpm by kiegroup.
the class ActivityTest method testBusinessRuleTask.
@Test
@RequirePersistence(false)
public void testBusinessRuleTask() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(new RuleAwareProcessEventLister());
ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask");
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.bpmn2.test.RequirePersistence in project jbpm by kiegroup.
the class ActivityTest method testRuleTaskWithFactsWithPersistence.
@Test
@RequirePersistence
public void testRuleTaskWithFactsWithPersistence() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-RuleTaskWithFact.bpmn2", "BPMN2-RuleTask3.drl");
ksession = createKnowledgeSession(kbase);
((SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) ksession).getRunner()).getKieSession().addEventListener(new TriggerRulesEventListener(ksession));
ksession.addEventListener(new DebugAgendaEventListener());
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);
}
use of org.jbpm.bpmn2.test.RequirePersistence in project jbpm by kiegroup.
the class ActivityTest method testBusinessRuleTaskWithPersistence.
@Test
@RequirePersistence(true)
public void testBusinessRuleTaskWithPersistence() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(new RuleAwareProcessEventLister());
ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask");
ksession = restoreSession(ksession, true);
ksession.addEventListener(new RuleAwareProcessEventLister());
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations