summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src/test
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-04-08 18:49:00 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2020-04-09 12:56:17 -0400
commit3109998de219adb6488ff28c9ab4e9bf6b444e57 (patch)
treed27cefb58824cf9cd36377bb587eff1d0bb2344a /ms/blueprintsprocessor/functions/resource-resolution/src/test
parentefb012bfb4f951ed2619baecdfcfa4b412dfb71d (diff)
Enable inline templating in mapping files
Issue-ID: CCSDK-2306 Change-Id: I9657eb73b48659edfc1adfd842ed96f35a095197 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
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.kt21
1 files changed, 21 insertions, 0 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 27adb51f4..7746b5c41 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
@@ -29,6 +29,7 @@ import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.METADATA_TRANSFORM_TEMPLATE
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
@@ -333,6 +334,26 @@ class ResourceAssignmentUtilsTest {
)
}
+ @Test
+ fun `transform resolved value with inline template`() {
+ resourceAssignmentRuntimeService.putResolutionStore("vnf_name", "abc-vnf".asJsonType())
+ resourceAssignment = ResourceAssignment()
+ resourceAssignment.name = "int_pktgen_private_net_id"
+ resourceAssignment.property = PropertyDefinition()
+ resourceAssignment.property!!.type = "string"
+ val value = "".asJsonType()
+
+ // Enable transform template
+ resourceAssignment.property!!.metadata =
+ mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
+
+ ResourceAssignmentUtils
+ .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
+
+ assertEquals("abc-vnf_private2",
+ resourceAssignment.property!!.value!!.asText())
+ }
+
private fun initInputMapAndExpectedValuesForPrimitiveType() {
inputMapToTestPrimitiveTypeWithValue = "1.2.3.1".asJsonType()
val keyValue = mutableMapOf<String, String>()