use of org.jbpm.bpmn2.objects.TestWorkItemHandler in project jbpm by kiegroup.
the class StructureRefTest method testDefaultObjectStructureRef.
@Test
public void testDefaultObjectStructureRef() throws Exception {
String value = "simple text for testing";
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-DefaultObjectStructureRef.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ProcessInstance processInstance = ksession.startProcess("StructureRef");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
Map<String, Object> res = new HashMap<String, Object>();
res.put("testHT", value);
ksession.getWorkItemManager().completeWorkItem(workItemHandler.getWorkItem().getId(), res);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.bpmn2.objects.TestWorkItemHandler in project jbpm by kiegroup.
the class StructureRefTest method testIntegerStructureRef.
@Test
public void testIntegerStructureRef() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntegerStructureRef.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ProcessInstance processInstance = ksession.startProcess("StructureRef");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
Map<String, Object> res = new HashMap<String, Object>();
res.put("testHT", "25");
ksession.getWorkItemManager().completeWorkItem(workItemHandler.getWorkItem().getId(), res);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.bpmn2.objects.TestWorkItemHandler in project jbpm by kiegroup.
the class StructureRefTest method testNoStructureRef.
@Test
public void testNoStructureRef() throws Exception {
Person person = new Person();
person.setId(1L);
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-NoStructureRef.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ProcessInstance processInstance = ksession.startProcess("StructureRef");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
Map<String, Object> res = new HashMap<String, Object>();
res.put("testHT", person);
ksession.getWorkItemManager().completeWorkItem(workItemHandler.getWorkItem().getId(), res);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.bpmn2.objects.TestWorkItemHandler in project jbpm by kiegroup.
the class StructureRefTest method testStringStructureRef.
@Test
public void testStringStructureRef() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-StringStructureRef.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ProcessInstance processInstance = ksession.startProcess("StructureRef");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
Map<String, Object> res = new HashMap<String, Object>();
res.put("testHT", "test value");
ksession.getWorkItemManager().completeWorkItem(workItemHandler.getWorkItem().getId(), res);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
use of org.jbpm.bpmn2.objects.TestWorkItemHandler in project jbpm by kiegroup.
the class StructureRefTest method testObjectStructureRef.
@Test
public void testObjectStructureRef() throws Exception {
String personAsXml = "<org.jbpm.bpmn2.objects.Person><id>1</id><name>john</name></org.jbpm.bpmn2.objects.Person>";
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-ObjectStructureRef.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);
TestWorkItemHandler workItemHandler = new TestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler);
ProcessInstance processInstance = ksession.startProcess("StructureRef");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
Map<String, Object> res = new HashMap<String, Object>();
res.put("testHT", personAsXml);
ksession.getWorkItemManager().completeWorkItem(workItemHandler.getWorkItem().getId(), res);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
}
Aggregations