From 74c548363d3dafd8ac26f0aacaa9a457ce29dfd5 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Thu, 1 Aug 2019 09:12:04 -0400 Subject: Add remote python executor DSL properties Change-Id: I7888ac302da2a51ca34c531b7553d04af13786ac Issue-ID: CCSDK-1380 Signed-off-by: Brinda Santh --- .../resolution/ResourceResolutionComponentDSL.kt | 44 ++++++---------------- .../ResourceResolutionComponentDSLTest.kt | 2 +- 2 files changed, 13 insertions(+), 33 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src') 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 c71541efd..a44750d11 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 @@ -94,65 +94,49 @@ class ComponentResourceResolutionNodeTemplateImplBuilder(id: String, description class ComponentResourceResolutionInputAssignmentBuilder : 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 resourceId(resourceId: String) { - resourceId(resourceId.asJsonPrimitive()) - } + fun resourceId(resourceId: String) = resourceId(resourceId.asJsonPrimitive()) 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 resolutionKey(resolutionKey: String) { - resolutionKey(resolutionKey.asJsonPrimitive()) - } + fun resolutionKey(resolutionKey: String) = resolutionKey(resolutionKey.asJsonPrimitive()) fun resolutionKey(resolutionKey: JsonNode) { property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, resolutionKey) } - fun dynamicProperty(dynamicProperty: String) { - dynamicProperty(dynamicProperty.asJsonType()) - } + fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType()) - fun dynamicProperty(dynamicProperty: JsonNode) { - property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, dynamicProperty) + 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 storeResult(storeResult: Boolean) { - storeResult(storeResult.asJsonPrimitive()) - } + fun storeResult(storeResult: Boolean) = storeResult(storeResult.asJsonPrimitive()) 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) @@ -171,17 +155,13 @@ class ComponentResourceResolutionInputAssignmentBuilder : PropertiesAssignmentBu class ComponentResourceResolutionOutputAssignmentBuilder : 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 resourceAssignmentParams(resourceAssignmentParams: String) { - resourceAssignmentParams(resourceAssignmentParams.asJsonType()) - } + fun resourceAssignmentParams(resourceAssignmentParams: String) = resourceAssignmentParams(resourceAssignmentParams.asJsonType()) fun resourceAssignmentParams(resourceAssignmentParams: JsonNode) { property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, resourceAssignmentParams) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt index 16052ae74..d0566785e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt @@ -42,7 +42,7 @@ class ResourceResolutionComponentDSLTest { resourceType("vnf") storeResult(false) artifactPrefixNames(arrayListOf("template1", "template2")) - dynamicProperty("""{ + dynamicProperties("""{ "prop1" : "1234", "prop2" : true, "prop3" : 23 -- cgit 1.2.3-korg