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 +----- .../resource/resolution/ResourceResolutionComponentTest.kt | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution') 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)) } } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt index 4cfa6522b..bb54fcb36 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt @@ -68,7 +68,7 @@ class ResourceResolutionComponentTest { val stepMetaData: MutableMap = hashMapOf() stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "resource-assignment") - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ResourceAssignmentComponent") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ResourceResolutionComponent") stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") bluePrintRuntimeService.put("resource-assignment-step-inputs", stepMetaData.asJsonNode()) -- cgit 1.2.3-korg