Fixes: manual integration test of CDS
[ccsdk/apps.git] / ms / blueprintsprocessor / modules / services / workflow-service / src / test / kotlin / org / onap / ccsdk / apps / blueprintsprocessor / services / workflow / mock / MockComponentFunction.kt
index 747be76..4c12456 100644 (file)
 package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock
 
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
 import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
 import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
 import org.springframework.context.annotation.Bean
 import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Component
 
 @Configuration
 open class MockComponentConfiguration {
 
-    @Bean(name = ["component-resource-assignment", "component-netconf-executor"])
+    @Bean(name = ["component-resource-resolution", "component-netconf-executor", "component-jython-executor"])
     open fun createComponentFunction(): AbstractComponentFunction {
         return MockComponentFunction()
     }
@@ -35,12 +37,43 @@ open class MockComponentConfiguration {
 
 class MockComponentFunction : AbstractComponentFunction() {
 
-    private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+    private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
 
     override fun process(executionRequest: ExecutionServiceInput) {
-        log.info("Processing component..")
+        log.info("Processing component : $operationInputs")
 
-        this.executionServiceOutput = ExecutionServiceOutput()
+        bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
+                "assignment-params", "params".asJsonPrimitive())
+    }
+
+    override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        log.info("Recovering component..")
+    }
+}
+
+@Component("singleton-function")
+@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
+class SingletonComponentFunction : AbstractComponentFunction() {
+
+    private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
+
+    override fun process(executionRequest: ExecutionServiceInput) {
+        log.info("Processing component : $operationInputs")
+    }
+
+    override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+        log.info("Recovering component..")
+    }
+}
+
+@Component("prototype-function")
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+class PrototypeComponentFunction : AbstractComponentFunction() {
+
+    private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
+
+    override fun process(executionRequest: ExecutionServiceInput) {
+        log.info("Processing component : $operationInputs")
     }
 
     override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {