diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions/python-executor/src')
13 files changed, 89 insertions, 89 deletions
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 bd7227744..7911559ae 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 @@ -56,7 +56,7 @@ open class ComponentJythonExecutor( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBluePrintError() + bluePrintRuntimeService.getBlueprintError() .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}") } @@ -67,12 +67,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) @@ -81,7 +81,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<String, Any> = hashMapOf() jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName) @@ -100,6 +100,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 ce51bd9ee..c20e63667 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 @@ -22,7 +22,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.async import kotlinx.coroutines.withTimeout -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.core.api.data.StatusType 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.checkFileExists import org.onap.ccsdk.cds.controllerblueprints.core.checkNotBlank @@ -51,7 +51,7 @@ import org.springframework.stereotype.Component @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class ComponentRemotePythonExecutor( private val remoteScriptExecutionService: RemoteScriptExecutionService, - private var bluePrintPropertiesService: BluePrintPropertiesService + private var bluePrintPropertiesService: BlueprintPropertiesService ) : AbstractComponentFunction() { private val log = LoggerFactory.getLogger(ComponentRemotePythonExecutor::class.java)!! @@ -94,7 +94,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) @@ -197,7 +197,7 @@ open class ComponentRemotePythonExecutor( log.error(catchallErrMsg, e) } // if Env preparation was successful, then proceed with command execution in this Env - if (bluePrintRuntimeService.getBluePrintError().errors.isEmpty()) { + if (bluePrintRuntimeService.getBlueprintError().errors.isEmpty()) { try { // Populate command execution properties and pass it to the remote server val properties = dynamicProperties?.returnNullIfMissing()?.rootFieldsToMap() ?: hashMapOf() @@ -260,7 +260,7 @@ open class ComponentRemotePythonExecutor( } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - bluePrintRuntimeService.getBluePrintError() + bluePrintRuntimeService.getBlueprintError() .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 3df25c402..6788310aa 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 891b09d88..0ac542bd0 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 b0ce73588..9faacd9de 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 <reified T> jythonInstance( - blueprintContext: BluePrintContext, + blueprintContext: BlueprintContext, pythonClassName: String, content: String, dependencyInstanceNames: MutableMap<String, Any>? @@ -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 f8f0e7e32..0fe68cf6a 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 0fb33f9c2..9d98d90c7 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<String, Any>?): 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 593c0552b..3484fdbeb 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<String>, val argv: MutableList<String> 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 d5fa0b20c..089a33931 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<String, JsonNode> = 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 46a3120d5..0318664a0 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 0a0d1659e..cad1f8df2 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 @@ -30,13 +30,13 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutio 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.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 @@ -50,7 +50,7 @@ class ComponentRemotePythonExecutorTest { val componentRemotePythonExecutor = ComponentRemotePythonExecutor( remoteScriptExecutionService, - mockk<BluePrintPropertiesService>() + mockk<BlueprintPropertiesService>() ) val executionServiceInput = @@ -59,7 +59,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" ) @@ -71,9 +71,9 @@ class ComponentRemotePythonExecutorTest { ) 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") + 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" @@ -94,11 +94,11 @@ class ComponentRemotePythonExecutorTest { val remoteScriptExecutionService = MockRemoteScriptExecutionService() val componentRemotePythonExecutor = ComponentRemotePythonExecutor( remoteScriptExecutionService, - mockk<BluePrintPropertiesService>() + mockk<BlueprintPropertiesService>() ) - val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("123456-1000") + val bluePrintRuntime = mockk<DefaultBlueprintRuntimeService>("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) @@ -110,20 +110,20 @@ class ComponentRemotePythonExecutorTest { /** * Mocked input information for remote python executor. */ - fun getMockedOutput(svc: DefaultBluePrintRuntimeService): + fun getMockedOutput(svc: DefaultBlueprintRuntimeService): ExecutionServiceInput { val stepMetaData: MutableMap<String, JsonNode> = 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() @@ -133,15 +133,15 @@ class ComponentRemotePythonExecutorTest { val operationalInputs: MutableMap<String, JsonNode> = 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) @@ -174,7 +174,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 94ec1413f..ad87f3c19 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>() + blueprintContext = mockk<BlueprintContext>() 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 0efaaa113..2ebd10c38 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 |