aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-03-31 16:34:43 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2020-03-31 16:51:43 -0400
commit8ba1014d06f1b56edfb76b8793666d56a3ab7b51 (patch)
treea7e7611c4762ce64ff14769146e4c5f67ccc2ec4 /ms/blueprintsprocessor
parentb52ae093581298dad8885dabd2d891167ad81658 (diff)
Fix ResolutionSummary - return empty string instead of null
Issue-ID: CCSDK-2246 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: I894bf605ee7f5b094d015fd637979ce055da5081
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt32
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt8
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt18
3 files changed, 40 insertions, 18 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 7bb757b8e..bfa23ccc2 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
@@ -203,18 +203,40 @@ class ResourceAssignmentUtils {
resourceAssignments: List<ResourceAssignment>,
resourceDefinitions: Map<String, ResourceDefinition>
): String {
+ val emptyTextNode = TextNode.valueOf("")
val resolutionSummaryList = resourceAssignments.map {
val definition = resourceDefinitions[it.name]
- val payload = definition?.sources?.get(it.dictionarySource)
+ val description = definition?.property?.description ?: ""
+ val value = it.property?.value
+ ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
+ ?: emptyTextNode
+
+ var payload: JsonNode = definition?.sources?.get(it.dictionarySource)
?.properties?.get("resolved-payload")
+ ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
+ ?: emptyTextNode
+
val metadata = definition?.property?.metadata
?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
?.toMutableList() ?: mutableListOf()
- val description = definition?.property?.description
+
+ val keyIdentifiers: MutableList<KeyIdentifier> = it.keyIdentifiers.map { k ->
+ if (k.value.isNullOrMissing()) KeyIdentifier(k.name, emptyTextNode) else k
+ }.toMutableList()
+
ResolutionSummary(
- it.name, it.property?.value, it.property?.required, it.property?.type,
- it.keyIdentifiers, description, metadata, it.dictionaryName,
- it.dictionarySource, payload, it.status, it.message
+ it.name,
+ value,
+ it.property?.required ?: false,
+ it.property?.type ?: "",
+ keyIdentifiers,
+ description,
+ metadata,
+ it.dictionaryName ?: "",
+ it.dictionarySource ?: "",
+ payload,
+ it.status ?: "",
+ it.message ?: ""
)
}
// Wrapper needed for integration with SDNC
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
index 9df8fb7d7..27adb51f4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
@@ -180,8 +180,8 @@ class ResourceAssignmentUtilsTest {
"resolution-summary":[
{
"name":"pnf-id",
- "value":null,
- "required":null,
+ "value":"",
+ "required":false,
"type":"string",
"key-identifiers":[],
"dictionary-description":"pnf-id",
@@ -191,8 +191,8 @@ class ResourceAssignmentUtilsTest {
"dictionary-name":"pnf-id",
"dictionary-source":"input",
"request-payload":{"mock":true},
- "status":null,
- "message":null
+ "status":"",
+ "message":""
}
]
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
index 77025c5a4..70f151b66 100644
--- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -112,25 +112,25 @@ data class DictionaryMetadataEntry(val name: String, val value: String)
*/
data class ResolutionSummary(
val name: String,
- val value: JsonNode?,
- val required: Boolean?,
- val type: String?,
+ val value: JsonNode,
+ val required: Boolean,
+ val type: String,
@JsonProperty("key-identifiers")
val keyIdentifiers: MutableList<KeyIdentifier>,
@JsonProperty("dictionary-description")
- val dictionaryDescription: String?,
+ val dictionaryDescription: String,
@JsonProperty("dictionary-metadata")
val dictionaryMetadata: MutableList<DictionaryMetadataEntry>,
@JsonProperty("dictionary-name")
- val dictionaryName: String?,
+ val dictionaryName: String,
@JsonProperty("dictionary-source")
- val dictionarySource: String?,
+ val dictionarySource: String,
@JsonProperty("request-payload")
- val requestPayload: JsonNode?,
+ val requestPayload: JsonNode,
@JsonProperty("status")
- val status: String?,
+ val status: String,
@JsonProperty("message")
- val message: String?
+ val message: String
)
/**
* Interface for Source Definitions (ex Input Source,