Search in sources :

Example 71 with BytesMatcher

use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.

the class AmqpFunctionsTest method shouldMatchAmqpDataExtensionWithOnlyPropertiesWithLongMessageId.

@Test
public void shouldMatchAmqpDataExtensionWithOnlyPropertiesWithLongMessageId() throws Exception {
    BytesMatcher matcher = matchDataEx().typeId(0).messageId(1L).userId("user1").to("clients").build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new AmqpDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0).deliveryTag(b -> b.bytes(b2 -> b2.set("00".getBytes()))).messageFormat(0).flags(1).properties(b -> b.messageId(m -> m.ulong(1L)).userId(u -> u.bytes(b2 -> b2.set("user1".getBytes()))).to("clients")).bodyKind(b -> b.set(VALUE)).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : AmqpFunctions.uint0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint0) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AmqpFunctions.symbol8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol8) AmqpBeginExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpBeginExFW) AmqpFunctions.nullValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.nullValue) ByteBuffer(java.nio.ByteBuffer) AmqpFunctions.falseValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.falseValue) AmqpFunctions.ulong0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong0) AmqpFunctions.intValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.intValue) VALUE(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpBodyKind.VALUE) AmqpFunctions.byteValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.byteValue) AmqpFunctions.booleanValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.booleanValue) AmqpFunctions.shortValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.shortValue) AmqpFunctions.string32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string32) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) AmqpFunctions.charValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.charValue) AmqpFunctions.binary32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary32) AmqpAbortExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpAbortExFW) AmqpFunctions.symbol32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol32) AmqpPropertiesFW(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpPropertiesFW) AmqpFunctions.abortEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.abortEx) AmqpFunctions.propertyTypes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.propertyTypes) AmqpFunctions.timestamp(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.timestamp) DirectBuffer(org.agrona.DirectBuffer) AmqpFunctions.smalllong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalllong) AmqpFunctions.longValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.longValue) ExpressionFactory(javax.el.ExpressionFactory) AmqpFunctions.binary8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary8) AmqpFunctions.randomBytes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomBytes) AmqpFunctions.randomString(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomString) AmqpFunctions.uint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint) AmqpFunctions.dataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.dataEx) AmqpFunctions.matchDataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.matchDataEx) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) AmqpFunctions.trueValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.trueValue) Before(org.junit.Before) AmqpFunctions.string8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string8) AmqpFunctions.ushort(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ushort) AmqpFunctions.ubyte(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ubyte) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) AmqpFunctions.smallulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallulong) Assert.assertTrue(org.junit.Assert.assertTrue) AmqpFunctions.smalluint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalluint) Test(org.junit.Test) AmqpFunctions.smallint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallint) AmqpFunctions.ulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) AmqpFunctions.beginEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.beginEx) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ValueExpression(javax.el.ValueExpression) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 72 with BytesMatcher

use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.

the class AmqpFunctionsTest method shouldMatchAmqpDataExtensionWithOnlyPropertiesWithStringMessageId.

