summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
index 2c481dca3..eb2a7a7ed 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
@@ -80,11 +80,15 @@ class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertySe
val restClientService = blueprintWebClientService(executionRequest)
val response = restClientService.exchangeResource(verb, urlPath, payload)
- if (response.isEmpty()) {
- logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)")
- } else {
- populateResource(executionRequest, sourceProperties, response, path)
+ val responseStatusCode = response.status
+ val responseBody = response.body
+ if (responseStatusCode in 200..299 && !responseBody.isBlank()) {
+ populateResource(executionRequest, sourceProperties, responseBody, path)
restClientService.tearDown()
+ } else {
+ val errMsg = "Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath) response_code: ($responseStatusCode)"
+ logger.warn(errMsg)
+ throw BluePrintProcessorException(errMsg)
}
}
} catch (e: Exception) {
@@ -156,4 +160,4 @@ class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertySe
}
}
}
-} \ No newline at end of file
+}