diff options
author | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-06-11 16:54:47 +0200 |
---|---|---|
committer | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2018-08-02 08:51:34 +0200 |
commit | 85a59b8d29c6f81720fe3d2e59926740173fcae9 (patch) | |
tree | 037e30c559c9aad27c51fbf5109f6ab9587b69c3 /hv-collector-client-simulator/src/test | |
parent | ecf7cb09d4bce389b615257d3323ada0840100e8 (diff) |
Implemented rest server in client simulator
Change-Id: I212b79fe2a0272f340c5ca889beff60b469f7f24
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-client-simulator/src/test')
-rw-r--r-- | hv-collector-client-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/MessageFactoryTest.kt | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/hv-collector-client-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/MessageFactoryTest.kt b/hv-collector-client-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/MessageFactoryTest.kt index 405a15eb..ee1d1cf2 100644 --- a/hv-collector-client-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/MessageFactoryTest.kt +++ b/hv-collector-client-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/MessageFactoryTest.kt @@ -19,34 +19,65 @@ */ package org.onap.dcae.collectors.veshv.simulators.xnf.impl +import com.google.protobuf.ByteString import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it +import org.onap.dcae.collectors.veshv.simulators.xnf.config.MessageParameters +import org.onap.ves.VesEventV5 +import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain.HVRANMEAS +import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Priority.MEDIUM import reactor.test.test +const val SAMPLE_START_EPOCH: Long = 120034455 +const val SAMPLE_LAST_EPOCH: Long = 120034455 + /** * @author Jakub Dudycz <jakub.dudycz@nokia.com> * @since June 2018 */ object MessageFactoryTest : Spek({ describe("message factory") { - val factory = MessageFactory() - given("no parameters") { + val factory = MessageFactory + + given("only common header") { it("should return infinite flux") { val limit = 1000L - factory.createMessageFlux().take(limit).test() + factory.createMessageFlux(getSampleMessageParameters()).take(limit).test() .expectNextCount(limit) .verifyComplete() } } - given("messages amount") { + given("common header and messages amount") { it("should return message flux of specified size") { - factory.createMessageFlux(5).test() + factory.createMessageFlux((getSampleMessageParameters(5))).test() .expectNextCount(5) .verifyComplete() } } } }) + +fun getSampleMessageParameters(amount: Long = -1): MessageParameters{ + val commonHeader = VesEventV5.VesEvent.CommonEventHeader.newBuilder() + .setVersion("sample-version") + .setDomain(HVRANMEAS) + .setSequence(1) + .setPriority(MEDIUM) + .setEventId("sample-event-id") + .setEventName("sample-event-name") + .setEventType("sample-event-type") + .setStartEpochMicrosec(SAMPLE_START_EPOCH) + .setLastEpochMicrosec(SAMPLE_LAST_EPOCH) + .setNfNamingCode("sample-nf-naming-code") + .setNfcNamingCode("sample-nfc-naming-code") + .setReportingEntityId("sample-reporting-entity-id") + .setReportingEntityName(ByteString.copyFromUtf8("sample-reporting-entity-name")) + .setSourceId(ByteString.copyFromUtf8("sample-source-id")) + .setSourceName("sample-source-name") + .build() + + return MessageParameters(commonHeader, amount) +} |