From d1acee662bfb0125a85fffdcbfebcf9cc0d6ed87 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 --- .../ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt | 4 ++-- .../controllerblueprints/core/service/BluePrintContextTest.kt | 2 +- .../core/service/BluePrintRuntimeServiceTest.kt | 8 ++++---- .../resource/dict/ResourceDictionaryConstants.kt | 2 +- .../service/load/ControllerBlueprintCatalogServiceImpl.kt | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ms/controllerblueprints/modules') diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index 75310ee89..9bf9d13cf 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -166,8 +166,8 @@ class JacksonUtils { fun getMapFromJson(content: String, valueType: Class): MutableMap? { val objectMapper = jacksonObjectMapper() - val typeRef = object : TypeReference>() {} - return objectMapper.readValue(content, typeRef) + val mapType = objectMapper.typeFactory.constructMapType(Map::class.java, String::class.java, valueType) + return objectMapper.readValue(content, mapType) } fun getMapFromFile(fileName: String, valueType: Class): MutableMap? { diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt index d06ce234d..1bd95f322 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt @@ -45,7 +45,7 @@ class BluePrintContextTest { @Test fun testChainedProperty() { val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) - val nodeType = bluePrintContext.nodeTypeChained("component-resource-assignment") + val nodeType = bluePrintContext.nodeTypeChained("component-resource-resolution") assertNotNull(nodeType, "Failed to get chained node type") log.trace("Properties {}", JacksonUtils.getJson(nodeType, true)) } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 03e233ff2..d0bd3cf35 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -85,7 +85,7 @@ class BluePrintRuntimeServiceTest { val inContext: MutableMap = bluePrintRuntimeService .resolveNodeTemplateInterfaceOperationInputs("resource-assignment", - "ResourceAssignmentComponent", "process") + "ResourceResolutionComponent", "process") assertNotNull(inContext, "Failed to populate interface input property values") assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name") @@ -101,14 +101,14 @@ class BluePrintRuntimeServiceTest { bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance()) bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment", - "ResourceAssignmentComponent", "process") + "ResourceResolutionComponent", "process") val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", - "ResourceAssignmentComponent", "process", "status") + "ResourceResolutionComponent", "process", "status") assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status") val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment", - "ResourceAssignmentComponent", "process", "resource-assignment-params") + "ResourceResolutionComponent", "process", "resource-assignment-params") assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params") } 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 aa06c9da0..d33a2f04b 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 @@ -34,5 +34,5 @@ object ResourceDictionaryConstants { const val PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping" const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies" - const val PATH_RESOURCE_DEFINITION_TYPE = "resource_definition_types" + const val PATH_RESOURCE_DEFINITION_TYPE = "resources_definition_types" } \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt index 779be65d9..892cdbd5b 100755 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt @@ -74,10 +74,10 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintValidatorService: BluePrint val artifactName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] val artifactVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] - log.isDebugEnabled.apply { - blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let { - log.debug("Overwriting blueprint model :$artifactName::$artifactVersion") - } + + blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let { + log.info("Overwriting blueprint model :$artifactName::$artifactVersion") + blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion) } val blueprintModel = BlueprintModel() -- cgit 1.2.3-korg