aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src/test
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-05-25 11:23:21 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2020-05-27 13:19:06 -0400
commit1591ba7289f34c1c44881c169e91c3a6ceda9531 (patch)
tree3bf31ce9d1222761c59c245fd714caf30df996e6 /ms/blueprintsprocessor/functions/resource-resolution/src/test
parentd7fffebc00a236147e67ffa877016c5e6d1d911f (diff)
Fix sub-attribute parsing for accessing resolved values
Added assignment-map attribute to ResourceResolutionComponent. This attribute will hold a json object with the resolved values for each artifact-prefix. It will enable accessing any resolved value, using get_attribute with JsonPath. Issue-ID: CCSDK-2389 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: I3441569d9766fbd79703d2f224de448edd56dbb2
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt17
1 files changed, 16 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
index b4befc26d..6734613fc 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
@@ -22,6 +22,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.TextNode
import io.mockk.every
import io.mockk.spyk
@@ -167,7 +168,7 @@ class ResourceAssignmentUtilsTest {
}
@Test
- fun generate() {
+ fun generateResolutionSummaryDataTest() {
val resourceAssignment = createResourceAssignmentForTest(null)
val resourceDefinition = ResourceDefinition()
val nodeTemplate = NodeTemplate().apply {
@@ -206,6 +207,20 @@ class ResourceAssignmentUtilsTest {
""".replace("\n|\\s".toRegex(), ""), result)
}
+ @Test
+ fun generateAssignmentMapTest() {
+ val artifactPrefix = "vdns"
+ val resourceAssignments = mutableListOf(
+ createResourceAssignmentForTest("abc-123", "vnf-id"),
+ createResourceAssignmentForTest(null, "vf-module-name")
+ )
+
+ val result: ObjectNode = ResourceAssignmentUtils.generateAssignmentMap(artifactPrefix, resourceAssignments)
+
+ assertEquals("abc-123", result["vdns"]["vnf-id"].textValue())
+ assertEquals(JacksonUtils.getJsonNode(null), result["vdns"]["vf-module-name"])
+ }
+
private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment {
val valueForTest = if (resourceValue == null) null else TextNode(resourceValue)
val resourceAssignmentForTest = ResourceAssignment().apply {