use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchDataExtensionTypeId.
@Test
public void shouldMatchDataExtensionTypeId() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().typeId(0x01).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(5).value(v -> v.set("value".getBytes(UTF_8))))).build();
assertNotNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchProduceDataExtensionTimestamp.
@Test
public void shouldMatchProduceDataExtensionTimestamp() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().produce().timestamp(12345678L).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(5).value(v -> v.set("match".getBytes(UTF_8)))).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 org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class KafkaFunctionsTest method shouldMatchProduceDataExtensionKey.
@Test
public void shouldMatchProduceDataExtensionKey() throws Exception {
BytesMatcher matcher = KafkaFunctions.matchDataEx().produce().key("match").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(5).value(v -> v.set("match".getBytes(UTF_8)))).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 org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchUnixBeginExtension.
@Test
public void shouldMatchUnixBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressUnix().source("source-1234").destination("destination-5678").build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.unix(i -> i.protocol(p -> p.set(STREAM)).source(paddedUtf8("source-1234", 108), 0, 108).destination(paddedUtf8("destination-5678", 108), 0, 108))).build();
assertNotNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInetBeginExtension.
@Test
public void shouldMatchInetBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().source("*").destination("example.com").sourcePort(32768).destinationPort(443).build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).infosItem(i -> i.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
Aggregations