Fixes: manual integration test of CDS
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Mon, 11 Feb 2019 22:23:48 +0000 (17:23 -0500)
committerAlexis de Talhouët <adetalhouet89@gmail.com>
Tue, 12 Feb 2019 19:12:44 +0000 (14:12 -0500)
- 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 <adetalhouet89@gmail.com>
ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContextTest.kt
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt

index 75310ee..9bf9d13 100644 (file)
@@ -166,8 +166,8 @@ class JacksonUtils {
 
         fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {
             val objectMapper = jacksonObjectMapper()
-            val typeRef = object : TypeReference<MutableMap<String, T>>() {}
-            return objectMapper.readValue(content, typeRef)
+            val mapType = objectMapper.typeFactory.constructMapType(Map::class.java, String::class.java, valueType)
+            return objectMapper.readValue(content, mapType)
         }
 
         fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {
index d06ce23..1bd95f3 100644 (file)
@@ -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))
     }
index 03e233f..d0bd3cf 100644 (file)
@@ -85,7 +85,7 @@ class BluePrintRuntimeServiceTest {
 
         val inContext: MutableMap<String, JsonNode> = 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")
 
     }
index aa06c9d..d33a2f0 100644 (file)
@@ -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
index 779be65..892cdbd 100755 (executable)
@@ -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()