aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtils.kt13
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/utils/BlueprintMessageUtilsTest.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt20
3 files changed, 23 insertions, 22 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)"
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
index 924aed898..8009bbb8a 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
@@ -33,16 +33,18 @@ import java.util.UUID
* DATE : 8/15/2018
*/
-open class ExecutionServiceInput {
-
- @get:ApiModelProperty(required = false, hidden = true)
- var correlationUUID: String = UUID.randomUUID().toString()
-
+abstract class CommonExecutionServiceData {
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
+}
+
+open class ExecutionServiceInput : CommonExecutionServiceData() {
+
+ @get:ApiModelProperty(required = false, hidden = true)
+ var correlationUUID: String = UUID.randomUUID().toString()
@get:ApiModelProperty(
required = true,
@@ -57,17 +59,11 @@ open class ExecutionServiceInput {
var stepData: StepData? = null
}
-open class ExecutionServiceOutput {
+open class ExecutionServiceOutput : CommonExecutionServiceData() {
@get:ApiModelProperty(required = false, hidden = true)
var correlationUUID: String? = null
- @get:ApiModelProperty(required = true, value = "Headers providing request context.")
- lateinit var commonHeader: CommonHeader
-
- @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
- lateinit var actionIdentifiers: ActionIdentifiers
-
@get:ApiModelProperty(required = true, value = "Status of the request.")
lateinit var status: Status