summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/services')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt25
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt107
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt27
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt7
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt1
20 files changed, 147 insertions, 128 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 4cd809778..94920235b 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -105,9 +105,10 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
/** Resolve and validate lock properties */
implementation.lock?.apply {
val resolvedValues = bluePrintRuntimeService.resolvePropertyAssignments(
- BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
- interfaceName,
- mutableMapOf("key" to this.key, "acquireTimeout" to this.acquireTimeout))
+ BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TEMPLATE,
+ interfaceName,
+ mutableMapOf("key" to this.key, "acquireTimeout" to this.acquireTimeout)
+ )
this.key = resolvedValues["key"] ?: "".asJsonType()
this.acquireTimeout = resolvedValues["acquireTimeout"] ?: "".asJsonType()
@@ -157,9 +158,9 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
prepareRequestNB(executionServiceInput)
implementation.lock?.let {
bluePrintClusterService.clusterLock("${it.key.textValue()}@$CDS_LOCK_GROUP")
- .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
- applyNBWithTimeout(executionServiceInput)
- }
+ .executeWithLock(it.acquireTimeout.intValue().times(1000).toLong()) {
+ applyNBWithTimeout(executionServiceInput)
+ }
} ?: applyNBWithTimeout(executionServiceInput)
} catch (runtimeException: RuntimeException) {
log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
@@ -169,11 +170,13 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
private suspend fun applyNBWithTimeout(executionServiceInput: ExecutionServiceInput) =
- withTimeout((implementation.timeout * 1000).toLong()) {
- log.debug("DEBUG::: AbstractComponentFunction.withTimeout " +
- "section ${implementation.timeout} seconds")
- processNB(executionServiceInput)
- }
+ withTimeout((implementation.timeout * 1000).toLong()) {
+ log.debug(
+ "DEBUG::: AbstractComponentFunction.withTimeout " +
+ "section ${implementation.timeout} seconds"
+ )
+ processNB(executionServiceInput)
+ }
fun getOperationInput(key: String): JsonNode {
return operationInputs[key]
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
index 041588616..8b46ae693 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
@@ -25,9 +25,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
abstract class AbstractScriptComponentFunction : AbstractComponentFunction() {
+
private val log = LoggerFactory.getLogger(AbstractScriptComponentFunction::class.java)!!
companion object {
+
const val DYNAMIC_PROPERTIES = "dynamic-properties"
}
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 34b18091f..d107f01e5 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
@@ -44,7 +44,7 @@ class ComponentFunctionScriptingService(
log.info(
"creating component function of script type($scriptType), reference name($scriptClassReference) and " +
- "instanceDependencies($instanceDependencies)"
+ "instanceDependencies($instanceDependencies)"
)
val scriptComponent: T = scriptInstance(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
index dbc734019..43ad183c0 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
@@ -43,6 +43,7 @@ open class ComponentRemoteScriptExecutor(
) : AbstractComponentFunction() {
companion object {
+
const val INPUT_SELECTOR = "selector"
const val INPUT_BLUEPRINT_NAME = "blueprint-name"
const val INPUT_BLUEPRINT_VERSION = "blueprint-version"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 382c26cc6..34eaf6226 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -32,6 +32,7 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
AbstractComponentFunction() {
companion object {
+
const val INPUT_SCRIPT_TYPE = "script-type"
const val INPUT_SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
index fd7cde4d0..0b12e14b1 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
object ExecutionServiceDomains {
+
// ExecutionService Domains Constants
const val BLUEPRINT_PROCESSOR = "org.onap.ccsdk.cds.blueprintsprocessor"
const val NETCONF_EXECUTOR = "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor"
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
index 3ff54076d..b006b8f47 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
@@ -24,5 +24,6 @@ import org.springframework.context.annotation.Configuration
open class ExecutionServiceConfiguration
object ExecutionServiceConstant {
+
const val SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION = "grpc-remote-script-execution-service"
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index 35f156707..a0cd7fce6 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -45,6 +45,7 @@ import org.springframework.stereotype.Service
import java.util.concurrent.TimeUnit
interface RemoteScriptExecutionService {
+
suspend fun init(selector: Any)
suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput
suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
index 239ff00c5..fc37b488f 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
@@ -66,7 +66,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
private val grpcChannels: MutableMap<String, ManagedChannel> = hashMapOf()
private val commChannels: MutableMap<String,
- ClientBidiCallChannel<ExecutionServiceInput, ExecutionServiceOutput>> = hashMapOf()
+ ClientBidiCallChannel<ExecutionServiceInput, ExecutionServiceOutput>> = hashMapOf()
/**
* Open new channel to send and receive for grpc properties [selector] for [txId],
@@ -120,28 +120,28 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
*/
@ExperimentalCoroutinesApi
override suspend fun sendNonInteractive(selector: Any, txId: String, input: ExecutionServiceInput, timeOutMill: Long):
- ExecutionServiceOutput {
-
- var output: ExecutionServiceOutput? = null
- val flow = openSubscription(selector, txId)
-
- /** Send the request */
- val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
- sendChannel.send(input)
-
- /** Receive the response with timeout */
- withTimeout(timeOutMill) {
- flow.collect {
- log.trace("Received non-interactive transactionId($txId) response : ${it.status.eventType}")
- if (it.status.eventType == EventType.EVENT_COMPONENT_EXECUTED) {
- output = it
- cancelSubscription(txId)
+ ExecutionServiceOutput {
+
+ var output: ExecutionServiceOutput? = null
+ val flow = openSubscription(selector, txId)
+
+ /** Send the request */
+ val sendChannel = commChannels[txId]?.requestChannel
+ ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ sendChannel.send(input)
+
+ /** Receive the response with timeout */
+ withTimeout(timeOutMill) {
+ flow.collect {
+ log.trace("Received non-interactive transactionId($txId) response : ${it.status.eventType}")
+ if (it.status.eventType == EventType.EVENT_COMPONENT_EXECUTED) {
+ output = it
+ cancelSubscription(txId)
+ }
}
}
+ return output!!
}
- return output!!
- }
/** Cancel the Subscription for the [txId], This closes communication channel **/
@ExperimentalCoroutinesApi
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
index 3b8c296e6..2f1ae2fc5 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
@@ -35,6 +35,6 @@ open class DeprecatedBlueprintJythonService : BlueprintJythonService {
override fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String):
BlueprintFunctionNode<*, *> {
- throw BluePrintProcessorException("Include python-executor module for Jython support")
- }
+ throw BluePrintProcessorException("Include python-executor module for Jython support")
+ }
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
index 0125cd8d9..b3a0a5892 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
@@ -110,8 +110,8 @@ class ComponentRemoteScriptExecutorTest {
val mockExecutionServiceInput = mockExecutionServiceInput(bluePrintRuntime)
val mockStreamingRemoteExecutionService = mockk<StreamingRemoteExecutionService<
- org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
- ExecutionServiceOutput>>()
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
+ ExecutionServiceOutput>>()
coEvery {
mockStreamingRemoteExecutionService.sendNonInteractive(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
index a0eaeca5f..8edea46f6 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
@@ -39,7 +39,7 @@ class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintPr
override fun onNext(executionServiceInput: ExecutionServiceInput) {
log.info(
"Received requestId(${executionServiceInput.commonHeader.requestId}) " +
- "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
+ "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
)
runBlocking {
launch(MDCContext()) {
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 0f9dfd157..377b95010 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
@@ -54,7 +54,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
-import java.lang.RuntimeException
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -64,8 +63,10 @@ import kotlin.test.assertNotNull
*/
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [ComponentFunctionScriptingService::class,
- BluePrintScriptsServiceImpl::class, DeprecatedBlueprintJythonService::class]
+ classes = [
+ ComponentFunctionScriptingService::class,
+ BluePrintScriptsServiceImpl::class, DeprecatedBlueprintJythonService::class
+ ]
)
class AbstractComponentFunctionTest {
@@ -166,8 +167,8 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
} returns mutableMapOf(
- "key" to "abc-123-def-456".asJsonType(),
- "acquireTimeout" to implementation.lock!!.acquireTimeout
+ "key" to "abc-123-def-456".asJsonType(),
+ "acquireTimeout" to implementation.lock!!.acquireTimeout
)
val component: AbstractComponentFunction = SampleComponent()
@@ -193,8 +194,10 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
- } returns mutableMapOf("key" to "".asJsonType(),
- "acquireTimeout" to Integer(360).asJsonType())
+ } returns mutableMapOf(
+ "key" to "".asJsonType(),
+ "acquireTimeout" to Integer(360).asJsonType()
+ )
val component: AbstractComponentFunction = SampleComponent()
component.bluePrintRuntimeService = bluePrintRuntimeService
@@ -239,8 +242,10 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntimeService.resolvePropertyAssignments(any(), any(), any())
- } returns mutableMapOf("key" to lockName.asJsonType(),
- "acquireTimeout" to Integer(180).asJsonType())
+ } returns mutableMapOf(
+ "key" to lockName.asJsonType(),
+ "acquireTimeout" to Integer(180).asJsonType()
+ )
val clusterLock: ClusterLock = mockk()
@@ -272,49 +277,49 @@ class AbstractComponentFunctionTest {
private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
- val mapper = ObjectMapper()
- val rootNode = mapper.createObjectNode()
- rootNode.put("ip-address", "0.0.0.0")
- rootNode.put("type", "rest")
-
- val operationInputs = hashMapOf<String, JsonNode>()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
- "activate-restconf".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
- "interfaceName".asJsonPrimitive()
- operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
- "operationName".asJsonPrimitive()
- operationInputs["dynamic-properties"] = rootNode
-
- val stepInputData = StepData().apply {
- name = "activate-restconf"
- properties = operationInputs
- }
- val executionServiceInput = ExecutionServiceInput().apply {
- commonHeader = CommonHeader().apply {
- requestId = "1234"
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationInputs = hashMapOf<String, JsonNode>()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
+ "activate-restconf".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
+ "interfaceName".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
+ "operationName".asJsonPrimitive()
+ operationInputs["dynamic-properties"] = rootNode
+
+ val stepInputData = StepData().apply {
+ name = "activate-restconf"
+ properties = operationInputs
}
- actionIdentifiers = ActionIdentifiers().apply {
- actionName = "activate"
+ val executionServiceInput = ExecutionServiceInput().apply {
+ commonHeader = CommonHeader().apply {
+ requestId = "1234"
+ }
+ actionIdentifiers = ActionIdentifiers().apply {
+ actionName = "activate"
+ }
+ payload = JacksonUtils.jsonNode("{}") as ObjectNode
}
- payload = JacksonUtils.jsonNode("{}") as ObjectNode
+ executionServiceInput.stepData = stepInputData
+
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
+ "activate-restconf", "interfaceName", "operationName"
+ )
+ } returns operationInputs
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
+ "activate-restconf", "interfaceName", "operationName"
+ )
+ } returns operationOutputs
+ every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+
+ return executionServiceInput
}
- executionServiceInput.stepData = stepInputData
-
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
- "activate-restconf", "interfaceName", "operationName"
- )
- } returns operationInputs
-
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
- "activate-restconf", "interfaceName", "operationName"
- )
- } returns operationOutputs
- every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
-
- return executionServiceInput
- }
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
index 31b1a59c8..66bcf52c8 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
@@ -49,7 +49,7 @@ open class SampleRestconfComponent(private var componentFunctionScriptingService
this,
"internal",
"org.onap.ccsdk.cds.blueprintsprocessor.services" +
- ".execution.scripts.SampleTest",
+ ".execution.scripts.SampleTest",
mutableListOf()
)
scriptComponent.executeScript(executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
index 240348081..c35e86cc6 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
@@ -83,7 +83,7 @@ open class BluePrintWorkflowExecutionServiceImpl(
else -> {
throw BluePrintProcessorException(
"couldn't execute workflow($workflowName) step mapped " +
- "to node template($nodeTemplateName) derived from($derivedFrom)"
+ "to node template($nodeTemplateName) derived from($derivedFrom)"
)
}
}
@@ -103,8 +103,8 @@ open class BluePrintWorkflowExecutionServiceImpl(
// Set the Response Payload
executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode()
executionServiceOutput.payload.set<JsonNode>(
- "$workflowName-response",
- workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode()
+ "$workflowName-response",
+ workflowOutputs?.asObjectNode() ?: JacksonUtils.objectMapper.createObjectNode()
)
return executionServiceOutput
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
index 2aa408527..0146358a8 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
@@ -55,7 +55,7 @@ class ImperativeWorkflowExecutionService(
val graph = bluePrintContext.workflowByName(workflowName).asGraph()
return ImperativeBluePrintWorkflowService(nodeTemplateExecutionService)
- .executeWorkflow(graph, bluePrintRuntimeService, executionServiceInput)
+ .executeWorkflow(graph, bluePrintRuntimeService, executionServiceInput)
}
}
@@ -115,22 +115,22 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
}
override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
- NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
- val nodeOutput = ExecutionServiceOutput().apply {
- commonHeader = executionServiceInput.commonHeader
- actionIdentifiers = executionServiceInput.actionIdentifiers
+ NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ val nodeOutput = ExecutionServiceOutput().apply {
+ commonHeader = executionServiceInput.commonHeader
+ actionIdentifiers = executionServiceInput.actionIdentifiers
+ }
+ return NodeExecuteMessage(node, executionServiceInput, nodeOutput)
}
- return NodeExecuteMessage(node, executionServiceInput, nodeOutput)
- }
override suspend fun prepareNodeSkipMessage(node: Graph.Node):
- NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
- val nodeOutput = ExecutionServiceOutput().apply {
- commonHeader = executionServiceInput.commonHeader
- actionIdentifiers = executionServiceInput.actionIdentifiers
+ NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ val nodeOutput = ExecutionServiceOutput().apply {
+ commonHeader = executionServiceInput.commonHeader
+ actionIdentifiers = executionServiceInput.actionIdentifiers
+ }
+ return NodeSkipMessage(node, executionServiceInput, nodeOutput)
}
- return NodeSkipMessage(node, executionServiceInput, nodeOutput)
- }
override suspend fun executeNode(
node: Graph.Node,
@@ -141,6 +141,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
val step = bluePrintRuntimeService.bluePrintContext().workflowStepByName(this.workflowName, node.id)
checkNotEmpty(step.target) { "couldn't get step target for workflow(${this.workflowName})'s step(${node.id})" }
val nodeTemplateName = step.target!!
+
/** execute node template */
val executionServiceOutput = nodeTemplateExecutionService
.executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
index c1bcc649f..0634d11be 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
@@ -25,6 +25,7 @@ open class WorkflowServiceConfiguration
class WorkflowServiceConstants {
companion object {
+
const val ARTIFACT_TYPE_DIRECTED_GRAPH = "artifact-directed-graph"
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index 8c4e2d215..2ff06061a 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -38,32 +38,32 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
@Throws(SvcLogicException::class)
override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext):
- SvcLogicNode = runBlocking {
+ SvcLogicNode = runBlocking {
- var outValue: String
+ var outValue: String
- val ctx = svcLogicContext as BlueprintSvcLogicContext
+ val ctx = svcLogicContext as BlueprintSvcLogicContext
- val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
+ val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
- val executionInput = ctx.getRequest() as ExecutionServiceInput
+ val executionInput = ctx.getRequest() as ExecutionServiceInput
- try { // Get the Request from the Context and Set to the Function Input and Invoke the function
- val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
- ctx.getBluePrintService(),
- nodeTemplateName, executionInput
- )
+ try { // Get the Request from the Context and Set to the Function Input and Invoke the function
+ val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
+ ctx.getBluePrintService(),
+ nodeTemplateName, executionInput
+ )
- ctx.setResponse(executionOutput)
+ ctx.setResponse(executionOutput)
- outValue = executionOutput.status.message
- ctx.status = executionOutput.status.message
- } catch (e: Exception) {
- log.error("Could not execute plugin($nodeTemplateName) : ", e)
- outValue = "failure"
- ctx.status = "failure"
- }
+ outValue = executionOutput.status.message
+ ctx.status = executionOutput.status.message
+ } catch (e: Exception) {
+ log.error("Could not execute plugin($nodeTemplateName) : ", e)
+ outValue = "failure"
+ ctx.status = "failure"
+ }
- getNextNode(node, outValue)
- }
+ getNextNode(node, outValue)
+ }
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
index 47fbe1021..b661e73a5 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
@@ -49,7 +49,6 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
-import java.lang.RuntimeException
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
@@ -148,7 +147,8 @@ class BluePrintWorkflowExecutionServiceImplTest {
fun `Should handle errors from resolve workflow output`() {
val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk()
val bluePrintWorkflowExecutionServiceImpl = BluePrintWorkflowExecutionServiceImpl(
- mockk(), mockk(), imperativeWorkflowExecutionService)
+ mockk(), mockk(), imperativeWorkflowExecutionService
+ )
val bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>> = mockk()
val bluePrintContext: BluePrintContext = mockk()
val executionServiceInput = ExecutionServiceInput().apply {
@@ -176,7 +176,8 @@ class BluePrintWorkflowExecutionServiceImplTest {
runBlocking {
val output = bluePrintWorkflowExecutionServiceImpl.executeBluePrintWorkflow(
- bluePrintRuntimeService, executionServiceInput, mutableMapOf())
+ bluePrintRuntimeService, executionServiceInput, mutableMapOf()
+ )
assertEquals("failed to resolve property...", blueprintError.errors[0])
assertEquals("""{"config-assign-response":{}}""".asJsonType(), output.payload)
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
index c200f4ae2..2367422a7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
@@ -43,6 +43,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertNotNull
class ImperativeWorkflowExecutionServiceTest {
+
val log = logger(ImperativeWorkflowExecutionServiceTest::class)
@Before