aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-ssl/src/test/kotlin/org/onap
diff options
context:
space:
mode:
authorPiotr Wielebski <piotr.wielebski@nokia.com>2019-04-10 11:59:26 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-10 11:59:26 +0000
commit6a7e8dce0126f355a0ef5663304825bea4c79a20 (patch)
treea3fed8e56ab49bb32ef39cd8ef4f8b53c749b947 /sources/hv-collector-ssl/src/test/kotlin/org/onap
parent4d76345d06ee7591d839723a82026f6d8e756c65 (diff)
parentc138b700030d22ae0bdbd6992fb4a4d8a3431798 (diff)
Merge "Read passwords from files"
Diffstat (limited to 'sources/hv-collector-ssl/src/test/kotlin/org/onap')
-rw-r--r--sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt (renamed from sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SecurityUtilsTest.kt)13
1 files changed, 12 insertions, 1 deletions
diff --git a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SecurityUtilsTest.kt b/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt
index ddb3e357..c7c414f8 100644
--- a/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SecurityUtilsTest.kt
+++ b/sources/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/UtilsKtTest.kt
@@ -20,6 +20,7 @@
package org.onap.dcae.collectors.veshv.ssl.boundary
import com.nhaarman.mockitokotlin2.doReturn
+import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.whenever
@@ -31,15 +32,22 @@ import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on
import org.onap.dcae.collectors.veshv.commandline.CommandLineOption
import org.onap.dcae.collectors.veshv.commandline.hasOption
+import org.onap.dcae.collectors.veshv.commandline.stringValue
+import java.nio.file.Paths
-internal object SecurityUtilsTest : Spek({
+internal object UtilsKtTest : Spek({
describe("creating securty configuration provider") {
on("command line without ssl disable") {
+ val passwordFile = resourcePathAsString("/ssl/password")
val commandLine: CommandLine = mock()
whenever(commandLine.hasOption(CommandLineOption.SSL_DISABLE)).doReturn(false)
+ whenever(commandLine.stringValue(CommandLineOption.TRUST_STORE_PASSWORD_FILE, TRUST_STORE_PASSWORD_FILE))
+ .doReturn(passwordFile)
+ whenever(commandLine.stringValue(CommandLineOption.KEY_STORE_PASSWORD_FILE, KEY_STORE_PASSWORD_FILE))
+ .doReturn(passwordFile)
it("should create configuration with some keys") {
val configuration = createSecurityConfiguration(commandLine)
@@ -63,3 +71,6 @@ internal object SecurityUtilsTest : Spek({
}
}
})
+
+private fun resourcePathAsString(resource: String) =
+ Paths.get(UtilsKtTest::class.java.getResource(resource).toURI()).toString()