diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2019-11-22 18:06:08 -0500 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2019-11-26 21:32:38 +0000 |
commit | 341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch) | |
tree | 113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/blueprintsprocessor/modules/commons/processor-core | |
parent | d274e5fc552cf9ae25500f504f0434981cf3accf (diff) |
Formatting Code base with ktlint
No Business logic change, just the code format.
Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3
To format run: mvn process-sources -P format
Issue-ID: CCSDK-1947
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/processor-core')
9 files changed, 76 insertions, 54 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt index 47b55b018..af7109449 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt @@ -20,9 +20,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.controllerblueprints.core.asType import kotlin.reflect.KClass - fun <T : Any> ExecutionServiceInput.payloadAsType(clazzType: KClass<T>): T { val actionName = this.actionIdentifiers.actionName val requestJsonNode = this.payload.get("$actionName-request") return requestJsonNode.asType(clazzType.java) -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index 62dc933f1..76b37a5b4 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt @@ -41,12 +41,13 @@ open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: Bl @Bean open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration { return bluePrintPropertiesService - .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintLoadConfiguration::class.java) + .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintLoadConfiguration::class.java) } } @Configuration open class BluePrintPropertyConfiguration { + @Autowired lateinit var environment: Environment @@ -59,6 +60,7 @@ open class BluePrintPropertyConfiguration { @Service open class BluePrintPropertiesService(private var bluePrintPropertyBinder: Binder) { + fun <T> propertyBeanType(prefix: String, type: Class<T>): T { return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() } @@ -74,5 +76,4 @@ open class BlueprintDependencyConfiguration : ApplicationContextAware { BluePrintDependencyService.inject(applicationContext) log.info("Dependency Management module created...") } - -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index dae6eea85..d94985400 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode import io.swagger.annotations.ApiModelProperty import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import java.util.* +import java.util.Date /** * BlueprintProcessorData @@ -33,14 +33,17 @@ import java.util.* */ open class ExecutionServiceInput { + @get:ApiModelProperty(required = true, value = "Headers providing request context.") lateinit var commonHeader: CommonHeader @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.") lateinit var actionIdentifiers: ActionIdentifiers - @get:ApiModelProperty(required = true, - value = "Contain the information to be passed as input to the action." + - "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + - " and the input for resource resolution located within the xxx-request block, contained within xxx-properties") + @get:ApiModelProperty( + required = true, + value = "Contain the information to be passed as input to the action." + + "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + + " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" + ) lateinit var payload: ObjectNode @get:ApiModelProperty(hidden = true) @get:JsonIgnore @@ -54,10 +57,12 @@ open class ExecutionServiceOutput { lateinit var actionIdentifiers: ActionIdentifiers @get:ApiModelProperty(required = true, value = "Status of the request.") lateinit var status: Status - @get:ApiModelProperty(required = true, - value = "Contain the information to be passed as input to the action." + - "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + - " and the input for resource resolution located within the xxx-request block, contained within xxx-properties") + @get:ApiModelProperty( + required = true, + value = "Contain the information to be passed as input to the action." + + "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" + + " and the input for resource resolution located within the xxx-request block, contained within xxx-properties" + ) lateinit var payload: ObjectNode @get:ApiModelProperty(hidden = true) @get:JsonIgnore @@ -74,9 +79,11 @@ open class ActionIdentifiers { lateinit var blueprintVersion: String @get:ApiModelProperty(required = true, value = "Name of the workflow to execute.") lateinit var actionName: String - @get:ApiModelProperty(required = true, - value = "Async processing is only supported for gRPC client.", - allowableValues = "sync, async") + @get:ApiModelProperty( + required = true, + value = "Async processing is only supported for gRPC client.", + allowableValues = "sync, async" + ) lateinit var mode: String } @@ -106,9 +113,11 @@ open class Status { var code: Int = 200 @get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.") var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name - @get:ApiModelProperty(required = true, - value = "Time when the execution ended.", - example = "2012-04-23T18:25:43.511Z") + @get:ApiModelProperty( + required = true, + value = "Time when the execution ended.", + example = "2012-04-23T18:25:43.511Z" + ) @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") var timestamp: Date = Date() @get:ApiModelProperty(required = false, value = "Error message when system failed") @@ -120,4 +129,4 @@ open class Status { open class StepData { lateinit var name: String var properties: MutableMap<String, JsonNode> = mutableMapOf() -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt index d63f34ced..628b65ea4 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt @@ -17,34 +17,39 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data import com.fasterxml.jackson.databind.JsonNode -import java.util.* +import java.util.Date enum class StatusType { SUCCESS, FAILURE } -data class RemoteIdentifier(var blueprintName: String, - var blueprintVersion: String) - - -data class RemoteScriptExecutionInput(var requestId: String, - var correlationId: String? = null, - var remoteIdentifier: RemoteIdentifier? = null, - var command: String, - var timeOut: Long = 30, - var properties: MutableMap<String, JsonNode> = hashMapOf() +data class RemoteIdentifier( + var blueprintName: String, + var blueprintVersion: String ) +data class RemoteScriptExecutionInput( + var requestId: String, + var correlationId: String? = null, + var remoteIdentifier: RemoteIdentifier? = null, + var command: String, + var timeOut: Long = 30, + var properties: MutableMap<String, JsonNode> = hashMapOf() +) -data class RemoteScriptExecutionOutput(var requestId: String, - var response: List<String>, - var status: StatusType = StatusType.SUCCESS, - var timestamp: Date = Date(), - var payload: JsonNode) +data class RemoteScriptExecutionOutput( + var requestId: String, + var response: List<String>, + var status: StatusType = StatusType.SUCCESS, + var timestamp: Date = Date(), + var payload: JsonNode +) -data class PrepareRemoteEnvInput(var requestId: String, - var correlationId: String? = null, - var remoteIdentifier: RemoteIdentifier? = null, - var packages: JsonNode, - var timeOut: Long = 120, - var properties: MutableMap<String, JsonNode> = hashMapOf()) +data class PrepareRemoteEnvInput( + var requestId: String, + var correlationId: String? = null, + var remoteIdentifier: RemoteIdentifier? = null, + var packages: JsonNode, + var timeOut: Long = 120, + var properties: MutableMap<String, JsonNode> = hashMapOf() +) diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt index bb2c040f7..2f925dc5b 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt @@ -48,6 +48,7 @@ interface ComponentNode { * @author Brinda Santh */ open class ComponentNodeFactory : ApplicationContextAware { + private val log = LoggerFactory.getLogger(ComponentNodeFactory::class.java) var componentNodes: MutableMap<String, ComponentNode> = hashMapOf() @@ -65,4 +66,4 @@ open class ComponentNodeFactory : ApplicationContextAware { componentNodes = context.getBeansOfType(ComponentNode::class.java) log.info("Injected Component Nodes : {}", componentNodes) } -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt index 9cd00a3ba..59114de86 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt @@ -19,12 +19,16 @@ import com.fasterxml.jackson.databind.node.ObjectNode import com.google.common.base.Strings import com.google.protobuf.Struct import com.google.protobuf.util.JsonFormat -import org.onap.ccsdk.cds.controllerblueprints.common.api.* +import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers +import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader +import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType +import org.onap.ccsdk.cds.controllerblueprints.common.api.Flag +import org.onap.ccsdk.cds.controllerblueprints.common.api.Status import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput import java.text.SimpleDateFormat -import java.util.* +import java.util.Date private val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") @@ -123,4 +127,4 @@ fun org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput. JsonFormat.parser().merge(JacksonUtils.getJson(this.payload), struct) executionServiceOuput.payload = struct.build() return executionServiceOuput.build() -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt index 9eb95e679..d3669f634 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt @@ -20,7 +20,6 @@ import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService - class PayloadUtils { companion object { @@ -39,9 +38,9 @@ class PayloadUtils { fun prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode) { payload.fields().forEach { property -> val path = StringBuilder(BluePrintConstants.PATH_INPUTS) - .append(BluePrintConstants.PATH_DIVIDER).append(property.key).toString() + .append(BluePrintConstants.PATH_DIVIDER).append(property.key).toString() bluePrintRuntimeService.put(path, property.value) } } } -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt index 3dd629c13..c27285020 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt @@ -17,4 +17,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core // TODO -open class BluePrintPropertiesTest
\ No newline at end of file +open class BluePrintPropertiesTest diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingsTest.kt index b1d7d144c..4de40d7bf 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingsTest.kt @@ -70,7 +70,9 @@ class BluePrintMappingsTest { fun commonHeaderToJavaTest() { val flag = Flag.newBuilder().setIsForce(true).setTtl(2).build() - val commonHeader = CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString).setFlag(flag).build() + val commonHeader = + CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString) + .setFlag(flag).build() val commonHeader2 = commonHeader.toJava() Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId) @@ -101,7 +103,9 @@ class BluePrintMappingsTest { @Test fun actionIdentifierToJavaTest() { - val actionIdentifiers = ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0").setMode("Execution").build() + val actionIdentifiers = + ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0") + .setMode("Execution").build() val actionIdentifiers2 = actionIdentifiers.toJava() Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName) @@ -129,4 +133,4 @@ class BluePrintMappingsTest { Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion) Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode) } -}
\ No newline at end of file +} |