X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Fapplication%2Fsrc%2Ftest%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Fuat%2FBlueprintsAcceptanceTest.kt;h=6349b444c8108ce91af93dd08beae1b444c25c5e;hb=c0aebdf1f43ed6f64fcc76e19cbc2dfee2e0f3df;hp=4fed0ce677fd87a8e5e7dfed2f85d591041981d5;hpb=9fe840e96ce51f7204fb03e7bbb4820d4b88f309;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt index 4fed0ce67..6349b444c 100644 --- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt @@ -19,10 +19,13 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.uat +import kotlinx.coroutines.runBlocking import org.junit.ClassRule import org.junit.Rule import org.junit.runner.RunWith import org.junit.runners.Parameterized +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.ExtendedTemporaryFolder +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.UatExecutor import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.UAT_SPECIFICATION_FILE import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils.Companion.compressToBytes import org.springframework.beans.factory.annotation.Autowired @@ -37,8 +40,10 @@ import kotlin.test.Test // Only one runner can be configured with jUnit 4. We had to replace the SpringRunner by equivalent jUnit rules. // See more on https://docs.spring.io/autorepo/docs/spring-framework/current/spring-framework-reference/testing.html#testcontext-junit4-rules @RunWith(Parameterized::class) -class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: String, // readable test description - private val rootFs: FileSystem): BaseUatTest() { +class BlueprintsAcceptanceTest( + @Suppress("unused") private val blueprintName: String, // readable test description + private val rootFs: FileSystem +) : BaseUatTest() { companion object { @@ -53,15 +58,17 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St @Parameterized.Parameters(name = "{index} {0}") @JvmStatic fun scanUatEmpoweredBlueprints(): List> { - return (File(UAT_BLUEPRINTS_BASE_DIR) + return ( + File(UAT_BLUEPRINTS_BASE_DIR) .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile } - ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR")) - .map { file -> - arrayOf( - file.nameWithoutExtension, - FileSystems.newFileSystem(file.canonicalFile.toPath(), null) - ) - } + ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR") + ) + .map { file -> + arrayOf( + file.nameWithoutExtension, + FileSystems.newFileSystem(file.canonicalFile.toPath(), null as? ClassLoader) + ) + } } } @@ -84,8 +91,10 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St @Test fun runUat() { - val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText() - val cbaBytes = compressToBytes(rootFs.getPath("/")) - uatExecutor.execute(uatSpec, cbaBytes) + runBlocking { + val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText() + val cbaBytes = compressToBytes(rootFs.getPath("/")) + uatExecutor.execute(uatSpec, cbaBytes) + } } -} \ No newline at end of file +}