1 package org.onap.ccsdk.cds.blueprintsprocessor.uat
3 import kotlinx.coroutines.runBlocking
5 import org.onap.ccsdk.cds.blueprintsprocessor.uat.base.BaseUatResourceResolutionTest
6 import org.slf4j.Logger
7 import org.slf4j.LoggerFactory
8 import java.nio.file.Path
9 import kotlin.test.Ignore
10 import kotlin.test.assertEquals
14 * This is a sample implementation of a test class using {@see BaseUatResourceResolutionTest}
15 * Please find "TODO" comments, where you need to make your changes
17 class SampleResourceResolutionTest : BaseUatResourceResolutionTest() {
20 val log: Logger = LoggerFactory.getLogger(SampleResourceResolutionTest::class.java)
21 private val cwd: String = Path.of("").toAbsolutePath().toString()
22 val blueprintBasePath : String = cwd
23 // TODO: exchange here the real path to the request json
24 val fileNameExecutionServiceInput : String = "$cwd/Tests/sample-resourceresolution-request.json"
27 // TODO: remove @Ignore to activate the test
30 @Throws(Exception::class)
31 fun `test resolveResource for nodeTemplate fetch-nf-config-process`() {
36 // TODO: replace the following parameters with yours
37 fileNameExecutionServiceInput,
42 }.let { (templateMap, assignmentList) ->
44 val expectedAssignmentList = mutableListOf(
46 "service-instance-id" to "fb84c76d-676e-4a36-9237-52089594292b",
47 "service-instance-name" to "cucp-1",
48 "vnf-id" to "de59d80e-cbce-4898-9e3c-3a917e89d834"
49 // TODO: add your key value pairs here
52 // assert size of list
53 assertEquals(expectedAssignmentList.size, assignmentList.size)
55 val list = expectedAssignmentList.zip(assignmentList)
60 // do individual assertions here
62 // names must be equal
63 assertEquals(expected.first, actual.name)
64 when (expected.first) {
65 // TODO: fill in here your concrete ObjectNode names
66 "objectNodeName1", "objectNodeName2" -> {
68 log.info("expected name[${expected.first}] actual name[${actual.name}] " +
69 "-> expected value[${expected.second}] actual value[${actual.property?.value.toString()}]")
71 // values must be equal
72 assertEquals(expected.second, actual.property?.value.toString())
75 // TextNodes. This is the default case
76 log.info("expected name[${expected.first}] actual name[${actual.name}] " +
77 "-> expected value[${expected.second}] actual value[${actual.property?.value?.asText()}]")
78 // values must be equal
79 assertEquals(expected.second, actual.property?.value?.asText())