From 7aa5df8cb06e0197d0d750f479c7b09b695b534c Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 11 Feb 2019 17:23:48 -0500 Subject: Fixes: manual integration test of CDS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - support to overwrite cba - fix map to json - finish meshing - fix python context not having the bluePrintRuntimeService injected - load all properties in the properties store Issue-ID: CCSDK-414 Change-Id: I6b65201529d0ffd9c3e18023a33e0081236b01de Signed-off-by: Alexis de Talhouët --- .../resource/resolution/ResourceResolutionService.kt | 13 ++++++------- .../resource/resolution/utils/ResourceAssignmentUtils.kt | 6 +----- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/main') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index 38e5c95fd..ce0f060ee 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -17,11 +17,13 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution +import com.fasterxml.jackson.databind.node.JsonNodeFactory import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintTemplateService import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition @@ -89,25 +91,22 @@ class ResourceResolutionService { val resourceDictionaries: MutableMap = JacksonUtils.getMapFromFile(dictionaryFile, ResourceDefinition::class.java) ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions") + // Resolve resources executeProcessors(bluePrintRuntimeService, resourceDictionaries, resourceAssignments, templateArtifactName) // Check Template is there - val templateContent = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, mappingArtifactName) + val templateContent = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, templateArtifactName) - // TODO ("Generate Param JSON from Resource Assignment") - val resolvedParamJsonContent = "{}" + val resolvedParamJsonContent = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList()) if (templateContent.isNotEmpty()) { - // TODO ( "Mash Data and Content") - resolvedContent = "Mashed Content" - + resolvedContent = BluePrintTemplateService.generateContent(templateContent, resolvedParamJsonContent) } else { resolvedContent = resolvedParamJsonContent } return resolvedContent } - private fun executeProcessors(blueprintRuntimeService: BluePrintRuntimeService<*>, resourceDictionaries: MutableMap, resourceAssignments: MutableList, diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt index ee8911ee5..93b93fecb 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt @@ -128,11 +128,7 @@ class ResourceAssignmentUtils { BluePrintConstants.DATA_TYPE_INTEGER -> (root as ObjectNode).put(rName, value as Int) BluePrintConstants.DATA_TYPE_FLOAT -> (root as ObjectNode).put(rName, value as Float) else -> { - if (JacksonUtils.getJsonNode(value) != null) { - (root as ObjectNode).set(rName, JacksonUtils.getJsonNode(value)) - } else { - (root as ObjectNode).set(rName, null) - } + (root as ObjectNode).set(rName, JacksonUtils.getJsonNode(value)) } } } -- cgit 1.2.3-korg