Search in sources :

Example 1 with KafkaDescribeBeginExFW

use of io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeBeginExFW in project zilla by aklivity.

the class KafkaFunctionsTest method shouldGenerateDescribeBeginExtension.

@Test
public void shouldGenerateDescribeBeginExtension() {
    byte[] build = KafkaFunctions.beginEx().typeId(0x01).describe().topic("topic").config("cleanup.policy").build().build();
    DirectBuffer buffer = new UnsafeBuffer(build);
    KafkaBeginExFW beginEx = new KafkaBeginExFW().wrap(buffer, 0, buffer.capacity());
    assertEquals(0x01, beginEx.typeId());
    assertEquals(KafkaApi.DESCRIBE.value(), beginEx.kind());
    final KafkaDescribeBeginExFW describeBeginEx = beginEx.describe();
    assertEquals("topic", describeBeginEx.topic().asString());
    final MutableInteger configsCount = new MutableInteger();
    describeBeginEx.configs().forEach(f -> configsCount.value++);
    assertEquals(1, configsCount.value);
    assertNotNull(describeBeginEx.configs().matchFirst(c -> "cleanup.policy".equals(c.asString())));
}
Also used : DirectBuffer(org.agrona.DirectBuffer) KafkaDeltaType(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaDeltaType) KafkaDescribeBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeBeginExFW) ExpressionFactory(javax.el.ExpressionFactory) KafkaDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDataExFW) KafkaSkip(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaSkip) KafkaBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBeginExFW) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) KafkaBootstrapBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBootstrapBeginExFW) KafkaOffsetFW(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaOffsetFW) ByteBuffer(java.nio.ByteBuffer) KafkaValueMatchFW(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaValueMatchFW) KafkaMergedFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaMergedFlushExFW) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) KafkaFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFlushExFW) HEADER(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.HEADER) Array32FW(io.aklivity.zilla.specs.binding.kafka.internal.types.Array32FW) KafkaMetaDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaMetaDataExFW) MutableInteger(org.agrona.collections.MutableInteger) Before(org.junit.Before) KafkaMergedBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaMergedBeginExFW) KafkaFetchFlushExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) KafkaMetaBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaMetaBeginExFW) Test(org.junit.Test) HEADERS(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.HEADERS) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) OctetsFW(io.aklivity.zilla.specs.binding.kafka.internal.types.OctetsFW) Objects(java.util.Objects) KafkaFetchDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchDataExFW) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) KafkaDescribeDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeDataExFW) KafkaFetchBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchBeginExFW) NOT(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.NOT) ValueExpression(javax.el.ValueExpression) KafkaApi(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaApi) KEY(io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.KEY) KafkaProduceBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaProduceBeginExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) KafkaMergedDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaMergedDataExFW) KafkaProduceDataExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaProduceDataExFW) DirectBuffer(org.agrona.DirectBuffer) MutableInteger(org.agrona.collections.MutableInteger) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) KafkaBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBeginExFW) KafkaDescribeBeginExFW(io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeBeginExFW) Test(org.junit.Test)

Aggregations

Array32FW (io.aklivity.zilla.specs.binding.kafka.internal.types.Array32FW)1 HEADER (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.HEADER)1 HEADERS (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.HEADERS)1 KEY (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.KEY)1 NOT (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaConditionType.NOT)1 KafkaDeltaType (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaDeltaType)1 KafkaOffsetFW (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaOffsetFW)1 KafkaSkip (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaSkip)1 KafkaValueMatchFW (io.aklivity.zilla.specs.binding.kafka.internal.types.KafkaValueMatchFW)1 OctetsFW (io.aklivity.zilla.specs.binding.kafka.internal.types.OctetsFW)1 KafkaApi (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaApi)1 KafkaBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBeginExFW)1 KafkaBootstrapBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaBootstrapBeginExFW)1 KafkaDataExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDataExFW)1 KafkaDescribeBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeBeginExFW)1 KafkaDescribeDataExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaDescribeDataExFW)1 KafkaFetchBeginExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchBeginExFW)1 KafkaFetchDataExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchDataExFW)1 KafkaFetchFlushExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFetchFlushExFW)1 KafkaFlushExFW (io.aklivity.zilla.specs.binding.kafka.internal.types.stream.KafkaFlushExFW)1