@Test public void testShouldStartWorkflow() { ProcessInstanceResponse processInstanceRes = new ProcessInstanceResponse(); processInstanceRes.setProcessInstance(getProcessInstance()); MarriageRegnRequest marriageRegnRequest=MarriageRegnRequest.builder().marriageRegn(getMarriageRegnFromDB().get(0)).build(); when(propertiesManager.getWorkflowServiceHostName()).thenReturn(StringUtils.EMPTY); when(propertiesManager.getWorkflowServiceStartPath()).thenReturn(StringUtils.EMPTY); when(propertiesManager.getWorkflowServiceBusinessKey()).thenReturn(StringUtils.EMPTY); when(restTemplate.postForObject(any(URI.class), any(ProcessInstanceRequest.class),any(Class.class))).thenReturn(processInstanceRes); when(kafkaTemplate.send(any(String.class),any(Object.class))).thenReturn(new SendResult<>(null, null)); assertTrue(processInstanceRes.getProcessInstance().equals(workflowRepository.startWorkflow(marriageRegnRequest))); }
public ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest) { ProcessInstanceRequest processInstanceRequest = getProcessInstanceRequest(marriageRegnRequest); String url = propertiesManager.getWorkflowServiceHostName() + propertiesManager.getWorkflowServiceStartPath(); log.info("string url of the workflow appp : " + url + "WorkflowRepository processInstanceRequest : " + processInstanceRequest); ProcessInstanceResponse processInstanceRes = null; try { processInstanceRes = restTemplate.postForObject(url, processInstanceRequest, ProcessInstanceResponse.class); } catch (Exception e) { log.info("the exception from workflow service call : " + e); throw e; } System.err.println("::::processInstanceRes:::"+processInstanceRes); log.info("the response object from workflow : " + processInstanceRes.getProcessInstance().getId()); saveMarriageRegn(marriageRegnRequest, processInstanceRes.getProcessInstance().getId()); return processInstanceRes.getProcessInstance(); }
WorkflowRepository { public ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest) { ProcessInstanceRequest processInstanceRequest = getProcessInstanceRequest(marriageRegnRequest); String url = propertiesManager.getWorkflowServiceHostName() + propertiesManager.getWorkflowServiceStartPath(); log.info("string url of the workflow appp : " + url + "WorkflowRepository processInstanceRequest : " + processInstanceRequest); ProcessInstanceResponse processInstanceRes = null; try { processInstanceRes = restTemplate.postForObject(url, processInstanceRequest, ProcessInstanceResponse.class); } catch (Exception e) { log.info("the exception from workflow service call : " + e); throw e; } System.err.println("::::processInstanceRes:::"+processInstanceRes); log.info("the response object from workflow : " + processInstanceRes.getProcessInstance().getId()); saveMarriageRegn(marriageRegnRequest, processInstanceRes.getProcessInstance().getId()); return processInstanceRes.getProcessInstance(); } }
WorkflowRepository { public ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest) { ProcessInstanceRequest processInstanceRequest = getProcessInstanceRequest(marriageRegnRequest); String url = propertiesManager.getWorkflowServiceHostName() + propertiesManager.getWorkflowServiceStartPath(); log.info("string url of the workflow appp : " + url + "WorkflowRepository processInstanceRequest : " + processInstanceRequest); ProcessInstanceResponse processInstanceRes = null; try { processInstanceRes = restTemplate.postForObject(url, processInstanceRequest, ProcessInstanceResponse.class); } catch (Exception e) { log.info("the exception from workflow service call : " + e); throw e; } System.err.println("::::processInstanceRes:::"+processInstanceRes); log.info("the response object from workflow : " + processInstanceRes.getProcessInstance().getId()); saveMarriageRegn(marriageRegnRequest, processInstanceRes.getProcessInstance().getId()); return processInstanceRes.getProcessInstance(); }  }
WorkflowRepository { public ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest) { ProcessInstanceRequest processInstanceRequest = getProcessInstanceRequest(marriageRegnRequest); String url = propertiesManager.getWorkflowServiceHostName() + propertiesManager.getWorkflowServiceStartPath(); log.info("string url of the workflow appp : " + url + "WorkflowRepository processInstanceRequest : " + processInstanceRequest); ProcessInstanceResponse processInstanceRes = null; try { processInstanceRes = restTemplate.postForObject(url, processInstanceRequest, ProcessInstanceResponse.class); } catch (Exception e) { log.info("the exception from workflow service call : " + e); throw e; } System.err.println("::::processInstanceRes:::"+processInstanceRes); log.info("the response object from workflow : " + processInstanceRes.getProcessInstance().getId()); saveMarriageRegn(marriageRegnRequest, processInstanceRes.getProcessInstance().getId()); return processInstanceRes.getProcessInstance(); }  ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest); void saveMarriageRegn(MarriageRegnRequest marriageRegnRequest, String stateId); TaskResponse updateWorkflow(MarriageRegnRequest marriageRegnRequest); void updateMarriagRegn(MarriageRegnRequest marriageRegnRequest); }
WorkflowRepository { public ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest) { ProcessInstanceRequest processInstanceRequest = getProcessInstanceRequest(marriageRegnRequest); String url = propertiesManager.getWorkflowServiceHostName() + propertiesManager.getWorkflowServiceStartPath(); log.info("string url of the workflow appp : " + url + "WorkflowRepository processInstanceRequest : " + processInstanceRequest); ProcessInstanceResponse processInstanceRes = null; try { processInstanceRes = restTemplate.postForObject(url, processInstanceRequest, ProcessInstanceResponse.class); } catch (Exception e) { log.info("the exception from workflow service call : " + e); throw e; } System.err.println("::::processInstanceRes:::"+processInstanceRes); log.info("the response object from workflow : " + processInstanceRes.getProcessInstance().getId()); saveMarriageRegn(marriageRegnRequest, processInstanceRes.getProcessInstance().getId()); return processInstanceRes.getProcessInstance(); }  ProcessInstance startWorkflow(MarriageRegnRequest marriageRegnRequest); void saveMarriageRegn(MarriageRegnRequest marriageRegnRequest, String stateId); TaskResponse updateWorkflow(MarriageRegnRequest marriageRegnRequest); void updateMarriagRegn(MarriageRegnRequest marriageRegnRequest); static final String ACTION; }