summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/python-executor
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-07-08 15:14:18 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-08 15:14:18 +0000
commit61672376481804b037a92d77042bac84eca0adf8 (patch)
treed598aaa055a81e8d6c658b2b116fd2814ae9118c /ms/blueprintsprocessor/functions/python-executor
parent64561f49e029e567c94e89141c8657a33112c06e (diff)
parent5f0a5dde67bc0e7c99bd8f9e9b7c447e69ce62fa (diff)
Merge "Enforce resolutionKey or resourceId/resourceType"
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt78
1 files changed, 41 insertions, 37 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 166d7b136..31aa7c7c1 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -48,11 +48,12 @@ class ComponentRemotePythonExecutorTest {
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(remoteScriptExecutionService)
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
+ val executionServiceInput =
+ JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
ExecutionServiceInput::class.java)!!
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("123456-1000",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts")
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python")
@@ -76,14 +77,17 @@ class ComponentRemotePythonExecutorTest {
fun testComponentRemotePythonExecutorProcessNB() {
runBlocking {
val remoteScriptExecutionService =
- MockRemoteScriptExecutionService()
+ MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService)
+ remoteScriptExecutionService)
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>(
- "123456-1000")
- val input = getMockedOutput(bluePrintRuntime)
+ "123456-1000")
+
+ every { bluePrintRuntime.setNodeTemplateAttributeValue(any(), any(), any()) } answers {}
+
+ val input = getMockedOutput(bluePrintRuntime)
componentRemotePythonExecutor.bluePrintRuntimeService =
- bluePrintRuntime
+ bluePrintRuntime
componentRemotePythonExecutor.applyNB(input)
}
}
@@ -96,13 +100,13 @@ class ComponentRemotePythonExecutorTest {
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python")
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor")
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
val mapper = ObjectMapper()
val rootNode = mapper.createObjectNode()
@@ -111,13 +115,13 @@ class ComponentRemotePythonExecutorTest {
val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python")
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor")
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
operationalInputs.putJsonElement("endpoint-selector", "aai")
operationalInputs.putJsonElement("dynamic-properties", rootNode)
operationalInputs.putJsonElement("command", "./run.sh")
@@ -125,8 +129,8 @@ class ComponentRemotePythonExecutorTest {
every {
svc.resolveNodeTemplateInterfaceOperationInputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process")
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
} returns operationalInputs
val stepInputData = StepData().apply {
@@ -135,42 +139,42 @@ class ComponentRemotePythonExecutorTest {
}
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile(
- "payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java)!!
executionServiceInput.stepData = stepInputData
val operationOutputs = hashMapOf<String, JsonNode>()
every {
svc.resolveNodeTemplateInterfaceOperationOutputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process")
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
} returns operationOutputs
val bluePrintRuntimeService = BluePrintMetadataUtils
- .getBluePrintRuntime("123456-1000",
- "./../../../../components/model-" +
- "catalog/blueprint-model/test-blueprint/" +
- "remote_scripts")
+ .getBluePrintRuntime("123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts")
every {
svc.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script")
- } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
"execute-remote-python", "component-script")
+ } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script")
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python", "prepare-environment-logs",
- "prepared successfully".asJsonPrimitive())
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive())
} returns Unit
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs", "N/A".asJsonPrimitive())
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive())
} returns Unit
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs",
- "processed successfully".asJsonPrimitive())
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive())
} returns Unit
every {