diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2020-12-09 19:49:48 -0500 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-03-17 22:31:31 -0400 |
commit | b96b44d6d7ca11dbbc3ad4bd2194df31fba5efb6 (patch) | |
tree | c10077ebb496410271ca3d07ca8896048c817bd9 /ms/blueprintsprocessor/functions | |
parent | ae588292c67e20c5cae8cb3c899957aac79a676d (diff) |
Refactoring to enable on_failure for imperative workflow
BlueprintError needs to associate errors with the steps in which they occurred
in order for imperative workflow to handle on_failure properly.
Made stepName more accessible and corrected places where stepName was assigned to nodeTemplateName.
Issue-ID: CCSDK-3219
Change-Id: I7e5805745c63558cff6be533e1b99c32ad06c3db
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/functions')
22 files changed, 41 insertions, 41 deletions
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt index 27ce7a214..88cf0992f 100644 --- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt @@ -112,7 +112,7 @@ class ComponentRemoteAnsibleExecutorTest { } // then - assertTrue(bluePrintRuntimeService.getBlueprintError().errors.isEmpty()) + assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().isEmpty()) } @Test @@ -146,7 +146,7 @@ class ComponentRemoteAnsibleExecutorTest { } // then - val errors = bluePrintRuntimeService.getBlueprintError().errors + val errors = bluePrintRuntimeService.getBlueprintError().allErrors() assertEquals(1, errors.size) } @@ -187,7 +187,7 @@ class ComponentRemoteAnsibleExecutorTest { } // then - val errors = bluePrintRuntimeService.getBlueprintError().errors + val errors = bluePrintRuntimeService.getBlueprintError().allErrors() assertEquals(1, errors.size) } diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt index acdbe070f..99de66489 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt @@ -247,7 +247,7 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get error in our output properties - assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 1) + assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 1) assertEquals( ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( @@ -328,7 +328,7 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get success - assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 0) + assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 0) assertEquals( ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( @@ -377,7 +377,7 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get success - assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 0) + assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 0) assertEquals( ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt index db549f334..201895cc6 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt @@ -174,7 +174,7 @@ open class K8sProfileUploadComponent( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> { diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt index cb759e534..2d4f56265 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt @@ -165,7 +165,7 @@ open class K8sConfigTemplateComponent( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> { diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt index 2e7b34e01..c9c1c1032 100644 --- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt +++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt @@ -201,7 +201,7 @@ open class K8sConfigValueComponent( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } private enum class OperationType { diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt index de6eb6b40..aa13fa0d7 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt @@ -69,7 +69,6 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError() - .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}") + addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}") } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt index 7911559ae..b32ccea13 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt @@ -56,8 +56,7 @@ open class ComponentJythonExecutor( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError() - .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}") + addError("Failed in ComponentJythonExecutor : ${runtimeException.message}") } private suspend fun populateJythonComponentInstance() { diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt index a809d8f18..f059604ff 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt @@ -339,11 +339,11 @@ open class ComponentRemotePythonExecutor( } } - private fun noBlueprintErrors() = bluePrintRuntimeService.getBlueprintError().errors.isEmpty() + private fun noBlueprintErrors() = + bluePrintRuntimeService.getBlueprintError().stepErrors(stepName).isNullOrEmpty() override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError() - .addError("Failed in ComponentRemotePythonExecutor : ${runtimeException.message}") + addError("Failed in ComponentRemotePythonExecutor : ${runtimeException.message}") } private fun formatNestedJsonNode(node: JsonNode): String { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt index 6a2e128e2..ada1a720e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt @@ -115,7 +115,8 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re bluePrintRuntimeService, nodeTemplateName, artifactPrefixNames, - properties + properties, + stepName ) // provide indexed result in output if we have multiple resolution @@ -140,6 +141,6 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index 46410a859..ea420dca4 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -65,7 +65,8 @@ interface ResourceResolutionService { bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTemplateName: String, artifactNames: List<String>, - properties: Map<String, Any> + properties: Map<String, Any>, + stepName: String ): ResourceResolutionResult suspend fun resolveResources( @@ -128,7 +129,8 @@ open class ResourceResolutionServiceImpl( bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTemplateName: String, artifactNames: List<String>, - properties: Map<String, Any> + properties: Map<String, Any>, + stepName: String ): ResourceResolutionResult { val resourceAssignmentRuntimeService = @@ -150,11 +152,10 @@ open class ResourceResolutionServiceImpl( val failedResolution = resourceAssignmentList.filter { it.status != "success" && it.property?.required == true }.map { it.name } if (failedResolution.isNotEmpty()) { - // The following error message is returned by default to handle a scenario when - // error message comes empty even when resolution has actually failed. - // Example: input-source type resolution seems to fail with no error code. - bluePrintRuntimeService.getBlueprintError().errors.add("Failed to resolve required resources($failedResolution)") - bluePrintRuntimeService.getBlueprintError().errors.addAll(resourceAssignmentRuntimeService.getBlueprintError().errors) + val errorMessages = mutableListOf("Failed to resolve required values: $failedResolution").apply { + this.addAll(resourceAssignmentRuntimeService.getBlueprintError().allErrors()) + } + bluePrintRuntimeService.getBlueprintError().addErrors(stepName, errorMessages) } } return ResourceResolutionResult(templateMap, assignmentMap) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt index d9a5ba0d1..a1f3249ab 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt @@ -116,7 +116,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() { } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } /** Generates aggregated request payload for Ip Assign mS. Parses the resourceassignments of diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt index 903c1b3fa..4f656a8f0 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt @@ -118,7 +118,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() { } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } /** Generates aggregated request payload for Naming mS. Parses the resourceassignments of diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt index 4f33c8252..5e834d73d 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt @@ -87,8 +87,7 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBlueprintError() - .addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}") + addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}") ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, runtimeException.message) } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt index 640b0f5fe..db5307f17 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt @@ -183,6 +183,6 @@ open class DatabaseResourceAssignmentProcessor( } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt index f90a8b5fa..e904ebcb4 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt @@ -64,6 +64,6 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() { } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt index d85449b19..c3add86fd 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt @@ -91,6 +91,6 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt index b5bafad59..ce00ac17b 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt @@ -191,11 +191,11 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig } fun addError(type: String, name: String, error: String) { - raRuntimeService.getBlueprintError().addError(type, name, error) + raRuntimeService.getBlueprintError().addError(type, name, error, getName()) } fun addError(error: String) { - raRuntimeService.getBlueprintError().addError(error) + raRuntimeService.getBlueprintError().addError(error, getName()) } fun isTemplateKeyValueNull(resourceAssignment: ResourceAssignment): Boolean { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt index 0085b1624..c17e14000 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt @@ -187,6 +187,6 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt index 80ba8315b..74a88b4e3 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt @@ -145,7 +145,8 @@ class ResourceResolutionComponentTest { any(), any(), any<List<String>>(), - any<MutableMap<String, Any>>() + any<MutableMap<String, Any>>(), + "step" ) } returns ResourceResolutionResult(mutableMapOf(), mutableMapOf()) @@ -168,7 +169,7 @@ class ResourceResolutionComponentTest { every { bluePrintRuntimeService.getBlueprintError() } returns blueprintError resourceResolutionComponent.recoverNB(exception, executionRequest) - assertEquals(1, blueprintError.errors.size) + assertEquals(1, blueprintError.allErrors().size) } } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index 00fb39515..a1de557d5 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -182,7 +182,8 @@ class ResourceResolutionServiceTest { bluePrintRuntimeService, "resource-assignment", artifactNames, - props + props, + "mockStep" ) }.let { assertEquals(artifactNames.toSet(), it.templateMap.keys) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt index de46fe6f3..77c90ba51 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt @@ -110,7 +110,7 @@ class MockRestResourceResolutionProcessor( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { - raRuntimeService.getBlueprintError().addError(runtimeException.message!!) + addError(runtimeException.message!!) } private fun blueprintWebClientService(resourceAssignment: ResourceAssignment): MockBlueprintWebClientService { diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt index 59c010eb5..cb44364c0 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt +++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt @@ -66,7 +66,6 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBlueprintError() - .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}") + addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}") } } |