aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-ves-message-generator/src/test
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-07-26 11:49:45 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-03 10:15:25 +0200
commita2d874fd73825b254a3e0be81cff57a5c3e1d9d7 (patch)
treeb8d90cf0c3acf46de5be92e64c8da97c969d9df4 /hv-collector-ves-message-generator/src/test
parentf738ede42e619f1a5c13671cb560224aa639f1db (diff)
DCAE APP simulator rework
- Extract message parameters parsing logic to standalone class in utils - Make DCAE APP simulator store whole received messages history - Add validation endpoint - Add new messege type: FIXED_PAYLOAD Closes ONAP-686 Change-Id: I865804716ad5e46a7503a8eee70cfe9ac75a6c1e Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-ves-message-generator/src/test')
-rw-r--r--hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt22
1 files changed, 22 insertions, 0 deletions
diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt
index b2490dd1..1e38d46e 100644
--- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt
+++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt
@@ -146,6 +146,24 @@ object MessageGeneratorImplTest : Spek({
.verifyComplete()
}
}
+ on("message type requesting fixed payload") {
+ it("should create flux of valid messages with fixed payload") {
+ generator
+ .createMessageFlux(listOf(MessageParameters(
+ createSampleCommonHeader(FAULT),
+ MessageType.FIXED_PAYLOAD,
+ 1
+ )))
+ .test()
+ .assertNext {
+ assertThat(it.isValid()).isTrue()
+ assertThat(it.payloadSize).isLessThan(PayloadWireFrameMessage.MAX_PAYLOAD_SIZE)
+ assertThat(extractHvRanMeasFields(it.payload).size()).isEqualTo(MessageGenerator.FIXED_PAYLOAD_SIZE)
+ assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT)
+ }
+ .verifyComplete()
+ }
+ }
}
given("list of message parameters") {
it("should create concatenated flux of messages") {
@@ -182,6 +200,10 @@ fun extractCommonEventHeader(bytes: ByteData): CommonEventHeader {
return VesEvent.parseFrom(bytes.unsafeAsArray()).commonEventHeader
}
+fun extractHvRanMeasFields(bytes: ByteData): ByteString {
+ return VesEvent.parseFrom(bytes.unsafeAsArray()).hvRanMeasFields
+}
+
private fun createSampleCommonHeader(domain: CommonEventHeader.Domain): CommonEventHeader = CommonEventHeader.newBuilder()
.setVersion("sample-version")
.setDomain(domain)