X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Ffunctions%2Fresource-resolution%2Fsrc%2Ftest%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Ffunctions%2Fresource%2Fresolution%2Fprocessor%2FRestResourceResolutionProcessorTest.kt;h=cb72141232218d9f8c7a286997186c61726c41c0;hb=1072867dfac0df993cbd3e44bcc11a5cac7465fd;hp=7e7e65635116b9aed8ee95152f7bd123d7a0c9f7;hpb=03de9853a05ad73ed21ab710cddb3402c3517e71;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt index 7e7e65635..cb7214123 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt @@ -18,14 +18,13 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockRestResourceResolutionProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -33,22 +32,26 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner -import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.assertNotNull @RunWith(SpringRunner::class) -@ContextConfiguration(classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class, - BlueprintPropertyConfiguration::class, BluePrintProperties::class, RestClientProperties::class]) +@ContextConfiguration( + classes = [ + MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class, + BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class + ] +) @TestPropertySource(locations = ["classpath:application-test.properties"]) class RestResourceResolutionProcessorTest { + @Autowired lateinit var bluePrintRestLibPropertyService: MockBluePrintRestLibPropertyService private lateinit var restResourceResolutionProcessor: MockRestResourceResolutionProcessor @BeforeTest - fun init(){ + fun init() { restResourceResolutionProcessor = MockRestResourceResolutionProcessor(bluePrintRestLibPropertyService) } @@ -56,13 +59,14 @@ class RestResourceResolutionProcessorTest { fun `test rest resource resolution`() { runBlocking { val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils - .resourceDefinitions(bluePrintContext.rootPath) + .resourceDefinitions(bluePrintContext.rootPath) val scriptPropertyInstances: MutableMap = mutableMapOf() scriptPropertyInstances["mock-service1"] = MockCapabilityService() @@ -73,7 +77,7 @@ class RestResourceResolutionProcessorTest { val resourceAssignment = ResourceAssignment().apply { name = "rr-name" dictionaryName = "vnf_name" - dictionarySource = "primary-config-data" + dictionarySource = "sdnc" property = PropertyDefinition().apply { type = "string" } @@ -89,13 +93,14 @@ class RestResourceResolutionProcessorTest { fun `test rest aai get resource resolution`() { runBlocking { val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils - .resourceDefinitions(bluePrintContext.rootPath) + .resourceDefinitions(bluePrintContext.rootPath) val scriptPropertyInstances: MutableMap = mutableMapOf() scriptPropertyInstances["mock-service1"] = MockCapabilityService() @@ -106,7 +111,7 @@ class RestResourceResolutionProcessorTest { val resourceAssignment = ResourceAssignment().apply { name = "rr-aai" dictionaryName = "aai-get-resource" - dictionarySource = "primary-aai-data" + dictionarySource = "aai-data" property = PropertyDefinition().apply { type = "string" } @@ -122,13 +127,14 @@ class RestResourceResolutionProcessorTest { fun `test rest aai put resource resolution`() { runBlocking { val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils - .resourceDefinitions(bluePrintContext.rootPath) + .resourceDefinitions(bluePrintContext.rootPath) val scriptPropertyInstances: MutableMap = mutableMapOf() scriptPropertyInstances["mock-service1"] = MockCapabilityService() @@ -139,7 +145,7 @@ class RestResourceResolutionProcessorTest { val resourceAssignment = ResourceAssignment().apply { name = "rr-aai" dictionaryName = "aai-put-resource" - dictionarySource = "primary-aai-data" + dictionarySource = "aai-data" property = PropertyDefinition().apply { type = "string" } @@ -150,4 +156,4 @@ class RestResourceResolutionProcessorTest { println(processorName) } } -} \ No newline at end of file +}