Changed sdncRequestId to SDNCA_requestId 04/74504/1
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Tue, 11 Dec 2018 15:47:33 +0000 (10:47 -0500)
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Tue, 11 Dec 2018 15:48:22 +0000 (10:48 -0500)
Updated junit groovy test for sdnc adapter
Changed to set sdncRequestId to be set to SDNCA_requestId so
correlation happens during callback.

Change-Id: I6532a676caa4332a32c89ef0ff2e2739d7e8cb56
Issue-ID: SO-1320
Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterTest.groovy

index a5e7c0f..a430cdb 100644 (file)
@@ -58,11 +58,10 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
                        execution.setVariable("SDNCA_InterimNotify", false)
 
                        String requestId = execution.getVariable("mso-request-id")
-                       if(isNotBlank(requestId)){
-                               execution.setVariable(Prefix + "requestId", requestId)
-                       }else{
+                       if(isBlank(requestId)){
                                exceptionUtil.buildAndThrowWorkflowException(execution, 400, 'mso-request-id not provided by calling flow')
                        }
+
                        // Authorization Info
                        String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
 
@@ -124,6 +123,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
 
                        //calling process should pass a generated uuid if sending multiple sdnc requests
                        def sdncRequestId = utils.getNodeText(requestHeader, "RequestId")
+                       execution.setVariable(Prefix + "requestId", sdncRequestId)
 
                        // Prepare SDNC Request to the SDNC Adapter
                        String sdncAdapterRequest = """
index ec69bf5..e351210 100644 (file)
@@ -844,11 +844,11 @@ def sdncAdapterResponseError =
                verify(mockExecution).setVariable("asynchronousResponseTimeout",false)
                verify(mockExecution).setVariable("continueListening",false)
                verify(mockExecution).setVariable("serviceConfigActivate",false)
-               verify(mockExecution).setVariable("SDNCA_requestId", "testReqId")
                verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false)
                verify(mockExecution).setVariable("SDNCA_InterimNotify",false)
                verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic dGVzdDp0ZXN0")
                verify(mockExecution).setVariable("source","")
+               verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
                verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest)
        }