From 72fed8f256ca2298f2d22dd70595803911a0b2b8 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Fri, 26 Jul 2019 10:22:16 -0400 Subject: Upgrade cds spring and kotlin versions. Change-Id: I0f323bd13c433d9ef0e207f51234d10cd8c22858 Issue-ID: CCSDK-1352 Signed-off-by: Brinda Santh --- .../main/kotlin/scripts/InternalRAProcessor.cba.kt | 36 ++++++++++++++++++++++ .../kotlin/scripts/InternalRAProcessor.cba.kts | 36 ---------------------- ms/blueprintsprocessor/parent/pom.xml | 8 ++--- .../core/scripts/BluePrintScriptingHost.kt | 22 ++++++------- ms/controllerblueprints/parent/pom.xml | 5 --- 5 files changed, 48 insertions(+), 59 deletions(-) create mode 100644 ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt delete mode 100644 ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts (limited to 'ms') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt new file mode 100644 index 000000000..32f04e6a0 --- /dev/null +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt @@ -0,0 +1,36 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.slf4j.LoggerFactory + +open class SimpleRAProcessor : ResourceAssignmentProcessor() { + + private val log = LoggerFactory.getLogger(SimpleRAProcessor::class.java)!! + + override fun getName(): String { + return "ScriptResourceAssignmentProcessor" + } + + override suspend fun processNB(executionRequest: ResourceAssignment) { + log.info("Processing input") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { + log.info("Recovering input") + } +} diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts deleted file mode 100644 index 32f04e6a0..000000000 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2019 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.slf4j.LoggerFactory - -open class SimpleRAProcessor : ResourceAssignmentProcessor() { - - private val log = LoggerFactory.getLogger(SimpleRAProcessor::class.java)!! - - override fun getName(): String { - return "ScriptResourceAssignmentProcessor" - } - - override suspend fun processNB(executionRequest: ResourceAssignment) { - log.info("Processing input") - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { - log.info("Recovering input") - } -} diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml index b03c7b4d7..1ed0a6570 100755 --- a/ms/blueprintsprocessor/parent/pom.xml +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -14,7 +14,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 org.onap.ccsdk.cds @@ -28,11 +29,6 @@ Blueprints Processor Parent 1.8 - 2.1.3.RELEASE - 5.1.5.RELEASE - 1.3.21 - 1.3.21 - 1.1.1 1.18.0 2.2.0 0.1.55 diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt index 05a147171..d35f2b49b 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt @@ -31,14 +31,13 @@ val blueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfigura open class BlueprintScriptingHost(evaluator: ScriptEvaluator) : BasicScriptingHost(blueprintScriptCompiler, evaluator) { - override fun eval(script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration, - configuration: ScriptEvaluationConfiguration?): ResultWithDiagnostics = + override fun eval(script: SourceCode, compilationConfiguration: ScriptCompilationConfiguration, + evaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics = runInCoroutineContext { - - blueprintScriptCompiler(script, scriptCompilationConfiguration) - .onSuccess { - evaluator(it, configuration) + blueprintScriptCompiler(script, compilationConfiguration) + .onSuccess { compiledScript -> + evaluator(compiledScript, evaluationConfiguration ?: ScriptEvaluationConfiguration.Default) }.onFailure { failedResult -> val messages = failedResult.reports.joinToString("\n") throw BluePrintProcessorException(messages) @@ -51,7 +50,7 @@ open class BluePrintScriptEvaluator(private val scriptClassName: String) : Scrip private val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!! override suspend operator fun invoke(compiledScript: CompiledScript<*>, - scriptEvaluationConfiguration: ScriptEvaluationConfiguration? + scriptEvaluationConfiguration: ScriptEvaluationConfiguration ): ResultWithDiagnostics = try { log.debug("Getting script class name($scriptClassName) from the compiled sources ") @@ -59,20 +58,19 @@ open class BluePrintScriptEvaluator(private val scriptClassName: String) : Scrip val bluePrintCompiledScript = compiledScript as BluePrintCompiledScript bluePrintCompiledScript.scriptClassFQName = scriptClassName - val classResult = compiledScript.getClass(scriptEvaluationConfiguration) - when (classResult) { + when (val classResult = compiledScript.getClass(scriptEvaluationConfiguration)) { is ResultWithDiagnostics.Failure -> classResult is ResultWithDiagnostics.Success -> { val scriptClass = classResult.value val args = ArrayList() - scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach { + scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.providedProperties)?.forEach { args.add(it.value) } - scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let { + scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.implicitReceivers)?.let { args.addAll(it) } - scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let { + scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.constructorArgs)?.let { args.addAll(it) } diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml index 6ff76e944..4b571191d 100644 --- a/ms/controllerblueprints/parent/pom.xml +++ b/ms/controllerblueprints/parent/pom.xml @@ -29,11 +29,6 @@ pom 1.8 - 2.1.3.RELEASE - 5.1.5.RELEASE - 1.3.21 - 1.3.21 - 1.1.1 1.18.0 3.6.1 1.0.0 -- cgit 1.2.3-korg