aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/python-executor/src/test
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 12:16:46 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 13:49:05 -0400
commit1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch)
tree4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/functions/python-executor/src/test
parentd97021cd756d63402545fdc2e14ac7611c3da118 (diff)
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor/src/test')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt201
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt6
4 files changed, 115 insertions, 107 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 784c6b7ff..d5fa0b20c 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -37,13 +37,17 @@ import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
- ComponentJythonExecutor::class, MockInstanceConfiguration::class]
+ classes = [
+ PythonExecutorConfiguration::class, PythonExecutorProperty::class,
+ ComponentJythonExecutor::class, MockInstanceConfiguration::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class ComponentJythonExecutorTest {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
index 5e77937bc..46a3120d5 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
@@ -44,7 +44,8 @@ class ComponentRemotePythonExecutorDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
argumentProperties("""["one", "two"]""")
packages {
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 d4edf4bb2..0a0d1659e 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
@@ -49,8 +49,8 @@ class ComponentRemotePythonExecutorTest {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val executionServiceInput =
@@ -93,8 +93,8 @@ class ComponentRemotePythonExecutorTest {
runBlocking {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("123456-1000")
@@ -112,113 +112,114 @@ class ComponentRemotePythonExecutorTest {
*/
fun getMockedOutput(svc: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
-
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
-
- val mapper = ObjectMapper()
- val rootNode = mapper.createObjectNode()
- rootNode.put("ip-address", "0.0.0.0")
- rootNode.put("type", "rest")
-
- val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
- operationalInputs.putJsonElement("endpoint-selector", "aai")
- operationalInputs.putJsonElement("dynamic-properties", rootNode)
- operationalInputs.putJsonElement("command", "./run.sh")
- operationalInputs.putJsonElement("packages", "py")
-
- every {
- svc.resolveNodeTemplateInterfaceOperationInputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
- )
- } returns operationalInputs
-
- val stepInputData = StepData().apply {
- name = "execute-remote-python"
- properties = stepMetaData
- }
-
- val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile(
- "payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java
- )!!
- executionServiceInput.stepData = stepInputData
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- svc.resolveNodeTemplateInterfaceOperationOutputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns operationOutputs
- val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
- "123456-1000",
- "./../../../../components/model-" +
- "catalog/blueprint-model/test-blueprint/" +
- "remote_scripts"
- )
- every {
- svc.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
- )
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python", "prepare-environment-logs",
- "prepared successfully".asJsonPrimitive()
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs", "N/A".asJsonPrimitive()
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs",
- "processed successfully".asJsonPrimitive()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns Unit
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
+ )
+ operationalInputs.putJsonElement("endpoint-selector", "aai")
+ operationalInputs.putJsonElement("dynamic-properties", rootNode)
+ operationalInputs.putJsonElement("command", "./run.sh")
+ operationalInputs.putJsonElement("packages", "py")
+
+ every {
+ svc.resolveNodeTemplateInterfaceOperationInputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
+ } returns operationalInputs
- every {
- svc.resolveDSLExpression("aai")
- } returns """{"url" : "http://xxx.com"}""".asJsonType()
+ val stepInputData = StepData().apply {
+ name = "execute-remote-python"
+ properties = stepMetaData
+ }
- every {
- svc.bluePrintContext()
- } returns bluePrintRuntimeService.bluePrintContext()
- return executionServiceInput
- }
+ val executionServiceInput = JacksonUtils
+ .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"
+ )
+ } returns operationOutputs
+ val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
+ "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"
+ )
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive()
+ )
+ } returns Unit
+
+ every {
+ svc.resolveDSLExpression("aai")
+ } returns """{"url" : "http://xxx.com"}""".asJsonType()
+
+ every {
+ svc.bluePrintContext()
+ } returns bluePrintRuntimeService.bluePrintContext()
+ return executionServiceInput
+ }
}
class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
+
override suspend fun init(selector: Any) {
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
index bec8ccae7..0efaaa113 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
@@ -29,8 +29,10 @@ import kotlin.test.assertNotNull
@ContextConfiguration(classes = [BluePrintPython::class, PythonExecutorProperty::class, String::class])
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class BlueprintPythonHostTest {