aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-dcae-app-simulator/src/test
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-07-24 11:48:12 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-03 09:41:09 +0200
commitfc6ab3e5fee2bc3e607848caa665b166d6f38dd6 (patch)
treec54a032ef0093f7024cff963addca163b0dcf98e /hv-collector-dcae-app-simulator/src/test
parent53dbf8e66ad83c2d5f06279a0d7446e5e8be68e8 (diff)
Rework argument configuration
- Unify names of argument configuration classes in DCAE APP simulator, XNF simualtor and VES HV Collector - Make some of the arguments required - Adjust docker-compose and Dockerfiles - Adjust test cases and error handling Closes ONAP-683 Change-Id: I4a9d43791cced9dcb52eb83e2f7956462e8712d9 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-dcae-app-simulator/src/test')
-rw-r--r--hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgDcaeAppSimulatorConfigurationTest.kt (renamed from hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt)51
1 files changed, 28 insertions, 23 deletions
diff --git a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgDcaeAppSimulatorConfigurationTest.kt
index 4084ee8d..5ca64e3e 100644
--- a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt
+++ b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgDcaeAppSimulatorConfigurationTest.kt
@@ -28,14 +28,15 @@ import org.jetbrains.spek.api.dsl.it
import org.onap.dcae.collectors.veshv.utils.commandline.WrongArgumentError
-internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
+internal class ArgDcaeAppSimulatorConfigurationTest : Spek({
- lateinit var cut: ArgBasedDcaeAppSimConfiguration
+ lateinit var cut: ArgDcaeAppSimConfiguration
+ val listenPort = "1234"
val kafkaBootstrapServers = "localhosting:123,localhostinger:12345"
val kafkaTopics = "top1,top2"
beforeEachTest {
- cut = ArgBasedDcaeAppSimConfiguration()
+ cut = ArgDcaeAppSimConfiguration()
}
fun parseExpectingSuccess(vararg cmdLine: String): DcaeAppSimConfiguration =
@@ -56,14 +57,15 @@ internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
given("all parameters are present in the long form") {
beforeEachTest {
- result = parseExpectingSuccess("--listen-port", "6969",
+ result = parseExpectingSuccess(
+ "--listen-port", listenPort,
"--kafka-bootstrap-servers", kafkaBootstrapServers,
"--kafka-topics", kafkaTopics
)
}
it("should set proper port") {
- assertThat(result.apiPort).isEqualTo(6969)
+ assertThat(result.apiPort).isEqualTo(listenPort.toInt())
}
@@ -81,13 +83,14 @@ internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
given("some parameters are present in the short form") {
beforeEachTest {
- result = parseExpectingSuccess("-p", "666",
+ result = parseExpectingSuccess(
+ "-p", listenPort,
"--kafka-bootstrap-servers", kafkaBootstrapServers,
"-f", kafkaTopics)
}
it("should set proper port") {
- assertThat(result.apiPort).isEqualTo(666)
+ assertThat(result.apiPort).isEqualTo(listenPort.toInt())
}
it("should set proper kafka bootstrap servers") {
@@ -101,29 +104,31 @@ internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
}
}
- given("all optional parameters are absent") {
-
- beforeEachTest {
- result = parseExpectingSuccess("-s", kafkaBootstrapServers, "-f", kafkaTopics)
- }
-
- it("should set default port") {
- assertThat(result.apiPort).isEqualTo(DefaultValues.API_PORT)
- }
- }
-
describe("required parameter is absent") {
given("kafka topics are missing") {
it("should throw exception") {
- assertThat(parseExpectingFailure("-s", kafkaBootstrapServers))
- .isInstanceOf(WrongArgumentError::class.java)
+ assertThat(parseExpectingFailure(
+ "-p", listenPort,
+ "-s", kafkaBootstrapServers
+ )).isInstanceOf(WrongArgumentError::class.java)
+ }
+ }
+
+ given("kafka bootstrap servers is missing") {
+ it("should throw exception") {
+ assertThat(parseExpectingFailure(
+ "-p", listenPort,
+ "-f", kafkaTopics
+ )).isInstanceOf(WrongArgumentError::class.java)
}
}
- given("kafka bootstrap servers are missing") {
+ given("listen port is missing") {
it("should throw exception") {
- assertThat(parseExpectingFailure("-f", kafkaTopics))
- .isInstanceOf(WrongArgumentError::class.java)
+ assertThat(parseExpectingFailure(
+ "-p", kafkaTopics,
+ "-s", kafkaBootstrapServers
+ )).isInstanceOf(WrongArgumentError::class.java)
}
}
}