aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-main
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-main
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-main')
-rw-r--r--hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfiguration.kt3
-rw-r--r--hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt5
2 files changed, 6 insertions, 2 deletions
diff --git a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfiguration.kt b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfiguration.kt
index 9e4c5f2d..35ca09d8 100644
--- a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfiguration.kt
+++ b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfiguration.kt
@@ -42,6 +42,7 @@ internal class ArgBasedServerConfiguration : ArgBasedConfiguration<ServerConfigu
LISTEN_PORT,
CONSUL_CONFIG_URL,
CONSUL_FIRST_REQUEST_DELAY,
+ SSL_DISABLE,
PRIVATE_KEY_FILE,
CERT_FILE,
TRUST_CERT_FILE,
@@ -66,11 +67,13 @@ internal class ArgBasedServerConfiguration : ArgBasedConfiguration<ServerConfigu
}
private fun createSecurityConfiguration(cmdLine: CommandLine): SecurityConfiguration {
+ val sslDisable = cmdLine.hasOption(SSL_DISABLE)
val pkFile = cmdLine.stringValue(PRIVATE_KEY_FILE, DefaultValues.PRIVATE_KEY_FILE)
val certFile = cmdLine.stringValue(CERT_FILE, DefaultValues.CERT_FILE)
val trustCertFile = cmdLine.stringValue(TRUST_CERT_FILE, DefaultValues.TRUST_CERT_FILE)
return SecurityConfiguration(
+ sslDisable = sslDisable,
privateKey = stringPathToPath(pkFile),
cert = stringPathToPath(certFile),
trustedCert = stringPathToPath(trustCertFile)
diff --git a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
index b56b1b1d..0498344c 100644
--- a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
+++ b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
@@ -59,7 +59,8 @@ object ArgBasedServerConfigurationTest : Spek({
lateinit var result: ServerConfiguration
beforeEachTest {
- result = parse("--listen-port", listenPort,
+ result = parse("--ssl-disable",
+ "--listen-port", listenPort,
"--config-url", configurationUrl,
"--first-request-delay", firstRequestDelay,
"--private-key-file", pk.toFile().absolutePath,
@@ -81,7 +82,7 @@ object ArgBasedServerConfigurationTest : Spek({
it("should set proper security configuration") {
assertThat(result.securityConfiguration).isEqualTo(
- SecurityConfiguration(pk, cert, trustCert)
+ SecurityConfiguration(sslDisable = true, privateKey = pk, cert = cert, trustedCert = trustCert)
)
}