diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-07-10 18:27:23 -0400 |
---|---|---|
committer | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-07-10 22:35:15 +0000 |
commit | f439f401aa06ea497a84c73f3c158dfc6c62bc61 (patch) | |
tree | e19ca6a404b528fc4506f3f20fd641f589a092d2 /ms/blueprintsprocessor/modules/services | |
parent | e827a3aee231453f704fef1a945d13de380a83c5 (diff) |
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 <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services')
3 files changed, 8 insertions, 10 deletions
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 @@ -38,10 +38,6 @@ <artifactId>blueprint-core</artifactId> </dependency> <dependency> - <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> - <artifactId>blueprint-scripts</artifactId> - </dependency> - <dependency> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>processor-core</artifactId> </dependency> 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 <T : AbstractScriptComponentFunction> scriptInstance(componentFunction: AbstractComponentFunction, - scriptType: String, - scriptClassReference: String, - instanceDependencies: List<String>): T { + scriptType: String, + scriptClassReference: String, + instanceDependencies: List<String>): 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 <T : BlueprintFunctionNode<*, *>> 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<T>(scriptClassReference) } BluePrintConstants.SCRIPT_KOTLIN -> { + val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl() scriptComponent = bluePrintScriptsService.scriptInstance<T>(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 |