diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2019-11-22 18:06:08 -0500 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2019-11-26 21:32:38 +0000 |
commit | 341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch) | |
tree | 113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/blueprintsprocessor/functions/python-executor/src/test/kotlin | |
parent | d274e5fc552cf9ae25500f504f0434981cf3accf (diff) |
Formatting Code base with ktlint
No Business logic change, just the code format.
Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3
To format run: mvn process-sources -P format
Issue-ID: CCSDK-1947
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor/src/test/kotlin')
4 files changed, 95 insertions, 61 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 11396b7e9..4e919272a 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 @@ -36,11 +36,15 @@ import org.springframework.test.context.TestPropertySource import org.springframework.test.context.junit4.SpringRunner @RunWith(SpringRunner::class) -@ContextConfiguration(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"]) +@ContextConfiguration( + 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"] +) class ComponentJythonExecutorTest { @Autowired @@ -50,11 +54,15 @@ class ComponentJythonExecutorTest { fun testPythonComponentInjection() { runBlocking { - val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json", - ExecutionServiceInput::class.java)!! + val executionServiceInput = JacksonUtils.readValueFromClassPathFile( + "payload/requests/sample-activate-request.json", + ExecutionServiceInput::class.java + )!! - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + "1234", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) val stepMetaData: MutableMap<String, JsonNode> = hashMapOf() stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython") @@ -68,6 +76,5 @@ class ComponentJythonExecutorTest { executionServiceInput.stepData = stepInputData componentJythonExecutor.applyNB(executionServiceInput) } - } -}
\ No newline at end of file +} 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 18eb77b80..5e77937bc 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 @@ -25,23 +25,27 @@ class ComponentRemotePythonExecutorDSLTest { @Test fun testNodeTypeComponentRemotePythonExecutor() { val nodeType = BluePrintTypes.nodeTypeComponentRemotePythonExecutor() - //println(nodeType.asJsonString(true)) + // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeComponentRemotePythonExecutor") } @Test fun testNodeTemplateComponentRemotePythonExecutor() { - val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemotePythonExecutor("test-nodetemplate", - "test nodetemplate") { + val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemotePythonExecutor( + "test-nodetemplate", + "test nodetemplate" + ) { definedOperation("test operation") { inputs { endpointSelector("remote-container") command("python sample.py") - dynamicProperties("""{ + dynamicProperties( + """{ "prop1" : "1234", "prop2" : true, "prop3" : 23 - }""".trimIndent()) + }""".trimIndent() + ) argumentProperties("""["one", "two"]""") packages { type("pip") @@ -50,7 +54,7 @@ class ComponentRemotePythonExecutorDSLTest { } } } - //println(nodeTemplate.asJsonString(true)) + // println(nodeTemplate.asJsonString(true)) assertNotNull(nodeTemplate, "failed to generate nodeTemplateComponentRemotePythonExecutor") } -}
\ No newline at end of file +} 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 89af42579..847b08018 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 @@ -22,7 +22,12 @@ import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.runBlocking import org.junit.Test -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.* +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.PrepareRemoteEnvInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionOutput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StatusType +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive @@ -34,7 +39,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import kotlin.test.assertEquals import kotlin.test.assertNotNull - class ComponentRemotePythonExecutorTest { @Test @@ -45,16 +49,21 @@ class ComponentRemotePythonExecutorTest { val componentRemotePythonExecutor = ComponentRemotePythonExecutor(remoteScriptExecutionService) val executionServiceInput = - JacksonUtils.readValueFromClassPathFile("payload/requests/sample-remote-python-request.json", - ExecutionServiceInput::class.java)!! - + JacksonUtils.readValueFromClassPathFile( + "payload/requests/sample-remote-python-request.json", + ExecutionServiceInput::class.java + )!! - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("123456-1000", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts") + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + "123456-1000", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" + ) /** Load Workflow Inputs */ - bluePrintRuntimeService.assignWorkflowInputs("execute-remote-python", - executionServiceInput.payload.get("execute-remote-python-request")) + bluePrintRuntimeService.assignWorkflowInputs( + "execute-remote-python", + executionServiceInput.payload.get("execute-remote-python-request") + ) val stepMetaData: MutableMap<String, JsonNode> = hashMapOf() stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python") @@ -97,13 +106,16 @@ 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() @@ -112,13 +124,16 @@ 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") @@ -126,8 +141,9 @@ class ComponentRemotePythonExecutorTest { every { svc.resolveNodeTemplateInterfaceOperationInputs( - "execute-remote-python", - "ComponentRemotePythonExecutor", "process") + "execute-remote-python", + "ComponentRemotePythonExecutor", "process" + ) } returns operationalInputs val stepInputData = StepData().apply { @@ -136,42 +152,51 @@ 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") + "execute-remote-python", "component-script" + ) } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition( - "execute-remote-python", "component-script") + "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 { @@ -211,6 +236,5 @@ class MockRemoteScriptExecutionService : RemoteScriptExecutionService { } override suspend fun close() { - } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt index 33f68e273..c523b6653 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt @@ -21,12 +21,11 @@ import org.springframework.context.annotation.Configuration @Configuration open class MockInstanceConfiguration { + @Bean(name = ["json-parser-service", "netconf-rpc-service"]) open fun createComponentFunction(): MockJythonService { return MockJythonService() } } -class MockJythonService { - -}
\ No newline at end of file +class MockJythonService |