diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/message-lib')
2 files changed, 15 insertions, 10 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtils.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtils.kt index b4817cd8a..644bd7ba1 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtils.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtils.kt @@ -17,8 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message.utils import io.micrometer.core.instrument.Tag -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonExecutionServiceData import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants import org.onap.ccsdk.cds.controllerblueprints.core.defaultToUUID import kotlin.math.max @@ -41,13 +40,11 @@ class BlueprintMessageUtils { fun getMessageLogData(message: Any): String = when (message) { - is ExecutionServiceInput -> { + is CommonExecutionServiceData -> { val actionIdentifiers = message.actionIdentifiers - "CBA(${actionIdentifiers.blueprintName}/${actionIdentifiers.blueprintVersion}/${actionIdentifiers.actionName})" - } - is ExecutionServiceOutput -> { - val actionIdentifiers = message.actionIdentifiers - "CBA(${actionIdentifiers.blueprintName}/${actionIdentifiers.blueprintVersion}/${actionIdentifiers.actionName})" + val commonHeaders = message.commonHeader + "requestID(${commonHeaders.requestId}), subrequestID(${commonHeaders.subRequestId}) " + + "CBA(${actionIdentifiers.blueprintName}/${actionIdentifiers.blueprintVersion}/${actionIdentifiers.actionName})" } else -> "message($message)" } diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtilsTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtilsTest.kt index de9ca2c44..9b5ca62f6 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtilsTest.kt +++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtilsTest.kt @@ -21,6 +21,7 @@ import io.mockk.every import io.mockk.mockkStatic import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants @@ -54,14 +55,20 @@ class BlueprintMessageUtilsTest { @Test fun testGetMessageLogData() { + var header = CommonHeader().apply { + requestId = "myrequestid" + subRequestId = "mysubrequestid" + } + val input = ExecutionServiceInput().apply { actionIdentifiers = ActionIdentifiers().apply { blueprintName = "bpInput" blueprintVersion = "1.0.0-input" actionName = "bpActionInput" } + commonHeader = header } - val expectedOnInput = "CBA(bpInput/1.0.0-input/bpActionInput)" + val expectedOnInput = "requestID(myrequestid), subrequestID(mysubrequestid) CBA(bpInput/1.0.0-input/bpActionInput)" val output = ExecutionServiceInput().apply { actionIdentifiers = ActionIdentifiers().apply { @@ -69,8 +76,9 @@ class BlueprintMessageUtilsTest { blueprintVersion = "1.0.0-output" actionName = "bpActionOutput" } + commonHeader = header } - val expectedOnOutput = "CBA(bpOutput/1.0.0-output/bpActionOutput)" + val expectedOnOutput = "requestID(myrequestid), subrequestID(mysubrequestid) CBA(bpOutput/1.0.0-output/bpActionOutput)" val otherMessage = "some other message" val expectedOnOtherMessage = "message(some other message)" |