use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldNotMatchMergedDataExtensionKey.
@Test(expected = Exception.class)
public void shouldNotMatchMergedDataExtensionKey() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().typeId(0x01).merged().partition(0, 0L).timestamp(12345678L).key("no match").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.value(v -> v.set("match".getBytes(UTF_8)))).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.name(n -> n.set("name".getBytes(UTF_8))).value(v -> v.set("value".getBytes(UTF_8))))).build();
matcher.match(byteBuf);
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldNotBuildMatcher.
@Test
public void shouldNotBuildMatcher() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1);
Object matched = matcher.match(byteBuf);
assertNull(matched);
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldNotMatchMergedDataExtensionProgress.
@Test(expected = Exception.class)
public void shouldNotMatchMergedDataExtensionProgress() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().typeId(0x01).merged().progress(0, 2L).timestamp(12345678L).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.value(v -> v.set("match".getBytes(UTF_8)))).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.name(n -> n.set("name".getBytes(UTF_8))).value(v -> v.set("value".getBytes(UTF_8))))).build();
matcher.match(byteBuf);
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldNotMatchMergedDataExtensionTimestamp.
@Test(expected = Exception.class)
public void shouldNotMatchMergedDataExtensionTimestamp() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().typeId(0x01).merged().timestamp(123456789L).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.value(v -> v.set("match".getBytes(UTF_8)))).delta(d -> d.type(t -> t.set(KafkaDeltaType.NONE))).headersItem(h -> h.name(n -> n.set("name".getBytes(UTF_8))).value(v -> v.set("value".getBytes(UTF_8))))).build();
matcher.match(byteBuf);
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchProduceDataExtensionNullKey.
@Test
public void shouldMatchProduceDataExtensionNullKey() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().produce().key(null).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new KafkaDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).produce(p -> p.timestamp(12345678L).sequence(0).key(k -> k.length(-1).value((OctetsFW) null)).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));
}
Aggregations