aboutsummaryrefslogtreecommitdiffstats
path: root/hv-collector-ct/src
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-06-19 10:27:53 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-02 09:57:34 +0200
commitbd8d6302d61a4b688c2b108549de99fca7f7175c (patch)
tree31d482f71e90e57380446afeb4a5b08d16a7886e /hv-collector-ct/src
parent67689405071acdad2b26d5112b3662605e474ce9 (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-ct/src')
-rw-r--r--hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/utils.kt27
1 files changed, 12 insertions, 15 deletions
diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/utils.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/utils.kt
index 998f3140..3314c44f 100644
--- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/utils.kt
+++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/utils.kt
@@ -20,22 +20,19 @@
package org.onap.dcae.collectors.veshv.tests.component
import com.google.protobuf.ByteString
-import io.netty.buffer.ByteBuf
import io.netty.buffer.ByteBufAllocator
import io.netty.buffer.PooledByteBufAllocator
-import io.netty.buffer.Unpooled
import org.onap.ves.VesEventV5.VesEvent
import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader
import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain
-import java.nio.charset.Charset
-import java.util.*
+import java.util.UUID
-val alocator: ByteBufAllocator = PooledByteBufAllocator.DEFAULT
+val allocator: ByteBufAllocator = PooledByteBufAllocator.DEFAULT
-fun vesMessage(domain: Domain = Domain.OTHER, id: String = UUID.randomUUID().toString()) = alocator.buffer().run {
+fun vesMessage(domain: Domain = Domain.OTHER, id: String = UUID.randomUUID().toString()) = allocator.buffer().run {
writeByte(0xFF) // always 0xFF
- writeByte(1) // major version
- writeByte(0) // minor version
+ writeByte(0x01) // version
+ writeByte(0x01) // content type = GPB
val gpb = vesEvent(domain, id).toByteString().asReadOnlyByteBuffer()
writeInt(gpb.limit()) // ves event size in bytes
@@ -43,10 +40,10 @@ fun vesMessage(domain: Domain = Domain.OTHER, id: String = UUID.randomUUID().toS
}
-fun invalidVesMessage() = alocator.buffer().run {
+fun invalidVesMessage() = allocator.buffer().run {
writeByte(0xFF) // always 0xFF
- writeByte(1) // major version
- writeByte(0) // minor version
+ writeByte(0x01) // version
+ writeByte(0x01) // content type = GPB
val invalidGpb = "some random data".toByteArray(Charsets.UTF_8)
writeInt(invalidGpb.size) // ves event size in bytes
@@ -54,14 +51,14 @@ fun invalidVesMessage() = alocator.buffer().run {
}
-fun garbageFrame() = alocator.buffer().run {
+fun garbageFrame() = allocator.buffer().run {
writeBytes("the meaning of life is &@)(*_!".toByteArray())
}
-fun invalidWireFrame() = alocator.buffer().run {
+fun invalidWireFrame() = allocator.buffer().run {
writeByte(0xFF)
- writeByte(1)
- writeByte(0)
+ writeByte(0x01) // version
+ writeByte(0x01) // content type = GPB
}
fun vesEvent(domain: Domain = Domain.OTHER, id: String = UUID.randomUUID().toString()) =