From d4fadc988246eb172ce8333bb3a06443591c5f19 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Wed, 11 Dec 2019 18:32:24 -0500 Subject: Metadata for name, version, tags and type Mandate Tosca.meta template name, version, type and tags. Auto copy metadata from Tosca.meta to ServiceTemplate definitions. Optimize Blueprint context and runtime creation from file path. Removed attached CBA zip file in test repository dirs Issue-ID: CCSDK-1992 Signed-off-by: Brinda Santh Change-Id: I5d9d7a4599234a38d431328dbd9b74bd831e0115 --- .../executor/ComponentRemoteAnsibleExecutorTest.kt | 2 +- .../snapshots/ComponentConfigSnapshotsExecutorTest.kt | 2 +- .../python/executor/ComponentRemotePythonExecutorTest.kt | 15 +++++++-------- .../resource/resolution/mock/MockDatabaseConfiguration.kt | 6 +++--- .../resolution/utils/ResourceAssignmentUtilsTest.kt | 13 ++++++++----- 5 files changed, 20 insertions(+), 18 deletions(-) (limited to 'ms/blueprintsprocessor/functions') diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt index 262563d1f..db7128394 100644 --- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt @@ -194,7 +194,7 @@ class ComponentRemoteAnsibleExecutorTest { awxRemoteExecutor: ComponentRemoteAnsibleExecutor, executionServiceInput: ExecutionServiceInput ): BluePrintRuntimeService> { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime( "123456-1000", "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_ansible" ) diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt index 450da1c9f..c6166ebbc 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt @@ -55,7 +55,7 @@ class ComponentConfigSnapshotsExecutorTest { @Autowired lateinit var cfgSnapshotService: ResourceConfigSnapshotService lateinit var cfgSnapshotComponent: ComponentConfigSnapshotsExecutor - private var bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + private var bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime( "123456-1000", "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" ) diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt index 847b08018..3d58afad8 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt @@ -102,7 +102,7 @@ class ComponentRemotePythonExecutorTest { * Mocked input information for remote python executor. */ fun getMockedOutput(svc: DefaultBluePrintRuntimeService): - ExecutionServiceInput { + ExecutionServiceInput { val stepMetaData: MutableMap = hashMapOf() stepMetaData.putJsonElement( @@ -165,13 +165,12 @@ class ComponentRemotePythonExecutorTest { "ComponentRemotePythonExecutor", "process" ) } returns operationOutputs - val bluePrintRuntimeService = BluePrintMetadataUtils - .getBluePrintRuntime( - "123456-1000", - "./../../../../components/model-" + - "catalog/blueprint-model/test-blueprint/" + - "remote_scripts" - ) + val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime( + "123456-1000", + "./../../../../components/model-" + + "catalog/blueprint-model/test-blueprint/" + + "remote_scripts" + ) every { svc.resolveNodeTemplateArtifactDefinition( "execute-remote-python", "component-script" diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt index 774c4021a..2219f2348 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt @@ -15,7 +15,7 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock -import io.mockk.every +import io.mockk.coEvery import io.mockk.mockk import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService @@ -38,8 +38,8 @@ open class MockBlueprintProcessorCatalogServiceImpl { @Bean(name = ["bluePrintRuntimeValidatorService"]) open fun bluePrintRuntimeValidatorService(): BluePrintValidatorService { val bluePrintValidatorService = mockk() - every { bluePrintValidatorService.validateBluePrints(any()) } returns true - every { bluePrintValidatorService.validateBluePrints(any>()) } returns true + coEvery { bluePrintValidatorService.validateBluePrints(any()) } returns true + coEvery { bluePrintValidatorService.validateBluePrints(any>()) } returns true return bluePrintValidatorService } } 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 c564d33c6..a358f6a23 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 @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.TextNode import io.mockk.every import io.mockk.spyk +import kotlinx.coroutines.runBlocking import org.junit.Before import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService @@ -63,9 +64,11 @@ class ResourceAssignmentUtilsTest { @Before fun setup() { - val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - ) + val bluePrintContext = runBlocking { + BluePrintMetadataUtils.getBluePrintContext( + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) + } resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext)) @@ -94,11 +97,11 @@ class ResourceAssignmentUtilsTest { id = "ipAddress" } - var mapOfPropertiesIpAddress = mutableMapOf() + val mapOfPropertiesIpAddress = mutableMapOf() mapOfPropertiesIpAddress["port"] = propertiesDefinition1 mapOfPropertiesIpAddress["ip"] = propertiesDefinition2 - var mapOfPropertiesHost = mutableMapOf() + val mapOfPropertiesHost = mutableMapOf() mapOfPropertiesHost["name"] = propertiesDefinition3 mapOfPropertiesHost["ipAddress"] = propertiesDefinition4 -- cgit 1.2.3-korg