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/ssh-lib/src/main | |
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/ssh-lib/src/main')
5 files changed, 24 insertions, 23 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt index 3c625a6d3..382c9b7d7 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt @@ -33,16 +33,13 @@ open class BluePrintSshLibConfiguration * Exposed Dependency Service by this SSH Lib Module */ fun BluePrintDependencyService.sshLibPropertyService(): BluePrintSshLibPropertyService = - instance(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY) - + instance(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY) fun BluePrintDependencyService.sshClientService(selector: String): BlueprintSshClientService = - sshLibPropertyService().blueprintSshClientService(selector) - + sshLibPropertyService().blueprintSshClientService(selector) fun BluePrintDependencyService.sshClientService(jsonNode: JsonNode): BlueprintSshClientService = - sshLibPropertyService().blueprintSshClientService(jsonNode) - + sshLibPropertyService().blueprintSshClientService(jsonNode) class SshLibConstants { companion object { @@ -50,4 +47,4 @@ class SshLibConstants { const val PROPERTY_SSH_CLIENT_PREFIX = "blueprintsprocessor.sshclient." const val TYPE_BASIC_AUTH = "basic-auth" } -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt index a70ea5588..c7d5105b4 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt @@ -26,4 +26,4 @@ open class SshClientProperties { open class BasicAuthSshClientProperties : SshClientProperties() { lateinit var password: String lateinit var username: String -}
\ No newline at end of file +} diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt index adbde0f87..61baaa1ef 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt @@ -26,11 +26,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BasicAuthSshClientProperties import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.slf4j.LoggerFactory import java.io.ByteArrayOutputStream -import java.util.* +import java.util.Collections +import java.util.EnumSet - -open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties) - : BlueprintSshClientService { +open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties) : + BlueprintSshClientService { private val log = LoggerFactory.getLogger(BasicAuthSshClientService::class.java)!! @@ -43,10 +43,12 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B sshClient.serverKeyVerifier = AcceptAllServerKeyVerifier.INSTANCE sshClient.start() log.debug("SSH Client Service started successfully") - clientSession = sshClient.connect(basicAuthSshClientProperties.username, basicAuthSshClientProperties.host, - basicAuthSshClientProperties.port) - .verify(basicAuthSshClientProperties.connectionTimeOut) - .session + clientSession = sshClient.connect( + basicAuthSshClientProperties.username, basicAuthSshClientProperties.host, + basicAuthSshClientProperties.port + ) + .verify(basicAuthSshClientProperties.connectionTimeOut) + .session clientSession.addPasswordIdentity(basicAuthSshClientProperties.password) clientSession.auth().verify(basicAuthSshClientProperties.connectionTimeOut) @@ -73,7 +75,7 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B channel = clientSession.createExecChannel(command) checkNotNull(channel) { "failed to create Channel for the command : $command" } - //TODO("Convert to streaming ") + // TODO("Convert to streaming ") val outputStream = ByteArrayOutputStream() channel!!.out = outputStream channel!!.err = outputStream diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt index 337208c78..90a1746e8 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt @@ -53,11 +53,13 @@ open class BluePrintSshLibPropertyService(private var bluePrintProperties: BlueP fun sshClientProperties(jsonNode: JsonNode): SshClientProperties { val type = jsonNode.get("type")?.textValue() - ?: throw BluePrintProcessorException("missing type field in ssh client properties") + ?: throw BluePrintProcessorException("missing type field in ssh client properties") return when (type) { SshLibConstants.TYPE_BASIC_AUTH -> { - JacksonUtils.readValue(jsonNode, - BasicAuthSshClientProperties::class.java)!! + JacksonUtils.readValue( + jsonNode, + BasicAuthSshClientProperties::class.java + )!! } else -> { throw BluePrintProcessorException("SSH adaptor($type) is not supported") @@ -79,7 +81,7 @@ open class BluePrintSshLibPropertyService(private var bluePrintProperties: BlueP private fun basicAuthSshClientProperties(prefix: String): BasicAuthSshClientProperties { return bluePrintProperties.propertyBeanType( - prefix, BasicAuthSshClientProperties::class.java) + prefix, BasicAuthSshClientProperties::class.java + ) } - } diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt index 279e437cc..724c4277d 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt @@ -44,4 +44,4 @@ interface BlueprintSshClientService { suspend fun executeCommandNB(command: String, timeOut: Long): String suspend fun closeSessionNB() -}
\ No newline at end of file +} |