Search in sources :

Example 1 with CXFWebServiceWorkItemHandler

use of com.salaboy.jbpm5.dev.guide.workitems.CXFWebServiceWorkItemHandler in project jBPM5-Developer-Guide by Salaboy.

the class GenericWebServiceTaskTest method testPatientInsuranceCheckProcessFalse.

/**
     * Simple test showing the interaction between a process and a web service.
     * This method tests the case of an invalid response from the web-service.
     */
@Test
public void testPatientInsuranceCheckProcessFalse() {
    HashMap<String, Object> input = new HashMap<String, Object>();
    input.put("bedrequest_patientname", testPatients.get("brotha").getId());
    //Register a synchronous work item handler that will invoke a web service
    CXFWebServiceWorkItemHandler webServiceHandler = new CXFWebServiceWorkItemHandler();
    session.getWorkItemManager().registerWorkItemHandler("Web Service", webServiceHandler);
    WorkflowProcessInstance pI = (WorkflowProcessInstance) session.startProcess("NewPatientInsuranceCheck", input);
    //'brotha' is not inssured according to the web service we have configured.
    //The response should be invalid.
    assertEquals(ProcessInstance.STATE_COMPLETED, pI.getState());
    assertEquals(Boolean.FALSE, pI.getVariable("checkinresults_patientInsured"));
    System.out.println("-> Insurance Valid = " + pI.getVariable("checkinresults_patientInsured"));
}
Also used : HashMap(java.util.HashMap) CXFWebServiceWorkItemHandler(com.salaboy.jbpm5.dev.guide.workitems.CXFWebServiceWorkItemHandler) WorkflowProcessInstance(org.drools.runtime.process.WorkflowProcessInstance) Test(org.junit.Test)

Example 2 with CXFWebServiceWorkItemHandler

use of com.salaboy.jbpm5.dev.guide.workitems.CXFWebServiceWorkItemHandler in project jBPM5-Developer-Guide by Salaboy.

the class GenericWebServiceTaskTest method testPatientInsuranceCheckProcessTrue.

/**
     * Simple test showing the interaction between a process and a web service.
     * This method tests the case of an invalid response from the web-service.
     */
@Test
public void testPatientInsuranceCheckProcessTrue() {
    HashMap<String, Object> input = new HashMap<String, Object>();
    input.put("bedrequest_patientname", testPatients.get("salaboy").getId());
    //Register a synchronous work item handler that will invoke a web service
    CXFWebServiceWorkItemHandler webServiceHandler = new CXFWebServiceWorkItemHandler();
    session.getWorkItemManager().registerWorkItemHandler("Web Service", webServiceHandler);
    WorkflowProcessInstance pI = (WorkflowProcessInstance) session.startProcess("NewPatientInsuranceCheck", input);
    //'salaboy' is correctly inssured according to the web service we have configured.
    //The response should be valid.
    assertEquals(ProcessInstance.STATE_COMPLETED, pI.getState());
    assertEquals(Boolean.TRUE, pI.getVariable("checkinresults_patientInsured"));
    System.out.println("-> Insurance Valid = " + pI.getVariable("checkinresults_patientInsured"));
}
Also used : HashMap(java.util.HashMap) CXFWebServiceWorkItemHandler(com.salaboy.jbpm5.dev.guide.workitems.CXFWebServiceWorkItemHandler) WorkflowProcessInstance(org.drools.runtime.process.WorkflowProcessInstance) Test(org.junit.Test)

Aggregations

CXFWebServiceWorkItemHandler (com.salaboy.jbpm5.dev.guide.workitems.CXFWebServiceWorkItemHandler)2 HashMap (java.util.HashMap)2 WorkflowProcessInstance (org.drools.runtime.process.WorkflowProcessInstance)2 Test (org.junit.Test)2