use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.
the class IntermediateEventTest method testConditionalBoundaryEventOnTaskComplete.
@Test
public void testConditionalBoundaryEventOnTaskComplete() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-BoundaryConditionalEventOnTask.bpmn2");
ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
ProcessInstance processInstance = ksession.startProcess("BoundarySignalOnTask");
ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
Person person = new Person();
person.setName("john");
// as the node that boundary event is attached to has been completed insert will not have any effect
ksession.insert(person);
ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
assertProcessInstanceFinished(processInstance, ksession);
assertNodeTriggered(processInstance.getId(), "StartProcess", "User Task", "User Task2", "End1");
}
use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.
the class ActivityTest method testBusinessRuleTaskWithDataInputs2WithPersistence.
@Test
public void testBusinessRuleTaskWithDataInputs2WithPersistence() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTaskWithDataInput.bpmn2", "BPMN2-BusinessRuleTaskWithDataInput.drl");
ksession = createKnowledgeSession(kbase);
Map<String, Object> params = new HashMap<String, Object>();
params.put("person", new Person());
ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask", params);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.
the class ActivityTest method testMultipleBusinessRuleTaskWithDataInputsWithPersistence.
@Test
public void testMultipleBusinessRuleTaskWithDataInputsWithPersistence() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-MultipleRuleTasksWithDataInput.bpmn2", "BPMN2-MultipleRuleTasks.drl");
ksession = createKnowledgeSession(kbase);
ksession.addEventListener(new TriggerRulesEventListener(ksession));
List<String> listPerson = new ArrayList<String>();
List<String> listAddress = new ArrayList<String>();
ksession.setGlobal("listPerson", listPerson);
ksession.setGlobal("listAddress", listAddress);
Person person = new Person();
person.setName("john");
Address address = new Address();
address.setStreet("5th avenue");
Map<String, Object> params = new HashMap<String, Object>();
params.put("person", person);
params.put("address", address);
ProcessInstance processInstance = ksession.startProcess("multiple-rule-tasks", params);
assertEquals(1, listPerson.size());
assertEquals(1, listAddress.size());
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.
the class ActivityTest method testBusinessRuleTaskWithDataInputsWithPersistence.
@Test
public void testBusinessRuleTaskWithDataInputsWithPersistence() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTaskWithDataInputs.bpmn2", "BPMN2-BusinessRuleTaskWithDataInput.drl");
ksession = createKnowledgeSession(kbase);
Map<String, Object> params = new HashMap<String, Object>();
params.put("person", new Person());
ProcessInstance processInstance = ksession.startProcess("BPMN2-BusinessRuleTask", params);
assertProcessInstanceFinished(processInstance, ksession);
}
use of org.jbpm.bpmn2.objects.Person in project jbpm by kiegroup.
the class ActivityTest method testAdHocProcessDynamicTask.
@Test
public void testAdHocProcessDynamicTask() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-AdHocProcess.bpmn2");
ksession = createKnowledgeSession(kbase);
ProcessInstance processInstance = ksession.startProcess("AdHocProcess");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());
logger.debug("Triggering node");
ksession.signalEvent("Task1", null, processInstance.getId());
assertProcessInstanceActive(processInstance);
TestWorkItemHandler workItemHandler2 = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("OtherTask", workItemHandler2);
DynamicUtils.addDynamicWorkItem(processInstance, ksession, "OtherTask", new HashMap<String, Object>());
WorkItem workItem = workItemHandler2.getWorkItem();
assertNotNull(workItem);
ksession = restoreSession(ksession, true);
ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null);
ksession.signalEvent("User1", null, processInstance.getId());
assertProcessInstanceActive(processInstance);
ksession.insert(new Person());
ksession.signalEvent("Task3", null, processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations