Search in sources :

Example 1 with WorkflowContextHolder

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());
}
Also used : WorkflowContextHolder(org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder) WorkflowContext(org.onap.so.bpmn.common.workflow.context.WorkflowContext) WorkflowCallbackResponse(org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse) WorkflowResponse(org.onap.so.bpmn.common.workflow.context.WorkflowResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 WorkflowCallbackResponse (org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse)1 WorkflowContext (org.onap.so.bpmn.common.workflow.context.WorkflowContext)1 WorkflowContextHolder (org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder)1 WorkflowResponse (org.onap.so.bpmn.common.workflow.context.WorkflowResponse)1