diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 12:16:46 -0400 |
---|---|---|
committer | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 13:49:05 -0400 |
commit | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch) | |
tree | 4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/modules/services/execution-service/src/main | |
parent | d97021cd756d63402545fdc2e14ac7611c3da118 (diff) |
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation
Issue-ID: CCSDK-2852
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src/main')
10 files changed, 44 insertions, 34 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") + } } |