From f439f401aa06ea497a84c73f3c158dfc6c62bc61 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Wed, 10 Jul 2019 18:27:23 -0400 Subject: Refractor blueprint-script to avoid cyclic dependency. There is a possibility of cyclic dependencies between blueprint-script module and code module. To avoid cyclic dependency blueprint-script implementation should be moved to Core module. This implementation has zero impact on code functionality and code testing. Change-Id: Ic18ea848cb2e1e2e7a5f1c144714de26d1495cee Issue-ID: CCSDK-1469 Signed-off-by: Brinda Santh --- .../modules/services/execution-service/pom.xml | 4 ---- .../services/execution/ComponentFunctionScriptingService.kt | 12 +++++++----- .../execution/scripts/AbstractComponentFunctionTest.kt | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'ms/blueprintsprocessor/modules/services') diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index edfa4e3f7..a48d4e0bb 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -37,10 +37,6 @@ org.onap.ccsdk.cds.controllerblueprints blueprint-core - - org.onap.ccsdk.cds.controllerblueprints - blueprint-scripts - org.onap.ccsdk.cds.blueprintsprocessor processor-core diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt index b2991be5e..49a2c62b1 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt @@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext @@ -28,15 +29,14 @@ import org.springframework.stereotype.Service @Service class ComponentFunctionScriptingService(private val applicationContext: ApplicationContext, - private val bluePrintScriptsService: BluePrintScriptsService, private val blueprintJythonService: BlueprintJythonService) { private val log = LoggerFactory.getLogger(ComponentFunctionScriptingService::class.java) suspend fun scriptInstance(componentFunction: AbstractComponentFunction, - scriptType: String, - scriptClassReference: String, - instanceDependencies: List): T { + scriptType: String, + scriptClassReference: String, + instanceDependencies: List): T { log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " + "instanceDependencies($instanceDependencies)") @@ -66,14 +66,16 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat suspend fun > scriptInstance(bluePrintContext: BluePrintContext, scriptType: String, - scriptClassReference: String): T { + scriptClassReference: String): T { var scriptComponent: T? = null when (scriptType) { BluePrintConstants.SCRIPT_INTERNAL -> { + val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() scriptComponent = bluePrintScriptsService.scriptInstance(scriptClassReference) } BluePrintConstants.SCRIPT_KOTLIN -> { + val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() scriptComponent = bluePrintScriptsService.scriptInstance(bluePrintContext, scriptClassReference, false) } BluePrintConstants.SCRIPT_JYTHON -> { diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt index 224319c24..309db9df4 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt @@ -42,7 +42,7 @@ 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.DefaultBluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl +import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.junit4.SpringRunner -- cgit 1.2.3-korg