use of org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder in project so by onap.
the class WorkflowContextHolderTest method testProcessCallback.
@Test
public void testProcessCallback() throws Exception {
String requestId = UUID.randomUUID().toString();
String message = "TEST MESSATGE";
String responseMessage = "Successfully processed request";
int testCode = 200;
WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
callbackResponse.setMessage(message);
callbackResponse.setResponse(responseMessage);
callbackResponse.setStatusCode(testCode);
contextHolder.processCallback("testAsyncProcess", "process-instance-id", requestId, callbackResponse);
// same object returned
WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
if (contextFound == null)
throw new Exception("Expected to find Context Object");
WorkflowResponse testResponse = contextFound.getWorkflowResponse();
Assert.assertEquals(200, testResponse.getMessageCode());
Assert.assertEquals(message, testResponse.getMessage());
Assert.assertEquals(responseMessage, testResponse.getResponse());
}
Aggregations