Revert "Renaming Files having BluePrint to have Blueprint"
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / resource-resolution / src / test / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / resource / resolution / utils / ResourceAssignmentUtilsTest.kt
index 6734613..2f07e3b 100644 (file)
@@ -22,7 +22,6 @@
 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
@@ -49,6 +48,7 @@ data class ExpectedResponseIp(val ip: String)
 data class ExpectedResponseIpAddress(val ipAddress: IpAddress)
 
 class ResourceAssignmentUtilsTest {
+
     private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService
     private lateinit var resourceAssignment: ResourceAssignment
 
@@ -181,9 +181,11 @@ class ResourceAssignmentUtilsTest {
         }
 
         val result = ResourceAssignmentUtils.generateResolutionSummaryData(
-                listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition))
+            listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition)
+        )
 
-        assertEquals("""
+        assertEquals(
+            """
             {
                 "resolution-summary":[
                     {
@@ -204,21 +206,9 @@ 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")
+        """.replace("\n|\\s".toRegex(), ""),
+            result
         )
-
-        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 {
@@ -258,8 +248,8 @@ class ResourceAssignmentUtilsTest {
             "Unexpected outcome returned for primitive type of key-value String"
         )
         assertEquals(
-                expectedValueToTestPrimitiveType,
-                resourceAssignment.keyIdentifiers[0].value
+            expectedValueToTestPrimitiveType,
+            resourceAssignment.keyIdentifiers[0].value
         )
     }
 
@@ -277,8 +267,8 @@ class ResourceAssignmentUtilsTest {
 
         val expectedKeyIdentifierValue = JacksonUtils.getJsonNode(outcome.map { it["ip"] })
         assertEquals(
-                expectedKeyIdentifierValue,
-                resourceAssignment.keyIdentifiers[0].value
+            expectedKeyIdentifierValue,
+            resourceAssignment.keyIdentifiers[0].value
         )
 
         // FIXME("Map is not collection type, It is known complex type")
@@ -328,8 +318,9 @@ class ResourceAssignmentUtilsTest {
             "Unexpected outcome returned for complex type"
         )
         assertEquals(
-                expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
-                resourceAssignment.keyIdentifiers[0].value)
+            expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
+            resourceAssignment.keyIdentifiers[0].value
+        )
     }
 
     @Test
@@ -345,13 +336,13 @@ class ResourceAssignmentUtilsTest {
         )
         assertEquals(2, resourceAssignment.keyIdentifiers.size)
         assertEquals(
-                expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
-                resourceAssignment.keyIdentifiers[0].value
+            expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
+            resourceAssignment.keyIdentifiers[0].value
         )
 
         assertEquals(
-                expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
-                resourceAssignment.keyIdentifiers[1].value
+            expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
+            resourceAssignment.keyIdentifiers[1].value
         )
     }
 
@@ -366,13 +357,15 @@ class ResourceAssignmentUtilsTest {
 
         // Enable transform template
         resourceAssignment.property!!.metadata =
-                mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
+            mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
 
         ResourceAssignmentUtils
-                .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
+            .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
 
-        assertEquals("abc-vnf_private2",
-                resourceAssignment.property!!.value!!.asText())
+        assertEquals(
+            "abc-vnf_private2",
+            resourceAssignment.property!!.value!!.asText()
+        )
     }
 
     private fun initInputMapAndExpectedValuesForPrimitiveType() {
@@ -427,7 +420,8 @@ class ResourceAssignmentUtilsTest {
 
         expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(
             ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
-            ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
+            ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")),
+            ExpectedResponseIpAddress(
                 IpAddress("3333", "1.2.3.3")
             )
         ).asJsonType()