From fd44b433ac9825be6cc654e8a566f9d0bfc70166 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Mon, 1 Oct 2018 07:54:26 +0200 Subject: HV-VES Domain update Change domain name. In this project this yields following changes: * Comment change in VesEvent proto * Updated measurements proto (kept as documentation only, ie. not used in the collector) * Update name in test scenarios for unit and component scope Change-Id: I719077b5fcb642c067d25b7aa174a2e629404689 Issue-ID: DCAEGEN2-847 Signed-off-by: Piotr Jaszczyk --- .../message/generator/impl/MessageGeneratorImpl.kt | 4 ++-- .../impl/impl/MessageGeneratorImplTest.kt | 24 +++++++++++----------- .../ves/message/generator/impl/impl/parameters.kt | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'hv-collector-ves-message-generator/src') diff --git a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageGeneratorImpl.kt b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageGeneratorImpl.kt index 90e7770b..2bb9f781 100644 --- a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageGeneratorImpl.kt +++ b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageGeneratorImpl.kt @@ -78,8 +78,8 @@ class MessageGeneratorImpl internal constructor(private val payloadGenerator: Pa WireFrameMessage("invalid vesEvent".toByteArray(Charset.defaultCharset())) } - private fun vesEvent(commonEventHeader: CommonEventHeader, hvRanMeasPayload: ByteString): ByteArray { - return createVesEvent(commonEventHeader, hvRanMeasPayload).toByteArray() + private fun vesEvent(commonEventHeader: CommonEventHeader, eventFields: ByteString): ByteArray { + return createVesEvent(commonEventHeader, eventFields).toByteArray() } private fun createVesEvent(commonEventHeader: CommonEventHeader, payload: ByteString): VesEvent = 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 e380f931..dedf5ccf 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 @@ -30,7 +30,7 @@ import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.onap.dcae.collectors.veshv.domain.ByteData import org.onap.dcae.collectors.veshv.domain.WireFrameMessage -import org.onap.dcae.collectors.veshv.domain.VesEventDomain.HVMEAS +import org.onap.dcae.collectors.veshv.domain.VesEventDomain.PERF3GPP import org.onap.dcae.collectors.veshv.domain.VesEventDomain.FAULT import org.onap.dcae.collectors.veshv.domain.VesEventDomain.HEARTBEAT import org.onap.dcae.collectors.veshv.tests.utils.commonHeader @@ -54,7 +54,7 @@ object MessageGeneratorImplTest : Spek({ val limit = 1000L generator .createMessageFlux(listOf(MessageParameters( - commonHeader(HVMEAS), + commonHeader(PERF3GPP), MessageType.VALID ))) .take(limit) @@ -67,7 +67,7 @@ object MessageGeneratorImplTest : Spek({ it("should create message flux of specified size") { generator .createMessageFlux(listOf(MessageParameters( - commonHeader(HVMEAS), + commonHeader(PERF3GPP), MessageType.VALID, 5 ))) @@ -98,7 +98,7 @@ object MessageGeneratorImplTest : Spek({ generator .createMessageFlux(listOf(MessageParameters( - commonHeader(HVMEAS), + commonHeader(PERF3GPP), MessageType.TOO_BIG_PAYLOAD, 1 ))) @@ -106,7 +106,7 @@ object MessageGeneratorImplTest : Spek({ .assertNext { assertThat(it.isValid()).isTrue() assertThat(it.payloadSize).isGreaterThan(WireFrameMessage.MAX_PAYLOAD_SIZE) - assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(HVMEAS.name) + assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name) } .verifyComplete() } @@ -115,7 +115,7 @@ object MessageGeneratorImplTest : Spek({ it("should create flux of messages with invalid payload") { generator .createMessageFlux(listOf(MessageParameters( - commonHeader(HVMEAS), + commonHeader(PERF3GPP), MessageType.INVALID_GPB_DATA, 1 ))) @@ -133,7 +133,7 @@ object MessageGeneratorImplTest : Spek({ it("should create flux of messages with invalid version") { generator .createMessageFlux(listOf(MessageParameters( - commonHeader(HVMEAS), + commonHeader(PERF3GPP), MessageType.INVALID_WIRE_FRAME, 1 ))) @@ -141,7 +141,7 @@ object MessageGeneratorImplTest : Spek({ .assertNext { assertThat(it.isValid()).isFalse() assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE) - assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(HVMEAS.name) + assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name) assertThat(it.versionMajor).isNotEqualTo(WireFrameMessage.SUPPORTED_VERSION_MINOR) } .verifyComplete() @@ -159,7 +159,7 @@ object MessageGeneratorImplTest : Spek({ .assertNext { assertThat(it.isValid()).isTrue() assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE) - assertThat(extractHvRanMeasFields(it.payload).size()).isEqualTo(MessageGenerator.FIXED_PAYLOAD_SIZE) + assertThat(extractEventFields(it.payload).size()).isEqualTo(MessageGenerator.FIXED_PAYLOAD_SIZE) assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.name) } .verifyComplete() @@ -170,7 +170,7 @@ object MessageGeneratorImplTest : Spek({ it("should create concatenated flux of messages") { val singleFluxSize = 5L val messageParameters = listOf( - MessageParameters(commonHeader(HVMEAS), MessageType.VALID, singleFluxSize), + MessageParameters(commonHeader(PERF3GPP), MessageType.VALID, singleFluxSize), MessageParameters(commonHeader(FAULT), MessageType.TOO_BIG_PAYLOAD, singleFluxSize), MessageParameters(commonHeader(HEARTBEAT), MessageType.VALID, singleFluxSize) ) @@ -178,7 +178,7 @@ object MessageGeneratorImplTest : Spek({ .test() .assertNext { assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE) - assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(HVMEAS.name) + assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name) } .expectNextCount(singleFluxSize - 1) .assertNext { @@ -201,6 +201,6 @@ fun extractCommonEventHeader(bytes: ByteData): CommonEventHeader = VesEvent.parseFrom(bytes.unsafeAsArray()).commonEventHeader -fun extractHvRanMeasFields(bytes: ByteData): ByteString = +fun extractEventFields(bytes: ByteData): ByteString = VesEvent.parseFrom(bytes.unsafeAsArray()).eventFields diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/parameters.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/parameters.kt index 45e936a6..00c08aa7 100644 --- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/parameters.kt +++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/parameters.kt @@ -26,7 +26,7 @@ private const val validMessageParameters = { "commonEventHeader": { "version": "sample-version", - "domain": "HVMEAS", + "domain": "PERF3GPP", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -48,7 +48,7 @@ private const val validMessageParameters = { "commonEventHeader": { "version": "sample-version", - "domain": "HVMEAS", + "domain": "PERF3GPP", "sequence": 1, "priority": 1, "eventId": "sample-event-id", @@ -76,7 +76,7 @@ private const val invalidMessageParameters = { "commonEventHeader": { "version": "sample-version", - "domain": "HVMEAS", + "domain": "PERF3GPP", "sequence": 1, "priority": 1, "eventId": "sample-event-id", -- cgit 1.2.3-korg