diff options
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.kt | 21 |
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>() |