diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules')
2 files changed, 33 insertions, 43 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt index 1b905fa60..de6a8bd76 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt @@ -78,44 +78,34 @@ class ComponentScriptExecutorNodeTemplateImplBuilder(id: String, description: St class ComponentScriptExecutorInputAssignmentBuilder : PropertiesAssignmentBuilder() { - fun type(type: String) { - type(type.asJsonPrimitive()) - } + fun type(type: String) = type(type.asJsonPrimitive()) fun type(type: JsonNode) { property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, type) } - fun scriptClassReference(scriptClassReference: String) { - scriptClassReference(scriptClassReference.asJsonPrimitive()) - } + fun scriptClassReference(scriptClassReference: String) = scriptClassReference(scriptClassReference.asJsonPrimitive()) fun scriptClassReference(scriptClassReference: JsonNode) { property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, scriptClassReference) } - fun dynamicProperty(dynamicProperty: String) { - dynamicProperty(dynamicProperty.asJsonType()) - } + fun dynamicProperties(dynamicProperties: String) = dynamicProperties(dynamicProperties.asJsonType()) - fun dynamicProperty(dynamicProperty: JsonNode) { - property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, dynamicProperty) + fun dynamicProperties(dynamicProperties: JsonNode) { + property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, dynamicProperties) } } class ComponentScriptExecutorOutputAssignmentBuilder : PropertiesAssignmentBuilder() { - fun status(status: String) { - status(status.asJsonPrimitive()) - } + fun status(status: String) = status(status.asJsonPrimitive()) fun status(status: JsonNode) { property(ComponentScriptExecutor.OUTPUT_STATUS, status) } - fun responseData(responseData: String) { - responseData(responseData.asJsonType()) - } + fun responseData(responseData: String) = responseData(responseData.asJsonType()) fun responseData(responseData: JsonNode) { property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData) 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 d4195ae45..b0e3e4701 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 @@ -41,7 +41,7 @@ interface RemoteScriptExecutionService { @Service(ExecutionServiceConstant.SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION) @ConditionalOnProperty(prefix = "blueprintprocessor.remoteScriptCommand", name = arrayOf("enabled"), - havingValue = "true", matchIfMissing = false) + havingValue = "true", matchIfMissing = false) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService) : RemoteScriptExecutionService { @@ -74,11 +74,11 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi val grpResponse = commandExecutorServiceGrpc.prepareEnv(prepareEnvInput.asGrpcData()) checkNotNull(grpResponse.status) { - "failed to get GRPC prepare env response status for requestId($prepareEnvInput.requestId)" + "failed to get GRPC prepare env response status for requestId(${prepareEnvInput.requestId})" } val remoteScriptExecutionOutput = grpResponse.asJavaData() - log.debug("Received prepare env response from command server for requestId($prepareEnvInput.requestId)") + log.debug("Received prepare env response from command server for requestId(${prepareEnvInput.requestId})") return remoteScriptExecutionOutput } @@ -89,11 +89,11 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi val grpResponse = commandExecutorServiceGrpc.executeCommand(remoteExecutionInput.asGrpcData()) checkNotNull(grpResponse.status) { - "failed to get GRPC response status for requestId($remoteExecutionInput.requestId)" + "failed to get GRPC response status for requestId(${remoteExecutionInput.requestId})" } val remoteScriptExecutionOutput = grpResponse.asJavaData() - log.debug("Received response from command server for requestId($remoteExecutionInput.requestId)") + log.debug("Received response from command server for requestId(${remoteExecutionInput.requestId})") return remoteScriptExecutionOutput } @@ -115,33 +115,33 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi } return PrepareEnvInput.newBuilder() - .setIdentifiers(this.remoteIdentifier!!.asGrpcData()) - .setRequestId(this.requestId) - .setCorrelationId(correlationId) - .setTimeOut(this.timeOut.toInt()) - .addAllPackages(packageList) - .setProperties(this.properties.asGrpcData()) - .build() + .setIdentifiers(this.remoteIdentifier!!.asGrpcData()) + .setRequestId(this.requestId) + .setCorrelationId(correlationId) + .setTimeOut(this.timeOut.toInt()) + .addAllPackages(packageList) + .setProperties(this.properties.asGrpcData()) + .build() } fun RemoteScriptExecutionInput.asGrpcData(): ExecutionInput { val correlationId = this.correlationId ?: this.requestId return ExecutionInput.newBuilder() - .setRequestId(this.requestId) - .setCorrelationId(correlationId) - .setIdentifiers(this.remoteIdentifier!!.asGrpcData()) - .setCommand(this.command) - .setTimeOut(this.timeOut.toInt()) - .setProperties(this.properties.asGrpcData()) - .setTimestamp(Timestamp.getDefaultInstance()) - .build() + .setRequestId(this.requestId) + .setCorrelationId(correlationId) + .setIdentifiers(this.remoteIdentifier!!.asGrpcData()) + .setCommand(this.command) + .setTimeOut(this.timeOut.toInt()) + .setProperties(this.properties.asGrpcData()) + .setTimestamp(Timestamp.getDefaultInstance()) + .build() } fun RemoteIdentifier.asGrpcData(): Identifiers? { return Identifiers.newBuilder() - .setBlueprintName(this.blueprintName) - .setBlueprintVersion(this.blueprintVersion) - .build() + .setBlueprintName(this.blueprintName) + .setBlueprintVersion(this.blueprintVersion) + .build() } fun Map<String, JsonNode>.asGrpcData(): Struct { @@ -152,9 +152,9 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi fun ExecutionOutput.asJavaData(): RemoteScriptExecutionOutput { return RemoteScriptExecutionOutput( - requestId = this.requestId, - response = this.responseList, - status = StatusType.valueOf(this.status.name) + requestId = this.requestId, + response = this.responseList, + status = StatusType.valueOf(this.status.name) ) } |