diff options
author | Brinda Santh <bs2796@att.com> | 2019-12-11 18:32:24 -0500 |
---|---|---|
committer | Brinda Santh <bs2796@att.com> | 2019-12-11 18:32:24 -0500 |
commit | d4fadc988246eb172ce8333bb3a06443591c5f19 (patch) | |
tree | 19701b12c7f3008acb6a62772458ea4b47e043d8 /ms/blueprintsprocessor/modules/commons/db-lib/src | |
parent | a30e1864fadad70c797ca1248a3c1272300a6e2b (diff) |
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 <bs2796@att.com>
Change-Id: I5d9d7a4599234a38d431328dbd9b74bd831e0115
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/db-lib/src')
3 files changed, 18 insertions, 13 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt index e86dfab72..5d546c2ef 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt @@ -25,6 +25,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.mock.MockBlueprintProcessorCata import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service.BlueprintCatalogServiceImpl import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service.BlueprintProcessorCatalogServiceImpl import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.compress import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService @@ -62,8 +63,14 @@ class BlueprintProcessorCatalogServiceImplTest { @BeforeTest fun setup() { + deleteDir("target", "blueprints") - bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + + // Create sample CBA zip + normalizedFile("./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + .compress(normalizedFile("./target/blueprints/generated-cba.zip")) + + bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime( blueprintId, "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -76,11 +83,9 @@ class BlueprintProcessorCatalogServiceImplTest { @Test fun `test catalog service`() { - // TODO: I thing this test function should be remve and replace by the other one. - runBlocking { - // FIXME("Create ZIP from test blueprints") - val file = normalizedFile("./src/test/resources/test-cba.zip") + runBlocking { + val file = normalizedFile("./target/blueprints/generated-cba.zip") assertTrue(file.exists(), "couldn't get file ${file.absolutePath}") blueprintsProcessorCatalogService.saveToDatabase("1234", file) @@ -93,7 +98,7 @@ class BlueprintProcessorCatalogServiceImplTest { @Test fun `test save function`() { runBlocking { - val file = normalizedFile("./src/test/resources/test-cba.zip") + val file = normalizedFile("./target/blueprints/generated-cba.zip") assertTrue(file.exists(), "couldnt get file ${file.absolutePath}") val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = blueprintId @@ -105,7 +110,7 @@ class BlueprintProcessorCatalogServiceImplTest { @Test fun `test get function`() { runBlocking { - val file = normalizedFile("./src/test/resources/test-cba.zip") + val file = normalizedFile("./target/blueprints/generated-cba.zip") assertTrue(file.exists(), "couldnt get file ${file.absolutePath}") val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = blueprintId @@ -117,10 +122,10 @@ class BlueprintProcessorCatalogServiceImplTest { assertTrue( File( blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath + - "/baseconfiguration" + "/baseconfiguration" ).deleteRecursively(), "Couldn't get blueprint archive " + - "${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " + - "from data base." + "${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " + + "from data base." ) } diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt index 8dcf42668..248181f16 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt @@ -15,7 +15,7 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.db.mock -import io.mockk.every +import io.mockk.coEvery import io.mockk.mockk import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService @@ -28,8 +28,8 @@ open class MockBlueprintProcessorCatalogServiceImpl { @Bean(name = ["bluePrintRuntimeValidatorService"]) open fun bluePrintRuntimeValidatorService(): BluePrintValidatorService { val bluePrintValidatorService = mockk<BluePrintValidatorService>() - every { bluePrintValidatorService.validateBluePrints(any<String>()) } returns true - every { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true + coEvery { bluePrintValidatorService.validateBluePrints(any<String>()) } returns true + coEvery { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true return bluePrintValidatorService } } diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip Binary files differdeleted file mode 100644 index 785ec6c00..000000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip +++ /dev/null |