summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2020-10-13 12:20:44 -0400
committerOleg Mitsura <oleg.mitsura@amdocs.com>2020-10-13 12:20:44 -0400
commitfb0e9f71db43ffaa05d987b03c857887c520e739 (patch)
treec79e61a531c286266d5d0b9a04eb0a8684b4cebf /ms
parentcef859c192e84d61f2e98afc6f208772c1ac4699 (diff)
master: missing input shouldn't fail process
Issue-ID: CCSDK-2876 Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: I76279fee8adc91a3aed72c624c24e93c9cf9dea4
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt35
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) {