summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-04-12 22:25:17 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-04-16 10:38:51 -0400
commit6fcfbc12e20e5a853c9204469dac6867b7eb6ccb (patch)
tree22b09b1636831c9c30c672101e46b8e8a81978ae /ms/blueprintsprocessor/modules
parent5a47fe8d6a7c665db048e1959f484af297a74315 (diff)
Integration Test - Component Executor
Change-Id: Icbe745b30c7bbb973bc9bb29bf547340b32f1b0f Issue-ID: CCSDK-1164 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt27
1 files changed, 10 insertions, 17 deletions
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 46969b1c5..7db5f52a4 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
@@ -48,8 +48,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
private val log = LoggerFactory.getLogger(GrpcRemoteScriptExecutionService::class.java)!!
- lateinit var channel: ManagedChannel
- lateinit var commandExecutorServiceGrpc: CommandExecutorServiceGrpc.CommandExecutorServiceFutureStub
+ private var channel: ManagedChannel? = null
+ private lateinit var commandExecutorServiceGrpc: CommandExecutorServiceGrpc.CommandExecutorServiceFutureStub
override suspend fun init(selector: String) {
// Get the GRPC Client Service based on selector
@@ -94,10 +94,7 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
}
override suspend fun close() {
- // TODO('Verify the correct way to close the client conncetion")
- if (channel != null) {
- channel.shutdownNow()
- }
+ channel?.shutdownNow()
}
@@ -105,7 +102,7 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
val correlationId = this.correlationId ?: this.requestId
return PrepareEnvInput.newBuilder()
- .setIdentifiers(this.remoteIdentifier.asGrpcData())
+ .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
.setRequestId(this.requestId)
.setCorrelationId(correlationId)
.setScriptType(ScriptType.valueOf(this.remoteScriptType.name))
@@ -120,7 +117,7 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
return ExecutionInput.newBuilder()
.setRequestId(this.requestId)
.setCorrelationId(correlationId)
- .setIdentifiers(this.remoteIdentifier.asGrpcData())
+ .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
.setScriptType(ScriptType.valueOf(this.remoteScriptType.name))
.setCommand(this.command)
.setTimeOut(this.timeOut.toInt())
@@ -129,15 +126,11 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
.build()
}
- fun RemoteIdentifier?.asGrpcData(): Identifiers? {
- return if (this != null) {
- Identifiers.newBuilder()
- .setBlueprintName(this.blueprintName)
- .setBlueprintVersion(this.blueprintVersion)
- .build()
- } else {
- null
- }
+ fun RemoteIdentifier.asGrpcData(): Identifiers? {
+ return Identifiers.newBuilder()
+ .setBlueprintName(this.blueprintName)
+ .setBlueprintVersion(this.blueprintVersion)
+ .build()
}
fun Map<String, JsonNode>.asGrpcData(): Struct {