diff options
author | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2018-06-19 10:27:53 +0200 |
---|---|---|
committer | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2018-08-02 09:57:34 +0200 |
commit | bd8d6302d61a4b688c2b108549de99fca7f7175c (patch) | |
tree | 31d482f71e90e57380446afeb4a5b08d16a7886e /hv-collector-domain/src/test | |
parent | 67689405071acdad2b26d5112b3662605e474ce9 (diff) |
Include payload content type in wire frame
Closes ONAP-404
Change-Id: I6adfb542ffdafad678e7bc6e062d3d59c250b39e
Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Issue-ID: DCAEGEN2-601
Diffstat (limited to 'hv-collector-domain/src/test')
-rw-r--r-- | hv-collector-domain/src/test/kotlin/org/onap/dcae/collectors/veshv/domain/WireFrameCodecsTest.kt | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/hv-collector-domain/src/test/kotlin/org/onap/dcae/collectors/veshv/domain/WireFrameCodecsTest.kt b/hv-collector-domain/src/test/kotlin/org/onap/dcae/collectors/veshv/domain/WireFrameCodecsTest.kt index ed64f3b3..9694caf7 100644 --- a/hv-collector-domain/src/test/kotlin/org/onap/dcae/collectors/veshv/domain/WireFrameCodecsTest.kt +++ b/hv-collector-domain/src/test/kotlin/org/onap/dcae/collectors/veshv/domain/WireFrameCodecsTest.kt @@ -50,11 +50,23 @@ object WireFrameCodecsTest : Spek({ describe("Wire Frame invariants") { - given("input with unsupported major version") { + given("input with unsupported version") { val input = WireFrame( payload = ByteData.EMPTY, - majorVersion = 100, - minorVersion = 2, + version = 100, + payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, + payloadSize = 0) + + it("should fail validation") { + assertThat(input.isValid()).isFalse() + } + } + + given("input with unsupported payload type") { + val input = WireFrame( + payload = ByteData.EMPTY, + version = 1, + payloadTypeRaw = 0x69, payloadSize = 0) it("should fail validation") { @@ -65,8 +77,8 @@ object WireFrameCodecsTest : Spek({ given("input with too small payload size") { val input = WireFrame( payload = ByteData(byteArrayOf(1, 2, 3)), - majorVersion = 1, - minorVersion = 0, + version = 1, + payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = 1) it("should fail validation") { @@ -77,8 +89,8 @@ object WireFrameCodecsTest : Spek({ given("input with too big payload size") { val input = WireFrame( payload = ByteData(byteArrayOf(1, 2, 3)), - majorVersion = 1, - minorVersion = 0, + version = 1, + payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = 8) it("should fail validation") { @@ -90,8 +102,8 @@ object WireFrameCodecsTest : Spek({ val payload = byteArrayOf(6, 9, 8, 6) val input = WireFrame( payload = ByteData(payload), - majorVersion = 1, - minorVersion = 0, + version = 1, + payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = payload.size) it("should pass validation") { @@ -109,12 +121,12 @@ object WireFrameCodecsTest : Spek({ val encoded = encodeSampleFrame() val decoded = decoder.decodeFirst(encoded) - it("should decode major version") { - assertThat(decoded.majorVersion).isEqualTo(frame.majorVersion) + it("should decode version") { + assertThat(decoded.version).isEqualTo(frame.version) } - it("should decode minor version") { - assertThat(decoded.minorVersion).isEqualTo(frame.minorVersion) + it("should decode payload type") { + assertThat(decoded.payloadTypeRaw).isEqualTo(frame.payloadTypeRaw) } it("should decode payload size") { |