use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class FlowTest method testExclusiveSplitDefault.
@Test
public void testExclusiveSplitDefault() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ExclusiveSplitDefault.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "NotFirst");
params.put("y", "Second");
ProcessInstance processInstance = ksession.startProcess("com.sample.test", params);
assertProcessInstanceCompleted(processInstance);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class FlowTest method testExclusiveSplitXPathAdvanced2.
@Test
public void testExclusiveSplitXPathAdvanced2() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ExclusiveSplitXPath-advanced-vars-not-signaled.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element hi = doc.createElement("hi");
Element ho = doc.createElement("ho");
hi.appendChild(ho);
Attr attr = doc.createAttribute("value");
ho.setAttributeNode(attr);
attr.setValue("a");
params.put("x", hi);
params.put("y", "Second");
ProcessInstance processInstance = ksession.startProcess("com.sample.test", params);
assertProcessInstanceCompleted(processInstance);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class FlowTest method testExclusiveSplit.
@Test
public void testExclusiveSplit() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ExclusiveSplit.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email", new SystemOutWorkItemHandler());
Map<String, Object> params = new HashMap<String, Object>();
params.put("x", "First");
params.put("y", "Second");
ProcessInstance processInstance = ksession.startProcess("com.sample.test", params);
assertProcessInstanceCompleted(processInstance);
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventSignalWithTransformation.
@Test
public void testIntermediateCatchEventSignalWithTransformation() throws Exception {
KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventSignalWithTransformation.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
ksession = restoreSession(ksession, true);
// now signal process instance
ksession.signalEvent("MyMessage", "SomeValue", processInstance.getId());
assertProcessInstanceFinished(processInstance, ksession);
assertNodeTriggered(processInstance.getId(), "StartProcess", "UserTask", "EndProcess", "event");
String var = getProcessVarValue(processInstance, "x");
assertThat(var).isNotNull();
assertThat(var).isEqualTo("SOMEVALUE");
}
use of org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler in project jbpm by kiegroup.
the class ActivityTest method testServiceTaskNoInterfaceName.
@Test
public void testServiceTaskNoInterfaceName() throws Exception {
KieBase kbase = createKnowledgeBase("BPMN2-ServiceTask-web-service.bpmn2");
ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new SystemOutWorkItemHandler() {
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
assertEquals("SimpleService", workItem.getParameter("Interface"));
assertEquals("hello", workItem.getParameter("Operation"));
assertEquals("java.lang.String", workItem.getParameter("ParameterType"));
assertEquals("##WebService", workItem.getParameter("implementation"));
assertEquals("hello", workItem.getParameter("operationImplementationRef"));
assertEquals("SimpleService", workItem.getParameter("interfaceImplementationRef"));
super.executeWorkItem(workItem, manager);
}
});
Map<String, Object> params = new HashMap<String, Object>();
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("org.jboss.qa.jbpm.CallWS", params);
assertProcessInstanceFinished(processInstance, ksession);
}
Aggregations