@Test
public void shouldMatchAmqpDataExtensionWithOnlyPropertiesWithStringMessageId() throws Exception {
    BytesMatcher matcher = matchDataEx().typeId(0).messageId("message1").userId("user1").to("clients").build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new AmqpDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0).deliveryTag(b -> b.bytes(b2 -> b2.set("00".getBytes()))).messageFormat(0).flags(1).properties(p -> p.messageId(m -> m.stringtype("message1")).userId(u -> u.bytes(b2 -> b2.set("user1".getBytes()))).to("clients")).bodyKind(b -> b.set(VALUE)).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : AmqpFunctions.uint0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint0) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AmqpFunctions.symbol8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol8) AmqpBeginExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpBeginExFW) AmqpFunctions.nullValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.nullValue) ByteBuffer(java.nio.ByteBuffer) AmqpFunctions.falseValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.falseValue) AmqpFunctions.ulong0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong0) AmqpFunctions.intValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.intValue) VALUE(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpBodyKind.VALUE) AmqpFunctions.byteValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.byteValue) AmqpFunctions.booleanValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.booleanValue) AmqpFunctions.shortValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.shortValue) AmqpFunctions.string32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string32) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) AmqpFunctions.charValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.charValue) AmqpFunctions.binary32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary32) AmqpAbortExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpAbortExFW) AmqpFunctions.symbol32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol32) AmqpPropertiesFW(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpPropertiesFW) AmqpFunctions.abortEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.abortEx) AmqpFunctions.propertyTypes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.propertyTypes) AmqpFunctions.timestamp(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.timestamp) DirectBuffer(org.agrona.DirectBuffer) AmqpFunctions.smalllong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalllong) AmqpFunctions.longValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.longValue) ExpressionFactory(javax.el.ExpressionFactory) AmqpFunctions.binary8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary8) AmqpFunctions.randomBytes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomBytes) AmqpFunctions.randomString(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomString) AmqpFunctions.uint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint) AmqpFunctions.dataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.dataEx) AmqpFunctions.matchDataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.matchDataEx) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) AmqpFunctions.trueValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.trueValue) Before(org.junit.Before) AmqpFunctions.string8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string8) AmqpFunctions.ushort(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ushort) AmqpFunctions.ubyte(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ubyte) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) AmqpFunctions.smallulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallulong) Assert.assertTrue(org.junit.Assert.assertTrue) AmqpFunctions.smalluint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalluint) Test(org.junit.Test) AmqpFunctions.smallint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallint) AmqpFunctions.ulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) AmqpFunctions.beginEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.beginEx) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ValueExpression(javax.el.ValueExpression) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 73 with BytesMatcher

use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.

the class AmqpFunctionsTest method shouldNotMatchAmqpDataExtensionMessageFormat.

@Test(expected = Exception.class)
public void shouldNotMatchAmqpDataExtensionMessageFormat() throws Exception {
    BytesMatcher matcher = matchDataEx().typeId(0).deliveryTag("00").messageFormat(1).flags("SETTLED").bodyKind("VALUE").build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new AmqpDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0).deliveryTag(b -> b.bytes(b2 -> b2.set("00".getBytes()))).messageFormat(0).flags(1).bodyKind(b -> b.set(VALUE)).build();
    matcher.match(byteBuf);
}
Also used : AmqpFunctions.uint0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint0) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AmqpFunctions.symbol8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol8) AmqpBeginExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpBeginExFW) AmqpFunctions.nullValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.nullValue) ByteBuffer(java.nio.ByteBuffer) AmqpFunctions.falseValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.falseValue) AmqpFunctions.ulong0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong0) AmqpFunctions.intValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.intValue) VALUE(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpBodyKind.VALUE) AmqpFunctions.byteValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.byteValue) AmqpFunctions.booleanValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.booleanValue) AmqpFunctions.shortValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.shortValue) AmqpFunctions.string32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string32) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) AmqpFunctions.charValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.charValue) AmqpFunctions.binary32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary32) AmqpAbortExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpAbortExFW) AmqpFunctions.symbol32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol32) AmqpPropertiesFW(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpPropertiesFW) AmqpFunctions.abortEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.abortEx) AmqpFunctions.propertyTypes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.propertyTypes) AmqpFunctions.timestamp(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.timestamp) DirectBuffer(org.agrona.DirectBuffer) AmqpFunctions.smalllong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalllong) AmqpFunctions.longValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.longValue) ExpressionFactory(javax.el.ExpressionFactory) AmqpFunctions.binary8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary8) AmqpFunctions.randomBytes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomBytes) AmqpFunctions.randomString(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomString) AmqpFunctions.uint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint) AmqpFunctions.dataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.dataEx) AmqpFunctions.matchDataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.matchDataEx) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) AmqpFunctions.trueValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.trueValue) Before(org.junit.Before) AmqpFunctions.string8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string8) AmqpFunctions.ushort(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ushort) AmqpFunctions.ubyte(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ubyte) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) AmqpFunctions.smallulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallulong) Assert.assertTrue(org.junit.Assert.assertTrue) AmqpFunctions.smalluint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalluint) Test(org.junit.Test) AmqpFunctions.smallint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallint) AmqpFunctions.ulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) AmqpFunctions.beginEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.beginEx) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ValueExpression(javax.el.ValueExpression) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 74 with BytesMatcher

use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.

