use of objects.Person in project jbpm by kiegroup.
the class ActivityTest method testBusinessRuleTaskFireLimit.
@Test
public void testBusinessRuleTaskFireLimit() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-BusinessRuleTaskLoop.bpmn2", "BPMN2-BusinessRuleTaskInfiniteLoop.drl");
ksession = createKnowledgeSession(kbase);
ksession.insert(new Person());
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> {
ksession.startProcess("BPMN2-BusinessRuleTask");
}).withMessageContaining("Fire rule limit reached 10000");
}
use of objects.Person in project jbpm by kiegroup.
the class ActivityTest method testScriptTaskJS.
@Test
public void testScriptTaskJS() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ScriptTaskJS.bpmn2");
ksession = createKnowledgeSession(kbase);
TestWorkItemHandler handler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
Map<String, Object> params = new HashMap<String, Object>();
params.put("name", "krisv");
Person person = new Person();
person.setName("krisv");
params.put("person", person);
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("ScriptTask", params);
assertEquals("Entry", processInstance.getVariable("x"));
assertNull(processInstance.getVariable("y"));
ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null);
assertEquals("Exit", getProcessVarValue(processInstance, "y"));
assertEquals("tester", processInstance.getVariable("surname"));
}
use of objects.Person in project jbpm by kiegroup.
the class ActivityTest method testAdHocProcessDynamicSubProcess.
@Test
public void testAdHocProcessDynamicSubProcess() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-AdHocProcess.bpmn2", "BPMN2-MinimalProcess.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.addDynamicSubProcess(processInstance, ksession, "Minimal", new HashMap<String, Object>());
ksession = restoreSession(ksession, true);
ksession.signalEvent("User1", null, processInstance.getId());
assertProcessInstanceActive(processInstance);
ksession.insert(new Person());
ksession.signalEvent("Task3", null, processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
}
use of objects.Person in project jbpm by kiegroup.
the class StandaloneBPMNProcessTest method testIntermediateCatchEventCondition.
@Test
@Ignore("process does not complete")
public void testIntermediateCatchEventCondition() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-IntermediateCatchEventCondition.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertThat(processInstance.getState()).isEqualTo(ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession);
// now activate condition
Person person = new Person();
person.setName("Jack");
ksession.insert(person);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of objects.Person in project jbpm by kiegroup.
the class BusinessRuleTaskHandlerTest method testDrlStatelessBusinessRuleTaskNoScanner.
@Test
public void testDrlStatelessBusinessRuleTaskNoScanner() {
TestWorkItemManager manager = new TestWorkItemManager();
BusinessRuleTaskHandler handler = new BusinessRuleTaskHandler(GROUP_ID, ARTIFACT_ID, VERSION);
WorkItemImpl workItem = new WorkItemImpl();
workItem.setId(999);
Person person = new Person("john");
workItem.setParameter("person", person);
handler.executeWorkItem(workItem, manager);
Map<String, Object> results = manager.getResults(workItem.getId());
assertNotNull(results);
assertEquals(1, results.size());
assertEquals(35, ((Person) results.get("person")).getAge().intValue());
}
Aggregations