diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-10-13 23:58:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-10-13 23:58:24 +0000 |
commit | 92a362446eda504dc1f3e42d0cb957ac51c3f1db (patch) | |
tree | 473f7d0b1253db324fe8781dd2d3c4982c33652a /ms | |
parent | 1c9ca7b45163496af84fab3b7591c7353b69baa3 (diff) | |
parent | fb0e9f71db43ffaa05d987b03c857887c520e739 (diff) |
Merge "master: missing input shouldn't fail process"
Diffstat (limited to 'ms')
2 files changed, 21 insertions, 16 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt index e2fef746b..4c38517a7 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt @@ -53,7 +53,7 @@ open class DatabaseResourceSource : ResourceSourceProperties() { var outputKeyMapping: MutableMap<String, String>? = null @get:JsonProperty("key-dependencies") - lateinit var keyDependencies: MutableList<String> + var keyDependencies: MutableList<String>? = null } open class RestResourceSource : ResourceSourceProperties() { 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 131e2ae9a..21098797b 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 @@ -20,12 +20,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty -import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.slf4j.LoggerFactory import org.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service @@ -38,6 +37,9 @@ import org.springframework.stereotype.Service @Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { + companion object InputResourceResolutionProcessor { + private val logger = LoggerFactory.getLogger(InputResourceResolutionProcessor::class.toString()) + } override fun getName(): String { return "${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input" @@ -52,10 +54,8 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to process input resource resolution in template key ($resourceAssignment) assignments." - throw e.updateErrorMessage( - ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg, - "Wrong input value was set." - ) + ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) + logger.error(errorMsg) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e) @@ -72,17 +72,22 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") - val resourceSourceProperties = checkNotNull(resourceSource.properties) { - "failed to get source properties for $dName " - } - val sourceProperties = - JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java) + try { - val keyDependency = checkNotNull(sourceProperties.keyDependencies) { - "failed to get input-key-mappings for $dName under $dSource properties" + val resourceSourceProperties = checkNotNull(resourceSource.properties) { + "failed to get source properties for $dName " + } + val sourceProperties = + JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java) + + val keyDependency = checkNotNull(sourceProperties.keyDependencies) { + "failed to get input-key-mappings for $dName under $dSource properties" + } + // keyDependency = service-instance.service-instance-id + setFromInputKeyDependencies(keyDependency, resourceAssignment); // New API which picks attribute from Input + } catch (e: IllegalStateException) { + throw BluePrintProcessorException(e) } - // keyDependency = service-instance.service-instance-id - setFromInputKeyDependencies(keyDependency, resourceAssignment); // New API which picks arrtibute from Input } override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { |