diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-20 18:27:53 -0400 |
---|---|---|
committer | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-22 11:27:18 -0400 |
commit | 663217341fafeea16541958b8b70c270e1270965 (patch) | |
tree | 012294709ff6ef4a1b6fccccecedadeb59c74496 /ms/controllerblueprints/modules/service/src/test/kotlin | |
parent | 2960fd72dc68665e4d518713528957ec9528907f (diff) |
Improve publish api
Change-Id: I245fc765bf4e7916c36126d7a9597e9db80a1713
Issue-ID: CCSDK-1137
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/test/kotlin')
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 e0ecf039..74f225a5 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 2e7ca2cd..026561e1 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) } |