diff options
author | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2018-08-21 14:46:40 +0200 |
---|---|---|
committer | Piotr Jaszczyk <piotr.jaszczyk@nokia.com> | 2018-08-22 09:40:50 +0200 |
commit | 56c5808a172a1ec8d8f82aafbed67fc020df9fac (patch) | |
tree | 186c41357dd0adcb25b427fd169c94876970227d /hv-collector-domain/src/test | |
parent | 2d8719cc8e475d213243f41dedd3b875fadb37f0 (diff) |
Align with latest proposal of wire proto frame
Change-Id: I8f989a3913f1592b4d740a80ed30b01bc3aceff2
Issue-ID: DCAEGEN2-722
Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
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 | 41 |
1 files changed, 31 insertions, 10 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 a1395266..89d1f32e 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 @@ -53,10 +53,11 @@ object WireFrameCodecsTest : Spek({ describe("Wire Frame invariants") { - given("input with unsupported version") { + given("input with unsupported major version") { val input = PayloadWireFrameMessage( payload = ByteData.EMPTY, - version = 100, + versionMajor = 100, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = 0) @@ -65,10 +66,24 @@ object WireFrameCodecsTest : Spek({ } } + given("input with unsupported minor version") { + val input = PayloadWireFrameMessage( + payload = ByteData.EMPTY, + versionMajor = 1, + versionMinor = 6, + payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, + payloadSize = 0) + + it("should pass validation") { + assertThat(input.isValid()).isTrue() + } + } + given("input with unsupported payload type") { val input = PayloadWireFrameMessage( payload = ByteData.EMPTY, - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = 0x69, payloadSize = 0) @@ -80,7 +95,8 @@ object WireFrameCodecsTest : Spek({ given("input with too small payload size") { val input = PayloadWireFrameMessage( payload = ByteData(byteArrayOf(1, 2, 3)), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = 1) @@ -92,7 +108,8 @@ object WireFrameCodecsTest : Spek({ given("input with too big payload size") { val input = PayloadWireFrameMessage( payload = ByteData(byteArrayOf(1, 2, 3)), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = 8) @@ -105,7 +122,8 @@ object WireFrameCodecsTest : Spek({ val payload = byteArrayOf(6, 9, 8, 6) val input = PayloadWireFrameMessage( payload = ByteData(payload), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = payload.size) @@ -125,7 +143,7 @@ object WireFrameCodecsTest : Spek({ val decoded = decoder.decodeFirst(encoded).getPayloadMessageOrFail() it("should decode version") { - assertThat(decoded.version).isEqualTo(frame.version) + assertThat(decoded.versionMajor).isEqualTo(frame.versionMajor) } it("should decode payload type") { @@ -221,7 +239,8 @@ object WireFrameCodecsTest : Spek({ val payload = ByteArray(MAX_PAYLOAD_SIZE) val input = PayloadWireFrameMessage( payload = ByteData(payload), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = payload.size) @@ -234,7 +253,8 @@ object WireFrameCodecsTest : Spek({ val payload = ByteArray(MAX_PAYLOAD_SIZE + 1) val input = PayloadWireFrameMessage( payload = ByteData(payload), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = payload.size) val buff = encoder.encode(input) @@ -249,7 +269,8 @@ object WireFrameCodecsTest : Spek({ val payload = ByteArray(MAX_PAYLOAD_SIZE) val input = PayloadWireFrameMessage( payload = ByteData(payload), - version = 1, + versionMajor = 1, + versionMinor = 0, payloadTypeRaw = PayloadContentType.GOOGLE_PROTOCOL_BUFFER.hexValue, payloadSize = payload.size) |