From daab14bd058de198c80b71d63e108fd788b7f5ee Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Mon, 26 Jul 2021 12:00:59 -0400 Subject: Revert "Renaming Files having BluePrint to have Blueprint" The renaming in CCSDK-3098 caused breaking changes to the grpc api and compile issues for kotlin scripts. Issue-ID: CCSDK-3385 Change-Id: I0d745cb858371678eabcb2284671c1fd76a1ab6d Signed-off-by: Jozsef Csongvai --- .../python/executor/ComponentJythonExecutor.kt | 12 +++--- .../executor/ComponentRemotePythonExecutor.kt | 10 ++--- .../executor/ComponentRemotePythonExecutorDSL.kt | 44 +++++++++++----------- .../python/executor/JythonComponentFunction.kt | 6 +-- .../executor/scripts/BlueprintJythonServiceImpl.kt | 16 ++++---- .../python/executor/scripts/BlueprintPythonHost.kt | 8 ++-- .../scripts/BlueprintPythonInterpreterProxy.kt | 6 +-- .../scripts/PythonExecutorConfiguration.kt | 2 +- .../python/executor/ComponentJythonExecutorTest.kt | 12 +++--- .../ComponentRemotePythonExecutorDSLTest.kt | 6 +-- .../executor/ComponentRemotePythonExecutorTest.kt | 42 ++++++++++----------- .../executor/scripts/BlueprintJythonServiceTest.kt | 6 +-- .../executor/scripts/BlueprintPythonHostTest.kt | 4 +- 13 files changed, 87 insertions(+), 87 deletions(-) (limited to 'ms/blueprintsprocessor/functions/python-executor') diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt index b32ccea13..e2b6f6560 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt @@ -24,8 +24,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts.BlueprintJythonServiceImpl import org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts.PythonExecutorConstants import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment import org.slf4j.LoggerFactory @@ -66,12 +66,12 @@ open class ComponentJythonExecutor( .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName) val artifactName: String = operationAssignment.implementation?.primary - ?: throw BlueprintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") + ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName) val pythonFileName = artifactDefinition.file - ?: throw BlueprintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)") + ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)") val pythonClassName = FilenameUtils.getBaseName(pythonFileName) @@ -80,7 +80,7 @@ open class ComponentJythonExecutor( checkNotEmpty(content) { "artifact ($artifactName) content is empty" } val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode - ?: throw BlueprintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})") + ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})") val jythonInstance: MutableMap = hashMapOf() jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName) @@ -99,6 +99,6 @@ open class ComponentJythonExecutor( componentFunction.operationName = operationName componentFunction.processId = processId componentFunction.workflowName = workflowName - componentFunction.scriptType = BlueprintConstants.SCRIPT_JYTHON + componentFunction.scriptType = BluePrintConstants.SCRIPT_JYTHON } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt index 5f6d98fd2..013c991cc 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor import com.fasterxml.jackson.databind.JsonNode import com.google.protobuf.ByteString -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService 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.RemoteIdentifier @@ -31,7 +31,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintMod import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConstant import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists @@ -52,7 +52,7 @@ import org.springframework.stereotype.Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class ComponentRemotePythonExecutor( private val remoteScriptExecutionService: RemoteScriptExecutionService, - private val bluePrintPropertiesService: BlueprintPropertiesService, + private val bluePrintPropertiesService: BluePrintPropertiesService, private val blueprintModelRepository: BlueprintModelRepository ) : AbstractComponentFunction() { @@ -107,7 +107,7 @@ open class ComponentRemotePythonExecutor( .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName) val artifactName: String = operationAssignment.implementation?.primary - ?: throw BlueprintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") + ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName) @@ -298,7 +298,7 @@ open class ComponentRemotePythonExecutor( } private fun noBlueprintErrors() = - bluePrintRuntimeService.getBlueprintError().stepErrors(stepName).isNullOrEmpty() + bluePrintRuntimeService.getBluePrintError().stepErrors(stepName).isNullOrEmpty() override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { addError("Failed in ComponentRemotePythonExecutor : ${runtimeException.message}") diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt index 6788310aa..3df25c402 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt @@ -18,8 +18,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ArrayNode -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType @@ -32,53 +32,53 @@ import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils /** Component Extensions **/ -fun BlueprintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType { +fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType { return nodeType( - id = "component-remote-python-executor", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_COMPONENT, + id = "component-remote-python-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, description = "This is Remote Python Execution Component." ) { attribute( - ComponentRemotePythonExecutor.ATTRIBUTE_PREPARE_ENV_LOG, BlueprintConstants.DATA_TYPE_STRING, + ComponentRemotePythonExecutor.ATTRIBUTE_PREPARE_ENV_LOG, BluePrintConstants.DATA_TYPE_STRING, false ) attribute( - ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_LOG, BlueprintConstants.DATA_TYPE_LIST, + ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_LOG, BluePrintConstants.DATA_TYPE_LIST, false ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } attribute( - ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BlueprintConstants.DATA_TYPE_JSON, + ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false ) operation("ComponentRemotePythonExecutor", "ComponentRemotePythonExecutor Operation") { inputs { property( - ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, BlueprintConstants.DATA_TYPE_STRING, + ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, BluePrintConstants.DATA_TYPE_STRING, false, "Remote Container or Server selector name." ) { defaultValue(ComponentRemotePythonExecutor.DEFAULT_SELECTOR) } property( - ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, BlueprintConstants.DATA_TYPE_JSON, + ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON, false, "Dynamic Json Content or DSL Json reference." ) property( - ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, BlueprintConstants.DATA_TYPE_JSON, + ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON, false, "Argument Json Content or DSL Json reference." ) property( - ComponentRemotePythonExecutor.INPUT_COMMAND, BlueprintConstants.DATA_TYPE_STRING, + ComponentRemotePythonExecutor.INPUT_COMMAND, BluePrintConstants.DATA_TYPE_STRING, true, "Command to execute." ) property( - ComponentRemotePythonExecutor.INPUT_PACKAGES, BlueprintConstants.DATA_TYPE_LIST, + ComponentRemotePythonExecutor.INPUT_PACKAGES, BluePrintConstants.DATA_TYPE_LIST, false, "Packages to install based on type." ) { entrySchema("dt-system-packages") @@ -88,26 +88,26 @@ fun BlueprintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType { } } -fun BlueprintTypes.dataTypeDtSystemPackages(): DataType { +fun BluePrintTypes.dataTypeDtSystemPackages(): DataType { return dataType( - id = "dt-system-packages", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_DATATYPES_ROOT, + id = "dt-system-packages", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, description = "This represent System Package Data Type" ) { - property("type", BlueprintConstants.DATA_TYPE_LIST, true, "") { + property("type", BluePrintConstants.DATA_TYPE_LIST, true, "") { constrain { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) validValues(arrayListOf("ansible_galaxy".asJsonPrimitive(), "pip".asJsonPrimitive())) } } - property("package", BlueprintConstants.DATA_TYPE_LIST, true, "") { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + property("package", BluePrintConstants.DATA_TYPE_LIST, true, "") { + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } } } /** Component Builder */ -fun BlueprintTypes.nodeTemplateComponentRemotePythonExecutor( +fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor( id: String, description: String, block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt index 0ac542bd0..891b09d88 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt @@ -18,15 +18,15 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException open class JythonComponentFunction : AbstractScriptComponentFunction() { override suspend fun processNB(executionRequest: ExecutionServiceInput) { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt index 9faacd9de..b0ce73588 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt @@ -20,11 +20,11 @@ import com.fasterxml.jackson.databind.node.ArrayNode import org.apache.commons.io.FilenameUtils import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.BlueprintJythonService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -42,7 +42,7 @@ class BlueprintJythonServiceImpl( val log: Logger = LoggerFactory.getLogger(BlueprintJythonService::class.java) inline fun jythonInstance( - blueprintContext: BlueprintContext, + blueprintContext: BluePrintContext, pythonClassName: String, content: String, dependencyInstanceNames: MutableMap? @@ -54,7 +54,7 @@ class BlueprintJythonServiceImpl( pythonPath.addAll(pythonExecutorProperty.modulePaths) val blueprintPythonConfigurations = - BlueprintPython(pythonExecutorProperty.executionPath, pythonPath, arrayListOf()) + BluePrintPython(pythonExecutorProperty.executionPath, pythonPath, arrayListOf()) val blueprintPythonHost = BlueprintPythonHost(blueprintPythonConfigurations) val pyObject = blueprintPythonHost.getPythonComponent(content, pythonClassName, dependencyInstanceNames) @@ -64,7 +64,7 @@ class BlueprintJythonServiceImpl( return pyObject.__tojava__(T::class.java) as T } - override fun jythonComponentInstance(bluePrintContext: BlueprintContext, scriptClassReference: String): + override fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String): BlueprintFunctionNode<*, *> { val pythonFileName = bluePrintContext.rootPath @@ -101,13 +101,13 @@ class BlueprintJythonServiceImpl( val blueprintBasePath: String = bluePrintContext.rootPath val artifactName: String = operationAssignment.implementation?.primary - ?: throw BlueprintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") + ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)") val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName) val pythonFileName = artifactDefinition.file - ?: throw BlueprintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)") + ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)") val pythonClassName = FilenameUtils.getBaseName(pythonFileName) log.info("Getting Jython Script Class($pythonClassName)") @@ -125,7 +125,7 @@ class BlueprintJythonServiceImpl( val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode - ?: throw BlueprintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})") + ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})") instanceDependenciesNode.forEach { instanceName -> jythonInstances[instanceName.textValue()] = applicationContext.getBean(instanceName.textValue()) diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt index 0fe68cf6a..f8f0e7e32 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt @@ -16,13 +16,13 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage import org.python.core.PyObject import org.python.util.PythonInterpreter @Deprecated("CDS won't support JythonService") -open class BlueprintPythonHost(private val bluePrintPython: BlueprintPython) { +open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) { private val blueprintPythonInterpreterProxy: BlueprintPythonInterpreterProxy @@ -45,14 +45,14 @@ open class BlueprintPythonHost(private val bluePrintPython: BlueprintPython) { bluePrintPython.moduleName = "Blueprint Python Script [Class Name = $interfaceName]" try { return blueprintPythonInterpreterProxy.getPythonInstance(properties) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to get python instance." throw e.updateErrorMessage( ExecutionServiceDomains.PYTHON_EXECUTOR, errorMsg, "Error in environment properties" ) } catch (e: Exception) { - throw BlueprintProcessorException("Failed to execute Jython component $e", e) + throw BluePrintProcessorException("Failed to execute Jython component $e", e) } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonInterpreterProxy.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonInterpreterProxy.kt index 9d98d90c7..0fb33f9c2 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonInterpreterProxy.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonInterpreterProxy.kt @@ -15,13 +15,13 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.python.core.PyObject import org.python.core.PySyntaxError import org.python.util.PythonInterpreter @Deprecated("CDS won't support JythonService") -open class BlueprintPythonInterpreterProxy(private val bluePrintPython: BlueprintPython) : PythonInterpreter() { +open class BlueprintPythonInterpreterProxy(private val bluePrintPython: BluePrintPython) : PythonInterpreter() { fun getPythonInstance(properties: MutableMap?): PyObject { properties?.forEach { (name, value) -> @@ -34,7 +34,7 @@ open class BlueprintPythonInterpreterProxy(private val bluePrintPython: Blueprin try { this.exec(bluePrintPython.content) } catch (e: PySyntaxError) { - throw BlueprintProcessorException("Error executing Jython code! Python error: '$e'", e) + throw BluePrintProcessorException("Error executing Jython code! Python error: '$e'", e) } } diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt index 3484fdbeb..593c0552b 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt @@ -52,7 +52,7 @@ class PythonExecutorConstants { } @Deprecated("CDS won't support JythonService") -open class BlueprintPython( +open class BluePrintPython( executablePath: String, blueprintPythonPlatform: MutableList, val argv: MutableList 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 089a33931..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 @@ -26,9 +26,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData import org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.mock.MockInstanceConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts.PythonExecutorConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts.PythonExecutorProperty -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -63,15 +63,15 @@ class ComponentJythonExecutorTest { ExecutionServiceInput::class.java )!! - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) val stepMetaData: MutableMap = hashMapOf() - stepMetaData.putJsonElement(BlueprintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython") - stepMetaData.putJsonElement(BlueprintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentJythonExecutor") - stepMetaData.putJsonElement(BlueprintConstants.PROPERTY_CURRENT_OPERATION, "process") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentJythonExecutor") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") componentJythonExecutor.bluePrintRuntimeService = bluePrintRuntimeService val stepInputData = StepData().apply { name = "activate-jython" 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 0318664a0..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 @@ -17,21 +17,21 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import kotlin.test.assertNotNull class ComponentRemotePythonExecutorDSLTest { @Test fun testNodeTypeComponentRemotePythonExecutor() { - val nodeType = BlueprintTypes.nodeTypeComponentRemotePythonExecutor() + val nodeType = BluePrintTypes.nodeTypeComponentRemotePythonExecutor() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeComponentRemotePythonExecutor") } @Test fun testNodeTemplateComponentRemotePythonExecutor() { - val nodeTemplate = BlueprintTypes.nodeTemplateComponentRemotePythonExecutor( + val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemotePythonExecutor( "test-nodetemplate", "test nodetemplate" ) { 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 2fd33f2a6..b81f05c6e 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,7 @@ import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.runBlocking import org.junit.Test -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService 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 @@ -33,13 +33,13 @@ 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.db.primary.repository.BlueprintModelRepository import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -53,7 +53,7 @@ class ComponentRemotePythonExecutorTest { val componentRemotePythonExecutor = ComponentRemotePythonExecutor( remoteScriptExecutionService, - mockk(), + mockk(), mockk() ) @@ -63,7 +63,7 @@ class ComponentRemotePythonExecutorTest { ExecutionServiceInput::class.java )!! - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "123456-1000", "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts" ) @@ -75,9 +75,9 @@ class ComponentRemotePythonExecutorTest { ) val stepMetaData: MutableMap = 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") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentRemotePythonExecutor") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") componentRemotePythonExecutor.bluePrintRuntimeService = bluePrintRuntimeService val stepInputData = StepData().apply { name = "execute-remote-python" @@ -98,12 +98,12 @@ class ComponentRemotePythonExecutorTest { val remoteScriptExecutionService = MockRemoteScriptExecutionService() val componentRemotePythonExecutor = ComponentRemotePythonExecutor( remoteScriptExecutionService, - mockk(), + mockk(), mockk() ) - val bluePrintRuntime = mockk("123456-1000") + val bluePrintRuntime = mockk("123456-1000") - every { bluePrintRuntime.getBlueprintError() } answers { BlueprintError() } // successful case. + every { bluePrintRuntime.getBluePrintError() } answers { BluePrintError() } // successful case. every { bluePrintRuntime.setNodeTemplateAttributeValue(any(), any(), any()) } answers {} val input = getMockedOutput(bluePrintRuntime) @@ -115,20 +115,20 @@ class ComponentRemotePythonExecutorTest { /** * Mocked input information for remote python executor. */ - fun getMockedOutput(svc: DefaultBlueprintRuntimeService): + fun getMockedOutput(svc: DefaultBluePrintRuntimeService): ExecutionServiceInput { val stepMetaData: MutableMap = hashMapOf() stepMetaData.putJsonElement( - BlueprintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, + BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python" ) stepMetaData.putJsonElement( - BlueprintConstants.PROPERTY_CURRENT_INTERFACE, + BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentRemotePythonExecutor" ) stepMetaData.putJsonElement( - BlueprintConstants.PROPERTY_CURRENT_OPERATION, "process" + BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process" ) val mapper = ObjectMapper() @@ -138,15 +138,15 @@ class ComponentRemotePythonExecutorTest { val operationalInputs: MutableMap = hashMapOf() operationalInputs.putJsonElement( - BlueprintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, + BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python" ) operationalInputs.putJsonElement( - BlueprintConstants.PROPERTY_CURRENT_INTERFACE, + 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) @@ -179,7 +179,7 @@ class ComponentRemotePythonExecutorTest { "ComponentRemotePythonExecutor", "process" ) } returns operationOutputs - val bluePrintRuntimeService = BlueprintMetadataUtils.bluePrintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime( "123456-1000", "./../../../../components/model-" + "catalog/blueprint-model/test-blueprint/" + diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceTest.kt index ad87f3c19..94ec1413f 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceTest.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceTest.kt @@ -23,7 +23,7 @@ import io.mockk.mockk import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -39,13 +39,13 @@ import kotlin.test.assertNotNull "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]) class BlueprintJythonServiceTest { - lateinit var blueprintContext: BlueprintContext + lateinit var blueprintContext: BluePrintContext @Autowired private lateinit var blueprintJythonService: BlueprintJythonServiceImpl @BeforeTest fun init() { - blueprintContext = mockk() + blueprintContext = mockk() every { blueprintContext.rootPath } returns normalizedPathName("target") } 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 2ebd10c38..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 @@ -26,7 +26,7 @@ import kotlin.test.BeforeTest import kotlin.test.assertNotNull @RunWith(SpringRunner::class) -@ContextConfiguration(classes = [BlueprintPython::class, PythonExecutorProperty::class, String::class]) +@ContextConfiguration(classes = [BluePrintPython::class, PythonExecutorProperty::class, String::class]) @TestPropertySource( properties = [ @@ -48,7 +48,7 @@ class BlueprintPythonHostTest { pythonPath.add(blueprintBasePath) pythonPath.addAll(pythonExecutorProperty.modulePaths) - blueprintPythonHost = BlueprintPythonHost(BlueprintPython(pythonExecutorProperty.executionPath, pythonPath, arrayListOf())) + blueprintPythonHost = BlueprintPythonHost(BluePrintPython(pythonExecutorProperty.executionPath, pythonPath, arrayListOf())) } @Test -- cgit 1.2.3-korg