From 0d15767178ffff59009de51d3737883aa81df2a6 Mon Sep 17 00:00:00 2001 From: kjaniak Date: Tue, 17 Jul 2018 11:50:10 +0200 Subject: Add command line option to disable SSL/TLS Closes ONAP-508 Change-Id: If6c3935ede7b00dea9b36747c6cd1422c1c8d330 Signed-off-by: kjaniak Issue-ID: DCAEGEN2-601 --- .../main/config/ArgConfigurationProviderTest.kt | 38 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'hv-collector-xnf-simulator/src/test') 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) + ) + } + } + } } }) -- cgit 1.2.3-korg