summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2021-03-24 13:13:23 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-24 13:13:23 +0000
commit02460042f5ff66c0e98d04a282d5ccd1f28ea083 (patch)
tree16666e4d3248644c35f06b41c2d5b98e44135964
parent2bed5569d0caeacbcca471e1ce0a23ba4a3f9a80 (diff)
parent3d9ee7af9e9278ac94b1b727ae2fb2cc7349c963 (diff)
Merge "Print process name with UAT assert error message" into honolulu
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt16
1 files changed, 8 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
index 00e53c1a1..44f2e7d0d 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt
@@ -135,7 +135,7 @@ class UatExecutor(
log.info("Executing process '${process.name}'")
val responseNormalizer = JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec)
val actualResponse = processBlueprint(
- client, process.request,
+ client, process,
process.expectedResponse, responseNormalizer
)
ProcessDefinition(
@@ -231,24 +231,24 @@ class UatExecutor(
@Throws(AssertionError::class)
private fun processBlueprint(
client: HttpClient,
- requestBody: JsonNode,
+ process: ProcessDefinition,
expectedResponse: JsonNode?,
responseNormalizer: (String) -> String
): JsonNode {
- val stringEntity = StringEntity(mapper.writeValueAsString(requestBody), ContentType.APPLICATION_JSON)
+ val stringEntity = StringEntity(mapper.writeValueAsString(process.request), ContentType.APPLICATION_JSON)
val request = HttpPost("$baseUrl/api/v1/execution-service/process").apply {
entity = stringEntity
}
val response = client.execute(request) { response ->
val statusLine = response.statusLine
- assertThat(statusLine.statusCode, equalTo(HttpStatus.SC_OK))
+ assertThat("${process.name}", statusLine.statusCode, equalTo(HttpStatus.SC_OK))
val entity = response.entity
- assertThat("Response contains no content", entity, notNullValue())
+ assertThat("${process.name} Response contains no content", entity, notNullValue())
entity.content.bufferedReader().use { it.readText() }
}
val actualResponse = responseNormalizer(response)
if (expectedResponse != null) {
- assertJsonEquals(expectedResponse, actualResponse)
+ assertJsonEquals(expectedResponse, actualResponse, process.name)
}
return mapper.readTree(actualResponse)!!
}
@@ -268,13 +268,13 @@ class UatExecutor(
}
@Throws(AssertionError::class)
- private fun assertJsonEquals(expected: JsonNode?, actual: String): Boolean {
+ private fun assertJsonEquals(expected: JsonNode?, actual: String, msg: String = ""): Boolean {
// special case
if ((expected == null) && actual.isBlank()) {
return true
}
// general case
- JSONAssert.assertEquals(expected?.toString(), actual, JSONCompareMode.LENIENT)
+ JSONAssert.assertEquals(msg, expected?.toString(), actual, JSONCompareMode.LENIENT)
// assertEquals throws an exception whenever match fails
return true
}