Make UatServices.verify working for bigger cba's 33/136033/1
authorFrank Kimmlingen <frank.kimmlingen@telekom.de>
Tue, 26 Sep 2023 12:49:21 +0000 (14:49 +0200)
committerFrank Kimmlingen <frank.kimmlingen@telekom.de>
Tue, 26 Sep 2023 12:49:21 +0000 (14:49 +0200)
use awaitSingle to synchronize creation of the temp zip file and
the access to this file.

Issue-ID: CCSDK-3934
Signed-off-by: Frank Kimmlingen <frank.kimmlingen@telekom.de>
Change-Id: I908a251be76e4abfee5986729ae84b7f27057280

ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt

index d233b8b..0c5105e 100644 (file)
@@ -58,11 +58,10 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
         val tempFile = createTempFile()
         try {
             cbaFile.transferTo(tempFile)
-                .doOnSuccess {
-                    val uatSpec = readZipEntryAsText(tempFile, UAT_SPECIFICATION_FILE)
-                    val cbaBytes = tempFile.readBytes()
-                    uatExecutor.execute(uatSpec, cbaBytes)
-                }.subscribe()
+            cbaFile.transferTo(tempFile).thenReturn(tempFile).awaitSingle()
+            val uatSpec = readZipEntryAsText(tempFile, UAT_SPECIFICATION_FILE)
+            val cbaBytes = tempFile.readBytes()
+            uatExecutor.execute(uatSpec, cbaBytes)
         } catch (e: AssertionError) {
             throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message)
         } catch (t: Throwable) {