summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-08-02 10:02:34 -0400
committerDan Timoney <dtimoney@att.com>2019-08-09 20:03:31 +0000
commit132312ce49fa4efbe7008f3055aa86a8853bedd3 (patch)
treee6a17f60642ca0dda38216baee8b838ed678c900 /ms/blueprintsprocessor/functions/resource-resolution/src
parent2d879240396861aa253dd65b2476f35a2ffc0493 (diff)
Add resource source template DSL.
Change-Id: If68ce2e944700cb19380d34ff3b466a9c8633472 Issue-ID: CCSDK-1577 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt110
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt199
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt103
3 files changed, 338 insertions, 74 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index 2ca7046b3..40ea47e33 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -81,89 +81,91 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
/** Component Builder */
fun BluePrintTypes.nodeTemplateComponentResourceResolution(id: String,
description: String,
- block: ComponentResourceResolutionNodeTemplateOperationImplBuilder.() -> Unit)
+ block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit)
: NodeTemplate {
- return ComponentResourceResolutionNodeTemplateOperationImplBuilder(id, description).apply(block).build()
+ return ComponentResourceResolutionNodeTemplateBuilder(id, description).apply(block).build()
}
-class ComponentResourceResolutionNodeTemplateOperationImplBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder, ComponentResourceResolutionInputAssignmentBuilder,
- ComponentResourceResolutionOutputAssignmentBuilder>(id, "component-script-executor",
+class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
+ ComponentResourceResolutionNodeTemplateBuilder.InputsBuilder,
+ ComponentResourceResolutionNodeTemplateBuilder.OutputsBuilder>(id, "component-script-executor",
"ComponentResourceResolution",
- description)
+ description) {
-class ComponentResourceResolutionInputAssignmentBuilder : PropertiesAssignmentBuilder() {
+ class InputsBuilder : PropertiesAssignmentBuilder() {
- fun requestId(requestId: String) = requestId(requestId.asJsonPrimitive())
+ fun requestId(requestId: String) = requestId(requestId.asJsonPrimitive())
- fun requestId(requestId: JsonNode) {
- property(ResourceResolutionComponent.INPUT_REQUEST_ID, requestId)
- }
+ fun requestId(requestId: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_REQUEST_ID, requestId)
+ }
- fun resourceId(resourceId: String) = resourceId(resourceId.asJsonPrimitive())
+ fun resourceId(resourceId: String) = resourceId(resourceId.asJsonPrimitive())
- fun resourceId(resourceId: JsonNode) {
- property(ResourceResolutionComponent.INPUT_RESOURCE_ID, resourceId)
- }
+ fun resourceId(resourceId: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOURCE_ID, resourceId)
+ }
- fun actionName(actionName: String) = actionName(actionName.asJsonPrimitive())
+ fun actionName(actionName: String) = actionName(actionName.asJsonPrimitive())
- fun actionName(actionName: JsonNode) {
- property(ResourceResolutionComponent.INPUT_ACTION_NAME, actionName)
- }
+ fun actionName(actionName: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_ACTION_NAME, actionName)
+ }
- fun resolutionKey(resolutionKey: String) = resolutionKey(resolutionKey.asJsonPrimitive())
+ fun resolutionKey(resolutionKey: String) = resolutionKey(resolutionKey.asJsonPrimitive())
- fun resolutionKey(resolutionKey: JsonNode) {
- property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, resolutionKey)
- }
+ fun resolutionKey(resolutionKey: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, resolutionKey)
+ }
- fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType())
+ fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType())
- fun dynamicProperties(dynamicProperties: JsonNode) {
- property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, dynamicProperties)
- }
+ fun dynamicProperties(dynamicProperties: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, dynamicProperties)
+ }
- fun occurrence(occurrence: Int) = occurrence(occurrence.asJsonPrimitive())
+ fun occurrence(occurrence: Int) = occurrence(occurrence.asJsonPrimitive())
- fun occurrence(resolutionKey: JsonNode) {
- property(ResourceResolutionComponent.INPUT_OCCURRENCE, resolutionKey)
- }
+ fun occurrence(resolutionKey: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_OCCURRENCE, resolutionKey)
+ }
- fun storeResult(storeResult: Boolean) = storeResult(storeResult.asJsonPrimitive())
+ fun storeResult(storeResult: Boolean) = storeResult(storeResult.asJsonPrimitive())
- fun storeResult(storeResult: JsonNode) {
- property(ResourceResolutionComponent.INPUT_STORE_RESULT, storeResult)
- }
+ fun storeResult(storeResult: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_STORE_RESULT, storeResult)
+ }
- fun resourceType(resourceType: String) = resourceType(resourceType.asJsonPrimitive())
+ fun resourceType(resourceType: String) = resourceType(resourceType.asJsonPrimitive())
- fun resourceType(resourceType: JsonNode) {
- property(ResourceResolutionComponent.INPUT_RESOURCE_TYPE, resourceType)
- }
+ fun resourceType(resourceType: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOURCE_TYPE, resourceType)
+ }
- fun artifactPrefixNames(artifactPrefixNames: String) = artifactPrefixNames(artifactPrefixNames.jsonAsJsonType())
+ fun artifactPrefixNames(artifactPrefixNames: String) = artifactPrefixNames(artifactPrefixNames.jsonAsJsonType())
- fun artifactPrefixNames(artifactPrefixNameList: List<String>) {
- artifactPrefixNames(artifactPrefixNameList.asJsonString())
- }
+ fun artifactPrefixNames(artifactPrefixNameList: List<String>) =
+ artifactPrefixNames(artifactPrefixNameList.asJsonString())
- fun artifactPrefixNames(artifactPrefixNames: JsonNode) {
- property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, artifactPrefixNames)
+ fun artifactPrefixNames(artifactPrefixNames: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, artifactPrefixNames)
+ }
}
-}
-class ComponentResourceResolutionOutputAssignmentBuilder : PropertiesAssignmentBuilder() {
+ class OutputsBuilder : PropertiesAssignmentBuilder() {
- fun status(status: String) = status(status.asJsonPrimitive())
+ fun status(status: String) = status(status.asJsonPrimitive())
- fun status(status: JsonNode) {
- property(ResourceResolutionComponent.OUTPUT_STATUS, status)
- }
+ fun status(status: JsonNode) {
+ property(ResourceResolutionComponent.OUTPUT_STATUS, status)
+ }
- fun resourceAssignmentParams(resourceAssignmentParams: String) = resourceAssignmentParams(resourceAssignmentParams.asJsonType())
+ fun resourceAssignmentParams(resourceAssignmentParams: String) =
+ resourceAssignmentParams(resourceAssignmentParams.asJsonType())
- fun resourceAssignmentParams(resourceAssignmentParams: JsonNode) {
- property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, resourceAssignmentParams)
+ fun resourceAssignmentParams(resourceAssignmentParams: JsonNode) {
+ property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, resourceAssignmentParams)
+ }
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
index 4e0f0f18a..b1d694859 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
@@ -16,11 +16,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
+import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplatePropertyImplBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
fun BluePrintTypes.nodeTypeSourceInput(): NodeType {
@@ -85,7 +87,7 @@ fun BluePrintTypes.nodeTypeSourceRest(): NodeType {
}
}
property("payload", BluePrintConstants.DATA_TYPE_STRING,
- false, ""){
+ false, "") {
defaultValue("".asJsonPrimitive())
}
property("endpoint-selector", BluePrintConstants.DATA_TYPE_STRING,
@@ -131,11 +133,196 @@ fun BluePrintTypes.nodeTypeSourceCapability(): NodeType {
}
property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
true, "Kotlin Script class name or jython script name.")
- property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
- false, "Dynamic Json Content or DSL Json reference.")
property("key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
true, "Resource Resolution dependency dictionary names.") {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
}
+}
+
+/** Node Template Source Input **/
+fun BluePrintTypes.nodeTemplateSourceInput(id: String, description: String,
+ block: SourceInputNodeTemplateBuilder.() -> Unit): NodeTemplate {
+ return SourceInputNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class SourceInputNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(id,
+ "source-input", description)
+
+/** Node Template Source Default **/
+fun BluePrintTypes.nodeTemplateSourceDefault(id: String, description: String,
+ block: SourceDefaultNodeTemplateBuilder.() -> Unit): NodeTemplate {
+ return SourceDefaultNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class SourceDefaultNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(id,
+ "source-default", description)
+
+/** Node Template Source DB **/
+fun BluePrintTypes.nodeTemplateSourceDb(id: String, description: String,
+ block: SourceDbNodeTemplateBuilder.() -> Unit): NodeTemplate {
+ return SourceDbNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class SourceDbNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplatePropertyImplBuilder<SourceDbNodeTemplateBuilder.PropertiesBuilder>(id,
+ "source-db", description) {
+
+ class PropertiesBuilder : PropertiesAssignmentBuilder() {
+ fun type(type: String) = type(type.asJsonPrimitive())
+
+ fun type(type: JsonNode) {
+ property("type", type)
+ }
+
+ fun endpointSelector(endpointSelector: String) = endpointSelector(endpointSelector.asJsonPrimitive())
+
+ fun endpointSelector(endpointSelector: JsonNode) {
+ property("endpoint-selector", endpointSelector)
+ }
+
+ fun query(query: String) = query(query.asJsonPrimitive())
+
+ fun query(query: JsonNode) {
+ property("query", query)
+ }
+
+ fun inputKeyMapping(block: KeyMappingBuilder.() -> Unit) {
+ val map = KeyMappingBuilder().apply(block).build()
+ property("input-key-mapping", map.asJsonType())
+ }
+
+ fun outputKeyMapping(block: KeyMappingBuilder.() -> Unit) {
+ val map = KeyMappingBuilder().apply(block).build()
+ property("output-key-mapping", map.asJsonType())
+ }
+
+ fun keyDependencies(keyDependencies: String) = keyDependencies(keyDependencies.asJsonType())
+
+ fun keyDependencies(keyDependencies: List<String>) = keyDependencies(keyDependencies.asJsonString())
+
+ fun keyDependencies(keyDependencies: JsonNode) {
+ property("key-dependencies", keyDependencies)
+ }
+ }
+}
+
+class KeyMappingBuilder() {
+ val map: MutableMap<String, String> = hashMapOf()
+ fun map(key: String, value: String) {
+ map[key] = value
+ }
+
+ fun build(): MutableMap<String, String> {
+ return map
+ }
+}
+
+
+/** Node Template Source Rest **/
+fun BluePrintTypes.nodeTemplateSourceRest(id: String, description: String,
+ block: SourceRestNodeTemplateBuilder.() -> Unit): NodeTemplate {
+ return SourceRestNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class SourceRestNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplatePropertyImplBuilder<SourceRestNodeTemplateBuilder.PropertiesBuilder>(id,
+ "source-rest", description) {
+
+ class PropertiesBuilder : PropertiesAssignmentBuilder() {
+ fun type(type: String) = type(type.asJsonPrimitive())
+
+ fun type(type: JsonNode) {
+ property("type", type)
+ }
+
+ fun endpointSelector(endpointSelector: String) = endpointSelector(endpointSelector.asJsonPrimitive())
+
+ fun endpointSelector(endpointSelector: JsonNode) {
+ property("endpoint-selector", endpointSelector)
+ }
+
+ fun verb(verb: String) = verb(verb.asJsonPrimitive())
+
+ fun verb(verb: JsonNode) {
+ property("verb", verb)
+ }
+
+ fun payload(payload: String) = payload(payload.asJsonPrimitive())
+
+ fun payload(payload: JsonNode) {
+ property("payload", payload)
+ }
+
+ fun urlPath(urlPath: String) = urlPath(urlPath.asJsonPrimitive())
+
+ fun urlPath(urlPath: JsonNode) {
+ property("url-path", urlPath)
+ }
+
+ fun path(path: String) = path(path.asJsonPrimitive())
+
+ fun path(path: JsonNode) {
+ property("path", path)
+ }
+
+ fun expressionType(expressionType: String) = expressionType(expressionType.asJsonPrimitive())
+
+ fun expressionType(expressionType: JsonNode) {
+ property("expression-type", expressionType)
+ }
+
+ fun inputKeyMapping(block: KeyMappingBuilder.() -> Unit) {
+ val map = KeyMappingBuilder().apply(block).build()
+ property("input-key-mapping", map.asJsonType())
+ }
+
+ fun outputKeyMapping(block: KeyMappingBuilder.() -> Unit) {
+ val map = KeyMappingBuilder().apply(block).build()
+ property("output-key-mapping", map.asJsonType())
+ }
+
+ fun keyDependencies(keyDependencies: String) = keyDependencies(keyDependencies.asJsonType())
+
+ fun keyDependencies(keyDependencies: List<String>) = keyDependencies(keyDependencies.asJsonString())
+
+ fun keyDependencies(keyDependencies: JsonNode) {
+ property("key-dependencies", keyDependencies)
+ }
+ }
+}
+
+/** Node Template Source Rest **/
+fun BluePrintTypes.nodeTemplateSourceCapability(id: String, description: String,
+ block: SourceCapabilityNodeTemplateBuilder.() -> Unit): NodeTemplate {
+ return SourceCapabilityNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplatePropertyImplBuilder<SourceCapabilityNodeTemplateBuilder.PropertiesBuilder>(id,
+ "source-capability", description) {
+
+ class PropertiesBuilder : PropertiesAssignmentBuilder() {
+ fun type(type: String) = type(type.asJsonPrimitive())
+
+ fun type(type: JsonNode) {
+ property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, type)
+ }
+
+ fun scriptClassReference(scriptClassReference: String) = scriptClassReference(scriptClassReference.asJsonPrimitive())
+
+ fun scriptClassReference(scriptClassReference: JsonNode) {
+ property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, scriptClassReference)
+ }
+
+ fun keyDependencies(keyDependencies: String) = keyDependencies(keyDependencies.asJsonType())
+
+ fun keyDependencies(keyDependencies: List<String>) = keyDependencies(keyDependencies.asJsonString())
+
+ fun keyDependencies(keyDependencies: JsonNode) {
+ property("key-dependencies", keyDependencies)
+ }
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
index 6ad6bc56a..2eb208566 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
@@ -24,36 +24,111 @@ class ResourceSourceDSLTest {
@Test
fun testNodeTypeSourceInput() {
- val nodeTemplate = BluePrintTypes.nodeTypeSourceInput()
- //println(nodeTemplate.asJsonString(true))
- assertNotNull(nodeTemplate, "failed to generate nodeTypeSourceInput")
+ val nodeType = BluePrintTypes.nodeTypeSourceInput()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeSourceInput")
}
@Test
fun testNodeTypeSourceDefault() {
- val nodeTemplate = BluePrintTypes.nodeTypeSourceDefault()
- //println(nodeTemplate.asJsonString(true))
- assertNotNull(nodeTemplate, "failed to generate nodeTypeSourceDefault")
+ val nodeType = BluePrintTypes.nodeTypeSourceDefault()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeSourceDefault")
}
@Test
fun testNodeTypeSourceDb() {
- val nodeTemplate = BluePrintTypes.nodeTypeSourceDb()
- //println(nodeTemplate.asJsonString(true))
- assertNotNull(nodeTemplate, "failed to generate nodeTypeSourceDb")
+ val nodeType = BluePrintTypes.nodeTypeSourceDb()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeSourceDb")
}
@Test
fun testNodeTypeSourceRest() {
- val nodeTemplate = BluePrintTypes.nodeTypeSourceRest()
- //println(nodeTemplate.asJsonString(true))
- assertNotNull(nodeTemplate, "failed to generate nodeTypeSourceRest")
+ val nodeType = BluePrintTypes.nodeTypeSourceRest()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeSourceRest")
}
@Test
fun testNodeTypeSourceCapability() {
- val nodeTemplate = BluePrintTypes.nodeTypeSourceCapability()
+ val nodeType = BluePrintTypes.nodeTypeSourceCapability()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeSourceCapability")
+ }
+
+ @Test
+ fun testNodeTemplateSourceInput() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateSourceInput("InputSystem", "") {
+
+ }
+ //println(nodeTemplate.asJsonString(true))
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceInput")
+ }
+
+ @Test
+ fun testNodeTemplateSourceDefault() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateSourceDefault("DefaultSystem", "") {
+
+ }
+ //println(nodeTemplate.asJsonString(true))
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceDefault")
+ }
+
+ @Test
+ fun testNodeTemplateSourceDb() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateSourceDb("DbSystem", "") {
+ definedProperties {
+ type("SQL")
+ query("SELECT * FROM DB WHERE name = \$name")
+ endpointSelector("db-source-endpoint")
+ inputKeyMapping {
+ map("name", "\$name")
+ }
+ outputKeyMapping {
+ map("field_name", "\$fieldValue")
+ }
+ keyDependencies(arrayListOf("name"))
+ }
+ }
+ //println(nodeTemplate.asJsonString(true))
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceDb")
+ }
+
+ @Test
+ fun testNodeTemplateSourceRest() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateSourceRest("restSystem", "") {
+ definedProperties {
+ type("JSON")
+ endpointSelector("rest-source-endpoint")
+ expressionType("JSON_PATH")
+ urlPath("/location")
+ path(".\$name")
+ verb("GET")
+ payload("sample payload")
+ inputKeyMapping {
+ map("name", "\$name")
+ }
+ outputKeyMapping {
+ map("field_name", "\$fieldValue")
+ }
+ keyDependencies(arrayListOf("name"))
+ }
+ }
+ //println(nodeTemplate.asJsonString(true))
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceRest")
+ }
+
+ @Test
+ fun testNodeTemplateSourceCapability() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateSourceCapability("capabiltySystem", "") {
+ definedProperties {
+ type("kotlin")
+ scriptClassReference("Scripts/Sample.kt")
+ keyDependencies(arrayListOf("name"))
+ }
+ }
//println(nodeTemplate.asJsonString(true))
- assertNotNull(nodeTemplate, "failed to generate nodeTypeSourceCapability")
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceCapability")
}
} \ No newline at end of file