diff options
author | Dan Timoney <dtimoney@att.com> | 2019-03-22 16:07:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-22 16:07:40 +0000 |
commit | 9402f8e5e34637d289d2ac9296f166c2b5afe076 (patch) | |
tree | 2631827191fb959fcb10ddd53abaadc1433be56a /ms/controllerblueprints/modules/service/src/test | |
parent | 48c03b0a96cae5d37cabd114ffbf0a2929eb6b13 (diff) | |
parent | 0e86613ab9cbe5c6b87746bb7bff09fc3a324d0b (diff) |
Merge "Improve publish api"
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/test')
2 files changed, 14 insertions, 18 deletions
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt index e0ecf0397..74f225a5b 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt @@ -91,17 +91,18 @@ class BluePrintEnhancerServiceImplTest { } private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) { + runBlocking { + val targetPath = Paths.get("target", targetDirName).toUri().path - val targetPath = Paths.get("target", targetDirName).toUri().path - - deleteTargetDirectory(targetPath) + deleteTargetDirectory(targetPath) - val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath) - Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext) + val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath) + Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext) - // Validate the Generated BluePrints - val valid = bluePrintValidatorService.validateBluePrints(targetPath) - Assert.assertTrue("blueprint($basePath) validation failed ", valid) + // Validate the Generated BluePrints + val valid = bluePrintValidatorService.validateBluePrints(targetPath) + Assert.assertTrue("blueprint($basePath) validation failed ", valid) + } } private fun deleteTargetDirectory(targetPath: String) { diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt index 2e7ca2cdc..026561e10 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt @@ -20,10 +20,7 @@ import kotlinx.coroutines.runBlocking import org.junit.After import org.junit.Before import org.junit.Test -import org.onap.ccsdk.apps.controllerblueprints.core.compress -import org.onap.ccsdk.apps.controllerblueprints.core.deleteDir -import org.onap.ccsdk.apps.controllerblueprints.core.normalizedFile -import org.onap.ccsdk.apps.controllerblueprints.core.reCreateDirs +import org.onap.ccsdk.apps.controllerblueprints.core.* import org.onap.ccsdk.apps.controllerblueprints.service.controller.mock.MockFilePart import java.nio.file.Paths import java.util.* @@ -34,10 +31,9 @@ class BluePrintEnhancerUtilsTest { private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" private val blueprintArchivePath: String = "./target/blueprints/archive" private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment" - private var zipBlueprintFileName = Paths.get(blueprintArchivePath, "test.zip").toFile().normalize().absolutePath + private var zipBlueprintFileName = Paths.get(blueprintArchivePath, "test.zip").normalize().toUri().path @Before - @Throws(Exception::class) fun setUp() { val archiveDir = normalizedFile(blueprintArchivePath).reCreateDirs() assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}") @@ -49,20 +45,19 @@ class BluePrintEnhancerUtilsTest { } @After - @Throws(Exception::class) fun tearDown() { deleteDir(blueprintArchivePath) deleteDir(blueprintEnrichmentPath) } @Test - fun testDecompressFilePart() { + fun testFilePartCompressionNDeCompression() { val filePart = MockFilePart(zipBlueprintFileName) runBlocking { val enhanceId = UUID.randomUUID().toString() - val blueprintArchiveLocation = "$blueprintArchivePath/$enhanceId" - val blueprintEnrichmentLocation = "$blueprintEnrichmentPath/$enhanceId" + val blueprintArchiveLocation = normalizedPathName(blueprintArchivePath, enhanceId) + val blueprintEnrichmentLocation = normalizedPathName(blueprintEnrichmentPath, enhanceId) BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchiveLocation, blueprintEnrichmentLocation) BluePrintEnhancerUtils.compressToFilePart(blueprintEnrichmentLocation, blueprintArchiveLocation) } |