the class AmqpFunctionsTest method shouldMatchAmqpDataExtensionWithDeferred.

@Test
public void shouldMatchAmqpDataExtensionWithDeferred() throws Exception {
    BytesMatcher matcher = matchDataEx().typeId(0).deliveryTag("00").messageFormat(0).flags("BATCHABLE", "ABORTED", "RESUME", "SETTLED").bodyKind("VALUE").deferred(100).build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new AmqpDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0).deliveryTag(b -> b.bytes(b2 -> b2.set("00".getBytes()))).messageFormat(0).flags(15).bodyKind(b -> b.set(VALUE)).deferred(100).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : AmqpFunctions.uint0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint0) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AmqpFunctions.symbol8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol8) AmqpBeginExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpBeginExFW) AmqpFunctions.nullValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.nullValue) ByteBuffer(java.nio.ByteBuffer) AmqpFunctions.falseValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.falseValue) AmqpFunctions.ulong0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong0) AmqpFunctions.intValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.intValue) VALUE(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpBodyKind.VALUE) AmqpFunctions.byteValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.byteValue) AmqpFunctions.booleanValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.booleanValue) AmqpFunctions.shortValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.shortValue) AmqpFunctions.string32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string32) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) AmqpFunctions.charValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.charValue) AmqpFunctions.binary32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary32) AmqpAbortExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpAbortExFW) AmqpFunctions.symbol32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol32) AmqpPropertiesFW(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpPropertiesFW) AmqpFunctions.abortEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.abortEx) AmqpFunctions.propertyTypes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.propertyTypes) AmqpFunctions.timestamp(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.timestamp) DirectBuffer(org.agrona.DirectBuffer) AmqpFunctions.smalllong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalllong) AmqpFunctions.longValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.longValue) ExpressionFactory(javax.el.ExpressionFactory) AmqpFunctions.binary8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary8) AmqpFunctions.randomBytes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomBytes) AmqpFunctions.randomString(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomString) AmqpFunctions.uint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint) AmqpFunctions.dataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.dataEx) AmqpFunctions.matchDataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.matchDataEx) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) AmqpFunctions.trueValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.trueValue) Before(org.junit.Before) AmqpFunctions.string8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string8) AmqpFunctions.ushort(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ushort) AmqpFunctions.ubyte(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ubyte) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) AmqpFunctions.smallulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallulong) Assert.assertTrue(org.junit.Assert.assertTrue) AmqpFunctions.smalluint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalluint) Test(org.junit.Test) AmqpFunctions.smallint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallint) AmqpFunctions.ulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) AmqpFunctions.beginEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.beginEx) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ValueExpression(javax.el.ValueExpression) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 75 with BytesMatcher

use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.

the class AmqpFunctionsTest method shouldMatchAmqpDataExtensionWithOnlyPropertiesWithBinaryMessageId.

