From 1072867dfac0df993cbd3e44bcc11a5cac7465fd Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Tue, 22 Sep 2020 12:16:46 -0400 Subject: Enabling Code Formatter Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8 --- .../ResourceResolutionComponentDSLTest.kt | 3 +- .../resolution/ResourceResolutionServiceTest.kt | 90 ++++++++++++---------- .../resolution/TestDatabaseConfiguration.kt | 6 +- .../IpAssignResolutionCapabilityTest.kt | 12 ++- .../capabilities/NamingResolutionCapabilityTest.kt | 9 ++- .../db/ResourceResolutionDBServiceTest.kt | 7 +- .../mock/MockBluePrintRestLibPropertyService.kt | 12 +-- .../mock/MockBlueprintWebClientService.kt | 4 +- .../mock/MockRestResourceResolutionProcessor.kt | 2 +- .../CapabilityResourceResolutionProcessorTest.kt | 1 + .../DatabaseResourceResolutionProcessorTest.kt | 6 +- .../RestResourceResolutionProcessorTest.kt | 6 +- .../utils/ResourceAssignmentUtilsTest.kt | 45 ++++++----- 13 files changed, 118 insertions(+), 85 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt index d1347113a..f7c41bdac 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt @@ -48,7 +48,8 @@ class ResourceResolutionComponentDSLTest { "prop1" : "1234", "prop2" : true, "prop3" : 23 - }""".trimIndent() + } + """.trimIndent() ) } outputs { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index d6fc52230..a22a73f2f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -95,7 +95,8 @@ class ResourceResolutionServiceTest { "source-input", "source-default", "source-db", "source-rest", "source-capability" ) - ), "failed to get registered sources : $sources" + ), + "failed to get registered sources : $sources" ) } @@ -140,9 +141,9 @@ class ResourceResolutionServiceTest { assertEquals("This is Sample Velocity Template", templateMap) val expectedAssignmentMap = hashMapOf( - "service-instance-id" to "siid_1234", - "vnf-id" to "vnf_1234", - "vnf_name" to "temp_vnf" + "service-instance-id" to "siid_1234", + "vnf-id" to "vnf_1234", + "vnf_name" to "temp_vnf" ).asJsonType() assertEquals(expectedAssignmentMap, assignmentMap) } @@ -226,7 +227,8 @@ class ResourceResolutionServiceTest { "resource-assignment", artifactPrefix, props - ), "Couldn't Resolve Resources for artifact $artifactPrefix" + ), + "Couldn't Resolve Resources for artifact $artifactPrefix" ) } } @@ -239,36 +241,36 @@ class ResourceResolutionServiceTest { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( - "1234", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + "1234", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) val executionServiceInput = - JacksonUtils.readValueFromClassPathFile( - "payload/requests/sample-resourceresolution-request.json", - ExecutionServiceInput::class.java - )!! + JacksonUtils.readValueFromClassPathFile( + "payload/requests/sample-resourceresolution-request.json", + ExecutionServiceInput::class.java + )!! val resourceAssignmentRuntimeService = - ResourceAssignmentUtils.transformToRARuntimeService( - bluePrintRuntimeService, - "testResolveResourcesWithMappingAndTemplate" - ) + ResourceAssignmentUtils.transformToRARuntimeService( + bluePrintRuntimeService, + "testResolveResourcesWithMappingAndTemplate" + ) val artifactPrefix = "notemplate" // Prepare Inputs PayloadUtils.prepareInputsFromWorkflowPayload( - bluePrintRuntimeService, - executionServiceInput.payload, - "resource-assignment" + bluePrintRuntimeService, + executionServiceInput.payload, + "resource-assignment" ) resourceResolutionService.resolveResources( - resourceAssignmentRuntimeService, - "resource-assignment", - artifactPrefix, - props + resourceAssignmentRuntimeService, + "resource-assignment", + artifactPrefix, + props ) }.let { val summaries = JacksonUtils.jsonNode(it.first)["resolution-summary"] @@ -285,43 +287,46 @@ class ResourceResolutionServiceTest { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( - "1234", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + "1234", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) val executionServiceInput = - JacksonUtils.readValueFromClassPathFile( - "payload/requests/sample-resourceresolution-request.json", - ExecutionServiceInput::class.java - )!! + JacksonUtils.readValueFromClassPathFile( + "payload/requests/sample-resourceresolution-request.json", + ExecutionServiceInput::class.java + )!! val resourceAssignmentRuntimeService = - ResourceAssignmentUtils.transformToRARuntimeService( - bluePrintRuntimeService, - "testResolveResourcesWithMappingAndTemplate" - ) + ResourceAssignmentUtils.transformToRARuntimeService( + bluePrintRuntimeService, + "testResolveResourcesWithMappingAndTemplate" + ) // Prepare Inputs PayloadUtils.prepareInputsFromWorkflowPayload( - bluePrintRuntimeService, - executionServiceInput.payload, - "resource-assignment" + bluePrintRuntimeService, + executionServiceInput.payload, + "resource-assignment" ) resourceResolutionService.resolveResources( - resourceAssignmentRuntimeService, - "resource-assignment", - artifactPrefix, - props + resourceAssignmentRuntimeService, + "resource-assignment", + artifactPrefix, + props ) }.let { - assertEquals(""" + assertEquals( + """ { "service-instance-id" : "siid_1234", "vnf-id" : "vnf_1234", "vnf_name" : "temp_vnf" } - """.trimIndent(), it.first) + """.trimIndent(), + it.first + ) assertEquals("siid_1234", it.second["service-instance-id"].asText()) } } @@ -364,7 +369,8 @@ class ResourceResolutionServiceTest { "resource-assignment", artifactPrefix, props - ), "Couldn't Resolve Resources for artifact $artifactPrefix" + ), + "Couldn't Resolve Resources for artifact $artifactPrefix" ) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt index 121fff7cb..096d7ff27 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt @@ -31,8 +31,10 @@ import javax.sql.DataSource @Configuration @Import(BluePrintDBLibConfiguration::class) @EnableJpaRepositories( - basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution", - "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"], + basePackages = [ + "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution", + "org.onap.ccsdk.cds.blueprintsprocessor.db.primary" + ], entityManagerFactoryRef = "primaryEntityManager", transactionManagerRef = "primaryTransactionManager" ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt index e252b4153..8a954c130 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt @@ -51,6 +51,7 @@ import kotlin.test.assertTrue */ class IpAssignResolutionCapabilityTest { + val log = logger(IpAssignResolutionCapabilityTest::class) @Before @@ -61,7 +62,8 @@ class IpAssignResolutionCapabilityTest { val blueprintWebClientService = mockk() // Create mock Response val mockResponse = BlueprintWebClientService.WebClientResponse( - 200, """{ + 200, + """{ "fixed_ipv4_Address_01" : "10.10.10.11", "fixed_ipv4_Address_02" : "10.10.10.12", "fixed_ipv4_Address_03" : "10.10.10.13" @@ -133,8 +135,10 @@ class IpAssignResolutionCapabilityTest { ) val resoulutionSummary = - ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(), - capabilityResourceResolutionProcessor.resourceDictionaries) + ResourceAssignmentUtils.generateResolutionSummaryData( + resourceAssignments.values.toList(), + capabilityResourceResolutionProcessor.resourceDictionaries + ) log.info(resoulutionSummary.asJsonType().toPrettyString()) assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary")) @@ -148,7 +152,7 @@ class IpAssignResolutionCapabilityTest { } } - /** Test dictionaries */ + /** Test dictionaries */ /** Test dictionaries */ private fun resourceDefinitions(): MutableMap { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt index ee53f8a04..449845f7f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt @@ -64,7 +64,8 @@ class NamingResolutionCapabilityTest { val blueprintWebClientService = mockk() // Create mock Response val mockResponse = BlueprintWebClientService.WebClientResponse( - 200, """{ + 200, + """{ "vf-module-name" : "dlsst001dbcx-adsf-Base-01", "vnfc-name" : "dlsst001dbcx" } @@ -136,8 +137,10 @@ class NamingResolutionCapabilityTest { ) val resoulutionSummary = - ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(), - capabilityResourceResolutionProcessor.resourceDictionaries) + ResourceAssignmentUtils.generateResolutionSummaryData( + resourceAssignments.values.toList(), + capabilityResourceResolutionProcessor.resourceDictionaries + ) log.info(resoulutionSummary.asJsonType().toPrettyString()) assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary")) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt index 672d4b75d..fa59876a9 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt @@ -239,8 +239,8 @@ open class ResourceResolutionDBServiceTest { } returns ResourceResolution() runBlocking { resourceResolutionDBService.write( - props, bluePrintRuntimeService, artifactPrefix, resourceAssignment - ) + props, bluePrintRuntimeService, artifactPrefix, resourceAssignment + ) val res = slot.captured @@ -255,7 +255,8 @@ open class ResourceResolutionDBServiceTest { } returns Unit runBlocking { val res = resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey( - blueprintName, blueprintVersion, artifactPrefix, resolutionKey) + blueprintName, blueprintVersion, artifactPrefix, resolutionKey + ) assertEquals(Unit, res) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt index 61e9f51c9..a2ec75d02 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt @@ -24,13 +24,13 @@ class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintProperti fun mockBlueprintWebClientService(selector: String): MockBlueprintWebClientService { - val prefix = "blueprintsprocessor.restclient.$selector" - val restClientProperties = restClientProperties(prefix) - return mockBlueprintWebClientService(restClientProperties) - } + val prefix = "blueprintsprocessor.restclient.$selector" + val restClientProperties = restClientProperties(prefix) + return mockBlueprintWebClientService(restClientProperties) + } private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties): MockBlueprintWebClientService { - return MockBlueprintWebClientService(restClientProperties) - } + return MockBlueprintWebClientService(restClientProperties) + } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt index e27f3ef1b..53db7563f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt @@ -29,6 +29,7 @@ import java.util.Base64 class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) : BlueprintWebClientService { + private var mockServer: ClientAndServer private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080" else restClientProperties.url.split(":")[2] @@ -41,7 +42,8 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient // Create expected requests and responses setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456") setRequest( - "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" + + "GET", + "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" + "vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name" ) setRequestWithPayload( diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt index 3600156ce..0312126b7 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt @@ -33,7 +33,7 @@ import java.util.HashMap class MockRestResourceResolutionProcessor( private val blueprintRestLibPropertyService: - MockBluePrintRestLibPropertyService + MockBluePrintRestLibPropertyService ) : ResourceAssignmentProcessor() { private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt index 5fbe32e07..f618b41db 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt @@ -139,6 +139,7 @@ class CapabilityResourceResolutionProcessorTest { open class MockCapabilityService open class MockCapabilityScriptRA : ResourceAssignmentProcessor() { + val log = logger(MockCapabilityScriptRA::class) override fun getName(): String { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt index 57d2c1b60..0c8ec7d95 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt @@ -36,10 +36,12 @@ import kotlin.test.assertNotNull @RunWith(SpringRunner::class) @ContextConfiguration( - classes = [TestDatabaseConfiguration::class, + classes = [ + TestDatabaseConfiguration::class, PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class, DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class, - MockBlueprintProcessorCatalogServiceImpl::class] + MockBlueprintProcessorCatalogServiceImpl::class + ] ) @TestPropertySource(locations = ["classpath:application-test.properties"]) class DatabaseResourceResolutionProcessorTest { 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 af78a604a..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 @@ -37,8 +37,10 @@ import kotlin.test.assertNotNull @RunWith(SpringRunner::class) @ContextConfiguration( - classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class, - BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class] + classes = [ + MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class, + BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class + ] ) @TestPropertySource(locations = ["classpath:application-test.properties"]) class RestResourceResolutionProcessorTest { 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 59be79568..2f07e3b9a 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 @@ -48,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 @@ -180,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":[ { @@ -203,7 +206,9 @@ class ResourceAssignmentUtilsTest { } ] } - """.replace("\n|\\s".toRegex(), ""), result) + """.replace("\n|\\s".toRegex(), ""), + result + ) } private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment { @@ -243,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 ) } @@ -262,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") @@ -313,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 @@ -330,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 ) } @@ -351,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() { @@ -412,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() -- cgit 1.2.3-korg