use of io.aklivity.zilla.specs.binding.kafka.internal.types.OctetsFW in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchMergedDataExtensionHeaderWithNullByteArrayValue.
@Test
public void shouldMatchMergedDataExtensionHeaderWithNullByteArrayValue() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().merged().headerBytes("name", null).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new KafkaDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).merged(f -> f.timestamp(12345678L).partition(p -> p.partitionId(0).partitionOffset(0L)).progressItem(p -> p.partitionId(0).partitionOffset(1L)).key(k -> k.length(5).value(v -> v.set("match".getBytes(UTF_8)))).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.nameLen(4).name(n -> n.set("name".getBytes(UTF_8))).valueLen(-1).value((OctetsFW) null))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.kafka.internal.types.OctetsFW in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchMergedDataExtensionNullKey.
@Test
public void shouldMatchMergedDataExtensionNullKey() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().merged().key(null).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new KafkaDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).merged(f -> f.timestamp(12345678L).partition(p -> p.partitionId(0).partitionOffset(0L)).progressItem(p -> p.partitionId(0).partitionOffset(1L)).key(k -> k.length(-1).value((OctetsFW) null)).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.nameLen(4).name(n -> n.set("name".getBytes(UTF_8))).valueLen(5).value(v -> v.set("value".getBytes(UTF_8))))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.kafka.internal.types.OctetsFW in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchFetchDataExtensionHeaderWithNullValue.
@Test
public void shouldMatchFetchDataExtensionHeaderWithNullValue() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().fetch().header("name", null).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new KafkaDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).fetch(f -> f.timestamp(12345678L).partition(p -> p.partitionId(0).partitionOffset(0L)).key(k -> k.length(5).value(v -> v.set("match".getBytes(UTF_8)))).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.nameLen(4).name(n -> n.set("name".getBytes(UTF_8))).valueLen(-1).value((OctetsFW) null))).build();
assertNotNull(matcher.match(byteBuf));
}
Aggregations