use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.
the class AMQPMessageTest method encodeDelivery.
private AMQPMessage encodeDelivery(AMQPMessage message, int deliveryCount) {
ByteBuf nettyBuffer = Unpooled.buffer(1500);
message.sendBuffer(nettyBuffer, deliveryCount);
byte[] bytes = new byte[nettyBuffer.writerIndex()];
nettyBuffer.readBytes(bytes);
return new AMQPMessage(0, bytes);
}
use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.
the class AMQPMessageTest method testGetUserIDFromMessageWithNoUserID.
@Test
public void testGetUserIDFromMessageWithNoUserID() {
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
assertNull(decoded.getUserID());
}
use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.
the class AMQPMessageTest method testGetPriorityFromMessage.
@Test
public void testGetPriorityFromMessage() {
final short PRIORITY = 7;
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
protonMessage.setHeader(new Header());
protonMessage.setPriority(PRIORITY);
AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
assertEquals(PRIORITY, decoded.getPriority());
}
use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.
the class AMQPMessageTest method testGetUserIDFromMessage.
@Test
public void testGetUserIDFromMessage() {
final String USER_NAME = "foo";
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
protonMessage.setHeader(new Header());
protonMessage.setUserId(USER_NAME.getBytes(StandardCharsets.UTF_8));
AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
assertEquals(USER_NAME, decoded.getAMQPUserID());
}
use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.
the class AMQPMessageTest method testGetAddressFromMessageWithNoValueSet.
@Test
public void testGetAddressFromMessageWithNoValueSet() {
MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
assertNull(decoded.getAddress());
assertNull(decoded.getAddressSimpleString());
}
Aggregations