Code changes needed to resolve openjdk17 issues
[ccsdk/cds.git] / ms / blueprintsprocessor / application / src / test / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / uat / BlueprintsAcceptanceTest.kt
index 4fed0ce..6349b44 100644 (file)
  */
 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<Array<Any>> {
-            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
+}