summaryrefslogtreecommitdiffstats
path: root/hv-collector-xnf-simulator/src/test
diff options
context:
space:
mode:
authorkjaniak <kornel.janiak@nokia.com>2018-07-17 11:50:10 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-03 07:32:52 +0200
commit0d15767178ffff59009de51d3737883aa81df2a6 (patch)
treec1f8cc00ca873597a7e5014fc75e3db8b957a45d /hv-collector-xnf-simulator/src/test
parent40c5abeac588ca6c13477675960c94a97dcdeb15 (diff)
Add command line option to disable SSL/TLS
Closes ONAP-508 Change-Id: If6c3935ede7b00dea9b36747c6cd1422c1c8d330 Signed-off-by: kjaniak <kornel.janiak@nokia.com> Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-xnf-simulator/src/test')
-rw-r--r--hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/config/ArgConfigurationProviderTest.kt38
1 files changed, 35 insertions, 3 deletions
diff --git a/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/config/ArgConfigurationProviderTest.kt b/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/config/ArgConfigurationProviderTest.kt
index f2f92fff..fccd8b5a 100644
--- a/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/config/ArgConfigurationProviderTest.kt
+++ b/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/config/ArgConfigurationProviderTest.kt
@@ -31,6 +31,7 @@ import org.onap.dcae.collectors.veshv.simulators.xnf.config.ArgConfigurationProv
import org.onap.dcae.collectors.veshv.simulators.xnf.config.ArgConfigurationProvider.*
import org.onap.dcae.collectors.veshv.simulators.xnf.config.SimulatorConfiguration
import java.nio.file.Paths
+import kotlin.test.assertTrue
object ArgConfigurationProviderTest : Spek({
@@ -47,7 +48,7 @@ object ArgConfigurationProviderTest : Spek({
fun parse(vararg cmdLine: String): SimulatorConfiguration =
cut.parse(cmdLine).fold(
- {throw AssertionError("Parsing result should be present")},
+ { throw AssertionError("Parsing result should be present") },
::identity
)
@@ -57,7 +58,8 @@ object ArgConfigurationProviderTest : Spek({
given("all parameters are present in the long form") {
beforeEachTest {
- result = parse("--ves-port", "6969",
+ result = parse("--ssl-disable",
+ "--ves-port", "6969",
"--ves-host", vesHost,
"--messages", messagesAmount.toString(),
"--private-key-file", pk.toFile().absolutePath,
@@ -76,7 +78,7 @@ object ArgConfigurationProviderTest : Spek({
it("should set proper security configuration") {
assertThat(result.security).isEqualTo(
- SecurityConfiguration(pk, cert, trustCert)
+ SecurityConfiguration(sslDisable = true, privateKey = pk, cert = cert, trustedCert = trustCert)
)
}
}
@@ -122,5 +124,35 @@ object ArgConfigurationProviderTest : Spek({
}
}
}
+
+ given("disabled ssl certs together with all other parameters") {
+ beforeEachTest {
+ result = parse("--ssl-disable",
+ "--ves-port", "888",
+ "--ves-host", vesHost,
+ "--messages", messagesAmount.toString(),
+ "--private-key-file", pk.toFile().absolutePath,
+ "--cert-file", cert.toFile().absolutePath,
+ "--trust-cert-file", trustCert.toFile().absolutePath)
+ }
+
+ on("security config") {
+ val securityConfiguration = result.security
+
+ it("should set ssl disable to true"){
+ assertTrue(securityConfiguration.sslDisable)
+ }
+
+ it("should set proper security configuration") {
+ assertThat(securityConfiguration).isEqualTo(
+ SecurityConfiguration(
+ sslDisable = true,
+ privateKey = pk,
+ cert = cert,
+ trustedCert = trustCert)
+ )
+ }
+ }
+ }
}
})