aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/workflow-service
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-17 11:15:28 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-17 11:15:28 -0500
commit66439ec5c1f7a3141c0a61b8ed2e22466fbe7075 (patch)
treec80992652e06f6e50f12beacba08f0df5b615e64 /ms/blueprintsprocessor/modules/services/workflow-service
parent6e7d5b5e81d6138e3ccd50434926218513da2f2a (diff)
Change to base sli provider interfaces.
Change-Id: Icf16aa602ba107e2b2095f756f0c3af6f38891f5 Issue-ID: CCSDK-672 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/workflow-service')
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt30
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt22
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt8
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml2
5 files changed, 35 insertions, 29 deletions
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
index 9bb562b76..8ba02ac8f 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
@@ -33,7 +33,7 @@ interface BlueprintDGExecutionService {
}
@Service
-class DefaultBlueprintDGExecutionService(val blueprintSvcLogicService: BlueprintSvcLogicService) : BlueprintDGExecutionService {
+class DefaultBlueprintDGExecutionService(private val blueprintSvcLogicService: BlueprintSvcLogicService) : BlueprintDGExecutionService {
private val log = LoggerFactory.getLogger(DefaultBlueprintDGExecutionService::class.java)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
index ab7d73856..dfa22f68e 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
@@ -18,8 +18,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.sli.core.sli.*
-import org.onap.ccsdk.sli.core.sli.provider.*
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker
+import org.onap.ccsdk.sli.core.sli.provider.base.*
import org.slf4j.LoggerFactory
import org.slf4j.MDC
import org.springframework.beans.factory.annotation.Autowired
@@ -28,11 +27,11 @@ import org.springframework.stereotype.Service
import java.util.*
import javax.annotation.PostConstruct
-interface BlueprintSvcLogicService : SvcLogicService {
+interface BlueprintSvcLogicService : SvcLogicServiceBase {
fun registerDefaultExecutors()
- fun registerExecutors(name: String, svcLogicNodeExecutor: SvcLogicNodeExecutor)
+ fun registerExecutors(name: String, svcLogicNodeExecutor: AbstractSvcLogicNodeExecutor)
fun unRegisterExecutors(name: String)
@@ -52,11 +51,6 @@ interface BlueprintSvcLogicService : SvcLogicService {
override fun execute(p0: String?, p1: String?, p2: String?, p3: String?, p4: Properties?): Properties {
TODO("not implemented")
}
-
- @Deprecated("Not used in Micro service Implementation")
- override fun execute(p0: String?, p1: String?, p2: String?, p3: String?, p4: Properties?, p5: DOMDataBroker?): Properties {
- TODO("not implemented")
- }
}
@@ -65,7 +59,7 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
private val log = LoggerFactory.getLogger(DefaultBlueprintSvcLogicService::class.java)
- private val nodeExecutors: MutableMap<String, SvcLogicNodeExecutor> = hashMapOf()
+ private val nodeExecutors: MutableMap<String, AbstractSvcLogicNodeExecutor> = hashMapOf()
@Autowired
private lateinit var context: ApplicationContext
@@ -81,9 +75,9 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
registerExecutors("exit", ExitNodeExecutor())
}
- override fun registerExecutors(name: String, svcLogicNodeExecutor: SvcLogicNodeExecutor) {
+ override fun registerExecutors(name: String, svcLogicNodeExecutor: AbstractSvcLogicNodeExecutor) {
log.info("Registering executors($name) with type(${svcLogicNodeExecutor.javaClass}")
- nodeExecutors.put(name, svcLogicNodeExecutor)
+ nodeExecutors[name] = svcLogicNodeExecutor
}
override fun unRegisterExecutors(name: String) {
@@ -108,17 +102,17 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
if (node == null) {
return null
} else {
- if (log.isDebugEnabled()) {
- log.debug("Executing node {}", node.getNodeId())
+ if (log.isDebugEnabled) {
+ log.debug("Executing node {}", node.nodeId)
}
- val executor = this.nodeExecutors[node.getNodeType()]
+ val executor = this.nodeExecutors[node.nodeType]
if (executor != null) {
- log.debug("Executing node executor for node type {} - {}", node.getNodeType(), executor.javaClass.name)
+ log.debug("Executing node executor for node type {} - {}", node.nodeType, executor.javaClass.name)
return executor.execute(this, node, ctx)
} else {
- throw SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type")
+ throw SvcLogicException("Attempted to execute a node of type " + node.nodeType + ", but no executor was registered for this type")
}
}
}
@@ -126,7 +120,7 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
override fun execute(graph: SvcLogicGraph, svcLogicContext: SvcLogicContext): SvcLogicContext {
MDC.put("currentGraph", graph.toString())
- var curNode: SvcLogicNode? = graph.getRootNode()
+ var curNode: SvcLogicNode? = graph.rootNode
log.info("About to execute graph {}", graph.toString())
try {
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index e514a1fbb..7a59a0ab2 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -17,6 +17,9 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor
import com.fasterxml.jackson.databind.JsonNode
+import kotlinx.coroutines.async
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintSvcLogicContext
@@ -26,9 +29,9 @@ import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.sli.core.sli.SvcLogicContext
import org.onap.ccsdk.sli.core.sli.SvcLogicException
import org.onap.ccsdk.sli.core.sli.SvcLogicNode
-import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
@@ -47,7 +50,16 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
}
@Throws(SvcLogicException::class)
- override fun execute(svc: SvcLogicService, node: SvcLogicNode, svcLogicContext: SvcLogicContext): SvcLogicNode {
+ override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext)
+ : SvcLogicNode = runBlocking {
+ coroutineScope {
+ val job = async { executeAsy(svc, node, svcLogicContext) }
+ job.await()
+ }
+ }
+
+
+ private fun executeAsy(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext): SvcLogicNode {
var outValue: String
@@ -80,7 +92,7 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName)
stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName)
- plugin.bluePrintRuntimeService!!.put("$nodeTemplateName-step-inputs", stepInputs.asJsonNode())
+ plugin.bluePrintRuntimeService.put("$nodeTemplateName-step-inputs", stepInputs.asJsonNode())
// Get the Request from the Context and Set to the Function Input and Invoke the function
val executionOutput = plugin.apply(executionInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
index 1d738eef9..7b9a35e5d 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -40,9 +40,9 @@ class MockComponentFunction : AbstractComponentFunction() {
private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : ${operationInputs}")
+ log.info("Processing component : $operationInputs")
- bluePrintRuntimeService!!.setNodeTemplateAttributeValue(nodeTemplateName,
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
"assignment-params", "params".asJsonPrimitive())
}
@@ -58,7 +58,7 @@ class SingletonComponentFunction : AbstractComponentFunction() {
private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : ${operationInputs}")
+ log.info("Processing component : $operationInputs")
}
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
@@ -73,7 +73,7 @@ class PrototypeComponentFunction : AbstractComponentFunction() {
private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component : ${operationInputs}")
+ log.info("Processing component : $operationInputs")
}
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
index a816a06c5..95947ad3e 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/logback.xml
@@ -19,7 +19,7 @@
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>