use of org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler in project jbpm by kiegroup.
the class JaxWSServiceTaskTest method testOneWayServiceInvocationProcessWSHandler.
@Test
public void testOneWayServiceInvocationProcessWSHandler() throws Exception {
KieBase kbase = readKnowledgeBase();
KieSession ksession = createSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new WebServiceWorkItemHandler(ksession));
Map<String, Object> params = new HashMap<String, Object>();
params.put("s", "john");
params.put("mode", "oneway");
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("org.jboss.qa.jbpm.CallWS", params);
logger.info("Execution finished");
String variable = (String) processInstance.getVariable("s");
assertNull(variable);
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
}
use of org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler in project jbpm by kiegroup.
the class WebServiceInvokeTest method testInterfaceNamePassedViaAssignemnt.
@Test
@RunAsClient
public void testInterfaceNamePassedViaAssignemnt() throws Exception {
System.out.println("### Running proccess ...");
KieSession ksession = getSession(hws.getResource(HelloWebService.BPMN_CALL_WEB_SERVICE_NO_INTERFACE));
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new WebServiceWorkItemHandler(ksession));
HashMap<String, Object> arguments = new HashMap<String, Object>();
arguments.put("parameter", "No Name");
arguments.put("mode", "SYNC");
WorkflowProcessInstance pi = (WorkflowProcessInstance) ksession.startProcess(HelloWebService.PROCESS_CALL_WEB_SERVICE, arguments);
Assertions.assertThat(pi.getVariable("result")).as("WebService call failed.").isEqualTo("Hello No Name");
Assertions.assertThat(pi.getState()).as("Process did not finish.").isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler in project jbpm by kiegroup.
the class WebServiceInvokeTest method testWebServiceSync.
@Test
@RunAsClient
public void testWebServiceSync() throws Exception {
System.out.println("### Running proccess ...");
KieSession ksession = getSession(hws.getResource(HelloWebService.BPMN_CALL_WEB_SERVICE_NO_INTERFACE));
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new WebServiceWorkItemHandler(ksession));
HashMap<String, Object> arguments = new HashMap<String, Object>();
arguments.put("parameter", "Fredy");
arguments.put("mode", "SYNC");
WorkflowProcessInstance pi = (WorkflowProcessInstance) ksession.startProcess(HelloWebService.PROCESS_CALL_WEB_SERVICE, arguments);
Assertions.assertThat(pi.getVariable("result")).as("WebService call failed.").isEqualTo("Hello Fredy");
Assertions.assertThat(pi.getState()).as("Process did not finish.").isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler in project jbpm by kiegroup.
the class JaxWSServiceTaskTest method testServiceInvocationWithMultipleParams.
@Test
public void testServiceInvocationWithMultipleParams() throws Exception {
KieBase kbase = readKnowledgeBase();
KieSession ksession = createSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new WebServiceWorkItemHandler(ksession));
Map<String, Object> params = new HashMap<String, Object>();
params.put("s", new String[] { "john", "doe" });
params.put("mode", "sync");
WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("multiparamws", params);
String variable = (String) processInstance.getVariable("s2");
assertEquals("Hello doe, john", variable);
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
}
Aggregations