From fcdee7f04744f81a3247c0d692efe04feccc0dfb Mon Sep 17 00:00:00 2001 From: vinal patel Date: Tue, 5 Mar 2019 15:41:24 -0500 Subject: Resource resolution using REST -bug fix Change-Id: I47c9b3738bbca84e1d3a734e16c4ea6ae7e93a23 Issue-ID: CCSDK-1131 Signed-off-by: vinal patel --- .../resolution/processor/RestResourceResolutionProcessor.kt | 9 +++------ .../resource/dict/ResourceDictionaryConstants.kt | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt index 4daa46e5..d8472ede 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt @@ -17,10 +17,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor -import com.fasterxml.jackson.databind.node.ArrayNode -import com.fasterxml.jackson.databind.node.JsonNodeFactory -import com.fasterxml.jackson.databind.node.NullNode -import com.fasterxml.jackson.databind.node.ObjectNode +import com.fasterxml.jackson.databind.node.* import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.RestResourceSource import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService @@ -56,7 +53,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS // Check if It has Input val value = raRuntimeService.getInputValue(resourceAssignment.name) - if (value != null && value !is NullNode) { + if (value !is MissingNode && value !is NullNode) { logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)") ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value) } else { @@ -77,7 +74,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS // Get the Rest Client Service val restClientService = blueprintWebClientService(resourceAssignment, sourceProperties) val response = restClientService.getResource(urlPath, String::class.java) - if (response.isNotBlank()) { + if (response.isBlank()) { logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)") } else { populateResource(resourceAssignment, sourceProperties, response, path) diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt index d33a2f04..62ed4047 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt +++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt @@ -24,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict object ResourceDictionaryConstants { const val SOURCE_INPUT = "input" const val SOURCE_DEFAULT = "default" - const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data" + const val SOURCE_PRIMARY_CONFIG_DATA = "rest" const val SOURCE_PRIMARY_DB = "primary-db" const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary" -- cgit 1.2.3-korg