diff options
Diffstat (limited to 'hv-collector-main')
-rw-r--r-- | hv-collector-main/pom.xml | 10 | ||||
-rw-r--r-- | hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt | 22 |
2 files changed, 14 insertions, 18 deletions
diff --git a/hv-collector-main/pom.xml b/hv-collector-main/pom.xml index dbec1def..1208e15d 100644 --- a/hv-collector-main/pom.xml +++ b/hv-collector-main/pom.xml @@ -19,8 +19,8 @@ ~ ============LICENSE_END========================================================= --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <licenses> @@ -89,6 +89,12 @@ <artifactId>hv-collector-core</artifactId> <version>${project.parent.version}</version> </dependency> + <dependency> + <groupId>${project.parent.groupId}</groupId> + <artifactId>hv-collector-test-utils</artifactId> + <version>${project.parent.version}</version> + <scope>test</scope> + </dependency> <dependency> <groupId>io.arrow-kt</groupId> diff --git a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt index 6b111ae4..f15f7f49 100644 --- a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt +++ b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt @@ -19,7 +19,6 @@ */ package org.onap.dcae.collectors.veshv.main -import arrow.core.identity import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.describe @@ -29,6 +28,8 @@ import org.jetbrains.spek.api.dsl.on import org.onap.dcae.collectors.veshv.domain.SecurityConfiguration import org.onap.dcae.collectors.veshv.main.ArgVesHvConfiguration.DefaultValues import org.onap.dcae.collectors.veshv.model.ServerConfiguration +import org.onap.dcae.collectors.veshv.tests.utils.parseExpectingFailure +import org.onap.dcae.collectors.veshv.tests.utils.parseExpectingSuccess import org.onap.dcae.collectors.veshv.utils.commandline.WrongArgumentError import java.nio.file.Paths import java.time.Duration @@ -51,23 +52,12 @@ object ArgVesHvConfigurationTest : Spek({ cut = ArgVesHvConfiguration() } - fun parse(vararg cmdLine: String): ServerConfiguration = - cut.parse(cmdLine).fold( - { throw AssertionError("Parsing result should be present") }, - ::identity - ) - - fun parseExpectingFailure(vararg cmdLine: String) = - cut.parse(cmdLine).fold(::identity) { - throw AssertionError("parsing should have failed") - } - describe("parsing arguments") { given("all parameters are present in the long form") { lateinit var result: ServerConfiguration beforeEachTest { - result = parse("--ssl-disable", + result = cut.parseExpectingSuccess("--ssl-disable", "--listen-port", listenPort, "--config-url", configurationUrl, "--first-request-delay", firstRequestDelay, @@ -107,7 +97,7 @@ object ArgVesHvConfigurationTest : Spek({ lateinit var result: ServerConfiguration beforeEachTest { - result = parse("-p", listenPort, "-c", configurationUrl, "-d", firstRequestDelay) + result = cut.parseExpectingSuccess("-p", listenPort, "-c", configurationUrl, "-d", firstRequestDelay) } it("should set proper port") { @@ -129,7 +119,7 @@ object ArgVesHvConfigurationTest : Spek({ lateinit var result: ServerConfiguration beforeEachTest { - result = parse("--listen-port", listenPort) + result = cut.parseExpectingSuccess("--listen-port", listenPort) } it("should set default config url") { @@ -167,7 +157,7 @@ object ArgVesHvConfigurationTest : Spek({ describe("required parameter is absent") { given("listen port is missing") { it("should throw exception") { - assertThat(parseExpectingFailure( + assertThat(cut.parseExpectingFailure( "--ssl-disable", "--config-url", configurationUrl, "--first-request-delay", firstRequestDelay, |