summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt15
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt21
2 files changed, 18 insertions, 18 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index 3482d4534..1cc44a2cb 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -28,7 +28,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.slf4j.LoggerFactory
@@ -68,27 +67,23 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
?: throw BluePrintProcessorException("couldn't get resource definition for ($name)")
}
- //TODO("Convert return Map<String, JsonNode>")
- open fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, Any> {
- val resolvedInputKeyMapping = HashMap<String, Any>()
+ open fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, JsonNode> {
+ val resolvedInputKeyMapping = HashMap<String, JsonNode>()
if (MapUtils.isNotEmpty(inputKeyMapping)) {
for ((key, value) in inputKeyMapping) {
val resultValue = raRuntimeService.getResolutionStore(value)
- val expressionValue = JacksonUtils.getValue(resultValue)
- log.trace("Reference dictionary key ({}), value ({})", key, expressionValue)
- resolvedInputKeyMapping[key] = expressionValue
+ resolvedInputKeyMapping[key] = resultValue
}
}
return resolvedInputKeyMapping
}
- //TODO("Convert keyMapping = MutableMap<String, JsonNode>")
- open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, Any>):
+ open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, JsonNode>):
String {
if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
return valueToResolve
}
- //TODO("Optimize to JSON Node directly")
+ //TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
}
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 eb2a7a7ed..be023307b 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
@@ -15,6 +15,7 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock
+import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.MissingNode
import org.apache.commons.collections.MapUtils
@@ -22,23 +23,27 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.RestResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
-import java.util.HashMap
+import java.util.*
class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertyService:
- MockBluePrintRestLibPropertyService): ResourceAssignmentProcessor() {
+ MockBluePrintRestLibPropertyService) : ResourceAssignmentProcessor() {
private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
- override fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, Any> {
- val resolvedInputKeyMapping = HashMap<String, Any>()
+ override fun resolveInputKeyMappingVariables(inputKeyMapping: Map<String, String>): Map<String, JsonNode> {
+ val resolvedInputKeyMapping = HashMap<String, JsonNode>()
if (MapUtils.isNotEmpty(inputKeyMapping)) {
- resolvedInputKeyMapping["service-instance-id"] = "10"
- resolvedInputKeyMapping["vnf_name"] = "vnf1"
- resolvedInputKeyMapping["vnf-id"] = "123456"
+
+ resolvedInputKeyMapping["service-instance-id"] = "10".asJsonPrimitive()
+ resolvedInputKeyMapping["vnf_name"] = "vnf1".asJsonPrimitive()
+ resolvedInputKeyMapping["vnf-id"] = "123456".asJsonPrimitive()
}
return resolvedInputKeyMapping
}