summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-06-20 14:14:37 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-06-25 18:33:28 +0000
commit2e2d56dba10dc8ccc9673e969f95cfb70f9b44bc (patch)
tree37dc55cca249ba31f16095603da7bdc0f8e64b48 /ms/controllerblueprints
parentb3eb3fc950e6cda05d85d8422863b81bd0e766dd (diff)
Allow multiple resolution for same node template
- also fixing default mechanism - fixes rest resolution when NullNode is returned as input value - fixes rest resolution when data type specified so raw json isn't returned, only the parsed json based on the data type Change-Id: I1f4a35c6c97000b52620c9b0cc911f15016c4e80 Issue-ID: CCSDK-1422 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms/controllerblueprints')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt187
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt1
2 files changed, 97 insertions, 91 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 0819ed74b..b48e446d3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -91,7 +91,8 @@ interface BluePrintRuntimeService<T> {
fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode)
- fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode)
+ fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition,
+ value: JsonNode)
fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode)
@@ -133,7 +134,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
: BluePrintRuntimeService<MutableMap<String, JsonNode>> {
@Transient
- private val log= LoggerFactory.getLogger(BluePrintRuntimeService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintRuntimeService::class.toString())
private var store: MutableMap<String, JsonNode> = hashMapOf()
@@ -144,7 +145,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Load Blueprint Environments Properties
*/
val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
+ .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath)
}
@@ -213,7 +214,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun loadEnvironments(type: String, fileName: String) {
BluePrintMetadataUtils.environmentFileProperties(fileName).forEach { key, value ->
setNodeTemplateAttributeValue(type, key.toString(), value.toString()
- .asJsonPrimitive())
+ .asJsonPrimitive())
}
}
@@ -227,7 +228,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- propertyDefinitions.forEach { nodeTypePropertyName, nodeTypeProperty ->
+ propertyDefinitions.forEach { (nodeTypePropertyName, nodeTypeProperty) ->
// Get the Express or Value for the Node Template
val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
@@ -236,13 +237,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName,
- nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = nodeTypeProperty.defaultValue!!
- }
+ nodeTypePropertyName, propertyAssignment)
}
+
+ // Set default value if null
+ if (resolvedValue is NullNode) {
+ nodeTypeProperty.defaultValue?.let { resolvedValue = nodeTypeProperty.defaultValue!! }
+ }
+
// Set for Return of method
propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
}
@@ -258,7 +260,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val expression = propertyDefinition.value ?: propertyDefinition.defaultValue
if (expression != null) {
propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, expression)
+ propertyName, expression)
}
}
return propertyAssignmentValue
@@ -272,7 +274,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
propertyAssignments.forEach { propertyName, propertyExpression ->
val propertyAssignmentExpression = PropertyAssignmentService(this)
propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, propertyExpression)
+ propertyName, propertyExpression)
}
return propertyAssignmentValue
}
@@ -286,13 +288,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Get the Node Type Definitions
val nodeTypePropertieDefinitions: MutableMap<String, PropertyDefinition> = bluePrintContext
- .nodeTypeChainedProperties(nodeTemplate.type)!!
+ .nodeTypeChainedProperties(nodeTemplate.type)!!
/**
* Resolve the NodeTemplate Property Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypePropertieDefinitions,
- propertyAssignments)
+ propertyAssignments)
}
override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
@@ -304,13 +306,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
- .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+ .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
/**
* Resolve the Capability Property Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions,
- propertyAssignments)
+ propertyAssignments)
}
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
@@ -320,14 +322,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
"($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationInputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
+ ?: hashMapOf()
log.info("input definition for node template ($nodeTemplateName), values ($propertyAssignments)")
@@ -335,7 +337,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Input Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs,
- propertyAssignments)
+ propertyAssignments)
}
@@ -347,19 +349,19 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
"($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
+ ?: hashMapOf()
/**
* Resolve the Property Output Assignment Values.
*/
val propertyAssignmentValue = resolveNodeTemplatePropertyAssignments(nodeTemplateName,
- nodeTypeInterfaceOperationOutputs, propertyAssignments)
+ nodeTypeInterfaceOperationOutputs, propertyAssignments)
// Store operation output values into context
propertyAssignmentValue.forEach { key, value ->
@@ -369,17 +371,19 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String {
- val artifactDefinition: ArtifactDefinition = resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ val artifactDefinition: ArtifactDefinition =
+ resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val propertyAssignmentExpression = PropertyAssignmentService(this)
return propertyAssignmentExpression.artifactContent(artifactDefinition)
}
- override fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String, artifactName: String): ArtifactDefinition {
+ override fun resolveNodeTemplateArtifactDefinition(nodeTemplateName: String,
+ artifactName: String): ArtifactDefinition {
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
return nodeTemplate.artifacts?.get(artifactName)
- ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
- "template")
+ ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
+ "template")
}
@@ -390,14 +394,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun resolveDSLExpression(dslPropertyName: String): JsonNode {
val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName)
return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments)
- && propertyAssignments is ObjectNode) {
+ && propertyAssignments is ObjectNode) {
val rootKeyMap = propertyAssignments.rootFieldsToMap()
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
rootKeyMap.forEach { propertyName, propertyValue ->
val propertyAssignmentExpression = PropertyAssignmentService(this)
propertyAssignmentValue[propertyName] = propertyAssignmentExpression
- .resolveAssignmentExpression("DSL", propertyName, propertyValue)
+ .resolveAssignmentExpression("DSL", propertyName, propertyValue)
}
propertyAssignmentValue.asJsonNode()
} else {
@@ -407,7 +411,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting input path ({}), values ({})", path, value)
put(path, value)
}
@@ -415,41 +419,42 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setWorkflowInputValue(workflowName: String, propertyName: String,
propertyDefinition: PropertyDefinition, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
- .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
put(path, value)
}
- override fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ override fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting operation property path ({}), values ({})", path, value)
put(path, value)
}
@@ -458,14 +463,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
@@ -473,51 +478,51 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun getInputValue(propertyName: String): JsonNode {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
operationName: String, propertyName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
return getJsonNode(path)
}
@@ -525,7 +530,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
log.info("assignInputs from input JSON ({})", jsonNode.toString())
bluePrintContext.inputs()?.forEach { propertyName, property ->
val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
}
@@ -538,7 +543,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
bluePrintContext.workflowByName(workflowName).inputs?.forEach { propertyName, property ->
if (propertyName != dynamicInputPropertiesName) {
val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
}
@@ -546,8 +551,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName)
workflowDynamicInputs?.let {
- bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.forEach { propertyName, property ->
- val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")
+ ?.properties?.forEach { propertyName, property ->
+ val valueNode: JsonNode =
+ workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
?: property.defaultValue
?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
@@ -566,9 +573,9 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).toString()
store.keys.filter {
it.startsWith(path)
}.map {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
index 63c8ad74e..de6d4d8e4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
@@ -29,7 +29,6 @@ import kotlin.test.BeforeTest
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
-@RunWith(SpringRunner::class)
class BluePrintTemplateServiceTest {
lateinit var blueprintRuntime: BluePrintRuntimeService<*>