@Test
public void shouldMatchAmqpDataExtensionWithOnlyPropertiesWithBinaryMessageId() throws Exception {
    BytesMatcher matcher = matchDataEx().typeId(0).messageId("message1".getBytes()).userId("user1").to("clients").subject("subject1").replyTo("localhost").correlationId("correlationId1").contentType("content_type").contentEncoding("content_encoding").absoluteExpiryTime(12345L).creationTime(12345L).groupId("group_id1").groupSequence(1).replyToGroupId("reply_group_id").build();
    ByteBuffer byteBuf = ByteBuffer.allocate(1024);
    new AmqpDataExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0).deliveryTag(b -> b.bytes(b2 -> b2.set("00".getBytes()))).messageFormat(0).flags(1).properties(p -> p.messageId(m -> m.binary(b1 -> b1.bytes(b2 -> b2.set("message1".getBytes())))).userId(u -> u.bytes(b2 -> b2.set("user1".getBytes(UTF_8)))).to("clients").subject("subject1").replyTo("localhost").correlationId(c -> c.stringtype("correlationId1")).contentType("content_type").contentEncoding("content_encoding").absoluteExpiryTime(12345L).creationTime(12345L).groupId("group_id1").groupSequence(1).replyToGroupId("reply_group_id")).bodyKind(b -> b.set(VALUE)).build();
    assertNotNull(matcher.match(byteBuf));
}
Also used : AmqpFunctions.uint0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint0) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) AmqpFunctions.symbol8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol8) AmqpBeginExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpBeginExFW) AmqpFunctions.nullValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.nullValue) ByteBuffer(java.nio.ByteBuffer) AmqpFunctions.falseValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.falseValue) AmqpFunctions.ulong0(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong0) AmqpFunctions.intValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.intValue) VALUE(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpBodyKind.VALUE) AmqpFunctions.byteValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.byteValue) AmqpFunctions.booleanValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.booleanValue) AmqpFunctions.shortValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.shortValue) AmqpFunctions.string32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string32) ExpressionFactoryUtils.newExpressionFactory(org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) AmqpFunctions.charValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.charValue) AmqpFunctions.binary32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary32) AmqpAbortExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpAbortExFW) AmqpFunctions.symbol32(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.symbol32) AmqpPropertiesFW(io.aklivity.zilla.specs.binding.amqp.internal.types.AmqpPropertiesFW) AmqpFunctions.abortEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.abortEx) AmqpFunctions.propertyTypes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.propertyTypes) AmqpFunctions.timestamp(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.timestamp) DirectBuffer(org.agrona.DirectBuffer) AmqpFunctions.smalllong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalllong) AmqpFunctions.longValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.longValue) ExpressionFactory(javax.el.ExpressionFactory) AmqpFunctions.binary8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.binary8) AmqpFunctions.randomBytes(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomBytes) AmqpFunctions.randomString(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.randomString) AmqpFunctions.uint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.uint) AmqpFunctions.dataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.dataEx) AmqpFunctions.matchDataEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.matchDataEx) Assert.assertArrayEquals(org.junit.Assert.assertArrayEquals) AmqpFunctions.trueValue(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.trueValue) Before(org.junit.Before) AmqpFunctions.string8(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.string8) AmqpFunctions.ushort(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ushort) AmqpFunctions.ubyte(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ubyte) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.assertNotNull(org.junit.Assert.assertNotNull) AmqpFunctions.smallulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallulong) Assert.assertTrue(org.junit.Assert.assertTrue) AmqpFunctions.smalluint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smalluint) Test(org.junit.Test) AmqpFunctions.smallint(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.smallint) AmqpFunctions.ulong(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.ulong) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) AmqpFunctions.beginEx(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.beginEx) Assert.assertNull(org.junit.Assert.assertNull) ExpressionContext(org.kaazing.k3po.lang.internal.el.ExpressionContext) ValueExpression(javax.el.ValueExpression) AmqpDataExFW(io.aklivity.zilla.specs.binding.amqp.internal.types.stream.AmqpDataExFW) ELContext(javax.el.ELContext) Assert.assertEquals(org.junit.Assert.assertEquals) AmqpBeginExBuilder(io.aklivity.zilla.specs.binding.amqp.internal.AmqpFunctions.AmqpBeginExBuilder) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) BytesMatcher(org.kaazing.k3po.lang.el.BytesMatcher) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)142 BytesMatcher (org.kaazing.k3po.lang.el.BytesMatcher)142 ByteBuffer (java.nio.ByteBuffer)134 ELContext (javax.el.ELContext)129 DirectBuffer (org.agrona.DirectBuffer)129 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)129 Assert.assertEquals (org.junit.Assert.assertEquals)129 Assert.assertNotNull (org.junit.Assert.assertNotNull)129 Assert.assertNull (org.junit.Assert.assertNull)129 ExpressionContext (org.kaazing.k3po.lang.internal.el.ExpressionContext)129 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)69 Assert.assertTrue (org.junit.Assert.assertTrue)69 Method (java.lang.reflect.Method)65 FunctionMapper (javax.el.FunctionMapper)65 Assert.assertSame (org.junit.Assert.assertSame)65 ExpressionFactory (javax.el.ExpressionFactory)64 ValueExpression (javax.el.ValueExpression)64 Assert.assertArrayEquals (org.junit.Assert.assertArrayEquals)64 Before (org.junit.Before)64 ExpressionFactoryUtils.newExpressionFactory (org.kaazing.k3po.lang.internal.el.ExpressionFactoryUtils.newExpressionFactory)64