summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-12-17 20:53:48 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-17 20:53:48 +0000
commit4db65041b3b076a518be6b62c2dc22c455faa2ab (patch)
tree0c4f8de6afd80f90378756a98defbc7de19016c4 /ms
parent96439fd45f758c8d1795e2836e3486ade3d6507a (diff)
parent430152b368c2bf7458f9bbfb46841b9c2f31110f (diff)
Merge "Change to base sli provider interfaces."
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java49
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt8
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt27
-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
-rw-r--r--ms/blueprintsprocessor/parent/pom.xml10
14 files changed, 118 insertions, 110 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
index 166af0f7..5eb40225 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
@@ -43,7 +43,7 @@ open class ComponentJythonExecutor(private val pythonExecutorProperty: PythonExe
lateinit var applicationContext: ApplicationContext
fun populateJythonComponentInstance(executionServiceInput: ExecutionServiceInput) {
- val bluePrintContext = bluePrintRuntimeService!!.bluePrintContext()
+ val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val operationAssignment: OperationAssignment = bluePrintContext
.nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
@@ -53,14 +53,14 @@ open class ComponentJythonExecutor(private val pythonExecutorProperty: PythonExe
val artifactName: String = operationAssignment.implementation?.primary
?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
- val artifactDefinition = bluePrintRuntimeService!!.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val pythonFileName = artifactDefinition.file
?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
- val content: String? = bluePrintRuntimeService!!.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
+ val content: String? = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
checkNotEmptyNThrow(content, "artifact ($artifactName) content is empty")
@@ -85,7 +85,7 @@ open class ComponentJythonExecutor(private val pythonExecutorProperty: PythonExe
override fun process(executionServiceInput: ExecutionServiceInput) {
- log.info("Processing : ${operationInputs}")
+ log.info("Processing : $operationInputs")
checkNotNull(bluePrintRuntimeService) { "failed to get bluePrintRuntimeService" }
// Populate Component Instance
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index e5feb257..0becc00c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -39,12 +39,12 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val artifactPrefixNamesNode = getOperationInput(ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES)
val artifactPrefixNames = JacksonUtils.getListFromJsonNode(artifactPrefixNamesNode, String::class.java)
- ?: throw BluePrintProcessorException("coundn't transform ${artifactPrefixNamesNode.asText()} to string array")
+ ?: throw BluePrintProcessorException("couldn't transform ${artifactPrefixNamesNode.asText()} to string array")
- val resolvedParamContents = resourceResolutionService.resolveResources(bluePrintRuntimeService!!, nodeTemplateName, artifactPrefixNames)
+ val resolvedParamContents = resourceResolutionService.resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefixNames)
// Set Output Attributes
- bluePrintRuntimeService!!.setNodeTemplateAttributeValue(nodeTemplateName,
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, resolvedParamContents.asJsonNode())
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt
index 2b19c8b8..d13df9bc 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt
@@ -34,7 +34,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
open fun resourceDefinition(name: String): ResourceDefinition {
- return resourceDictionaries.get(name)
+ return resourceDictionaries[name]
?: throw BluePrintProcessorException("couldn't get resource definition($name)")
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java
deleted file mode 100644
index 3b5dfabe..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api;
-
-import io.swagger.annotations.ApiOperation;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-import reactor.core.publisher.Mono;
-
-/**
- * ExecutionServiceController
- *
- * @author Brinda Santh 8/14/2018
- */
-@RestController
-@RequestMapping("/api/v1/execution-service")
-public class ExecutionServiceController {
-
-
- @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- Mono<String> ping() {
- return Mono.just("Success");
- }
-
- @RequestMapping(path = "/process", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Resolve Resource Mappings",
- notes = "Takes the blueprint information and process as per the payload")
- public @ResponseBody
- Mono<ExecutionServiceOutput> process(@RequestBody ExecutionServiceInput executionServiceInput) {
- return Mono.just(new ExecutionServiceOutput());
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
index 2a5983d0..0668d3c9 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
@@ -26,15 +26,15 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@Service
-class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration)
+class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
+ private val executionServiceHandler: ExecutionServiceHandler)
: BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
override fun process(request: ExecutionServiceInput,
responseObserver: StreamObserver<ExecutionServiceOutput>) {
- val json = JsonFormat.printer().print(request)
-
+ //val json = JsonFormat.printer().print(request)
//log.info("Received GRPC request ${json}")
//TODO( Handle Processing Response")
val response = ExecutionServiceOutput.newBuilder().setCommonHeader(request.commonHeader).build()
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
new file mode 100644
index 00000000..0a67e878
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
+
+import io.swagger.annotations.ApiOperation
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.http.MediaType
+import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
+
+@RestController
+@RequestMapping("/api/v1/execution-service")
+class ExecutionServiceController {
+
+ @Autowired
+ lateinit var executionServiceHandler: ExecutionServiceHandler
+
+
+ @RequestMapping(path = arrayOf("/ping"), method = arrayOf(RequestMethod.GET), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ResponseBody
+ fun ping(): Mono<String> {
+ return Mono.just("Success")
+ }
+
+ @RequestMapping(path = arrayOf("/process"), method = arrayOf(RequestMethod.POST), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ApiOperation(value = "Resolve Resource Mappings", notes = "Takes the blueprint information and process as per the payload")
+ @ResponseBody
+ fun process(@RequestBody executionServiceInput: ExecutionServiceInput): Mono<ExecutionServiceOutput> {
+ val executionServiceOutput = executionServiceHandler.process(executionServiceInput)
+ return Mono.just(executionServiceOutput)
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index 6d5d633c..cd871b4a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -23,9 +23,11 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockBluePrintCatalogService
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockBlueprintDGExecutionService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@@ -36,7 +38,9 @@ import kotlin.test.BeforeTest
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintProcessingGRPCHandler::class, BluePrintCoreConfiguration::class])
+@ContextConfiguration(classes = [BluePrintProcessingGRPCHandler::class, ExecutionServiceHandler::class,
+ MockBlueprintDGExecutionService::class, MockBluePrintCatalogService::class,
+ BluePrintCoreConfiguration::class])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 87a925f9..363899ea 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -38,15 +38,15 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
@Transient
private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)
- var executionServiceInput: ExecutionServiceInput? = null
+ lateinit var executionServiceInput: ExecutionServiceInput
var executionServiceOutput = ExecutionServiceOutput()
- var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
- var processId: String = ""
- var workflowName: String = ""
- var stepName: String = ""
- var interfaceName: String = ""
- var operationName: String = ""
- var nodeTemplateName: String = ""
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var processId: String
+ lateinit var workflowName: String
+ lateinit var stepName: String
+ lateinit var interfaceName: String
+ lateinit var operationName: String
+ lateinit var nodeTemplateName: String
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun getName(): String {
@@ -68,7 +68,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
log.info("preparing request id($processId) for workflow($workflowName) step($stepName)")
- val operationInputs = bluePrintRuntimeService!!.get("$stepName-step-inputs")
+ val operationInputs = bluePrintRuntimeService.get("$stepName-step-inputs")
?: JsonNodeFactory.instance.objectNode()
operationInputs.fields().forEach {
@@ -84,8 +84,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" }
-
- val operationResolvedProperties = bluePrintRuntimeService!!.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ val operationResolvedProperties = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
this.operationInputs.putAll(operationResolvedProperties)
@@ -94,13 +93,13 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
override fun prepareResponse(): ExecutionServiceOutput {
log.info("Preparing Response...")
- executionServiceOutput.commonHeader = executionServiceInput!!.commonHeader
+ executionServiceOutput.commonHeader = executionServiceInput.commonHeader
// Resolve the Output Expression
- val stepOutputs = bluePrintRuntimeService!!
+ val stepOutputs = bluePrintRuntimeService
.resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- bluePrintRuntimeService!!.put("$stepName-step-outputs", stepOutputs.asJsonNode())
+ bluePrintRuntimeService.put("$stepName-step-outputs", stepOutputs.asJsonNode())
// Populate Status
val status = Status()
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 9bb562b7..8ba02ac8 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 ab7d7385..dfa22f68 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 e514a1fb..7a59a0ab 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 1d738eef..7b9a35e5 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 a816a06c..95947ad3 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>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index d8a47eff..22661294 100644
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -38,7 +38,7 @@
<grpc.version>1.16.1</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
- <sli.version>0.3.1</sli.version>
+ <sli.version>0.4.0-SNAPSHOT</sli.version>
<guava.version>26.0-jre</guava.version>
<jython.version>2.7.1</jython.version>
<springfox.swagger2.version>2.9.2</springfox.swagger2.version>
@@ -145,10 +145,10 @@
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>*</artifactId>
</exclusion>
- <!--<exclusion>-->
- <!--<groupId>org.opendaylight.controller</groupId>-->
- <!--<artifactId>*</artifactId>-->
- <!--</exclusion>-->
+ <exclusion>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>*</artifactId>