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/inbounds | |
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/inbounds')
6 files changed, 32 insertions, 23 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt index 582fd9a41..35e440554 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt @@ -30,6 +30,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.TokenAuthGrpcClientSe import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader 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.management.api.BluePrintBootstrapInput @@ -66,9 +67,15 @@ class BluePrintManagementGRPCHandlerTest { @BeforeTest fun init() { + + deleteDir("target", "blueprints") + + // Create sample CBA zip + normalizedFile("./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + .compress(normalizedFile("./target/blueprints/generated-cba.zip")) + // Create a server, add service, start, and register for automatic graceful shutdown. grpcServerRule.serviceRegistry.addService(bluePrintManagementGRPCHandler) - deleteDir("target", "blueprints") } @AfterTest @@ -84,7 +91,7 @@ class BluePrintManagementGRPCHandlerTest { val bootstrapOutput = blockingStub.bootstrapBlueprint(req) assertEquals(200, bootstrapOutput.status.code) assertTrue( - bootstrapOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS), + bootstrapOutput.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS), "failed to get success status" ) assertEquals(id, bootstrapOutput.commonHeader.requestId) @@ -99,7 +106,7 @@ class BluePrintManagementGRPCHandlerTest { assertEquals(200, output.status.code) assertTrue( - output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS), + output.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS), "failed to get success status" ) assertEquals(id, output.commonHeader.requestId) @@ -110,7 +117,7 @@ class BluePrintManagementGRPCHandlerTest { val downloadOutput = blockingStub.downloadBlueprint(downloadReq) assertEquals(200, downloadOutput.status.code) assertTrue( - downloadOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS), + downloadOutput.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS), "failed to get success status" ) assertNotNull(downloadOutput.fileChunk?.chunk, "failed to get cba file chunks") @@ -126,7 +133,7 @@ class BluePrintManagementGRPCHandlerTest { var output = blockingStub.uploadBlueprint(req) assertEquals(200, output.status.code) assertTrue( - output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS), + output.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS), "failed to get success status" ) assertEquals(id, output.commonHeader.requestId) @@ -174,7 +181,7 @@ class BluePrintManagementGRPCHandlerTest { } private fun createUploadInputRequest(id: String, action: String): BluePrintUploadInput { - 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 commonHeader = CommonHeader diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt index 2762725fa..a866dcad3 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt @@ -65,34 +65,28 @@ class BluePrintEnhancerServiceImplTest { resourceDictionaryLoadService.loadPathsResourceDictionary(dictPaths) testBaseConfigEnhancementAndValidation() - testVFWEnhancementAndValidation() testGoldenEnhancementAndValidation() testRemoteScriptsEnhancementAndValidation() testCapabilityCliEnhancementAndValidation() } } - fun testBaseConfigEnhancementAndValidation() { + private fun testBaseConfigEnhancementAndValidation() { val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" testComponentInvokeEnhancementAndValidation(basePath, "base-enhance") } - fun testVFWEnhancementAndValidation() { - val basePath = "./../../../../../components/model-catalog/blueprint-model/service-blueprint/vFW" - testComponentInvokeEnhancementAndValidation(basePath, "vFW-enhance") - } - - fun testGoldenEnhancementAndValidation() { + private fun testGoldenEnhancementAndValidation() { val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/golden" testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance") } - fun testRemoteScriptsEnhancementAndValidation() { + private fun testRemoteScriptsEnhancementAndValidation() { val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" testComponentInvokeEnhancementAndValidation(basePath, "remote_scripts-enhance") } - fun testCapabilityCliEnhancementAndValidation() { + private fun testCapabilityCliEnhancementAndValidation() { val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/capability_cli" testComponentInvokeEnhancementAndValidation(basePath, "capability_cli-enhance") } @@ -111,8 +105,8 @@ class BluePrintEnhancerServiceImplTest { Assert.assertTrue("blueprint($basePath) validation failed ", valid) // Enable this to get the enhanced zip file - // val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip") - // normalizedFile(targetPath).compress(compressFile) + // val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip") + // normalizedFile(targetPath).compress(compressFile) deleteDir(targetPath) } diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip Binary files differdeleted file mode 100644 index 785ec6c00..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/test-cba.zip +++ /dev/null diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt index a6ebe9c3e..3119b803e 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt @@ -22,6 +22,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.controllerblueprints.core.compress import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile @@ -62,6 +63,10 @@ class ExecutionServiceControllerTest { @BeforeTest fun init() { deleteDir("target", "blueprints") + + // Create sample CBA zip + normalizedFile("./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + .compress(normalizedFile("./target/blueprints/generated-cba.zip")) } @AfterTest @@ -110,7 +115,7 @@ class ExecutionServiceControllerTest { } private fun loadTestCbaFile(): File { - val testCbaFile = normalizedFile("./src/test/resources/test-cba.zip") + val testCbaFile = normalizedFile("./target/blueprints/generated-cba.zip") assertTrue(testCbaFile.exists(), "couldn't get file ${testCbaFile.absolutePath}") return testCbaFile } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt index 75d9f487a..a367c8d36 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt @@ -16,6 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.validation +import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.mock.MockResourceSource @@ -37,10 +38,12 @@ class BluePrintRuntimeValidatorServiceTest { @Test fun testBlueprintRuntimeValidation() { - val blueprintBasePath = - "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService") + runBlocking { + val blueprintBasePath = + "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService") - bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath) + bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath) + } } } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip Binary files differdeleted file mode 100644 index 785ec6c00..000000000 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/test-cba.zip +++ /dev/null |