Search in sources :

Example 1 with AMQPMessage

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);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage)

Example 2 with AMQPMessage

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());
}
Also used : MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 3 with AMQPMessage

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());
}
Also used : Header(org.apache.qpid.proton.amqp.messaging.Header) MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 4 with AMQPMessage

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());
}
Also used : Header(org.apache.qpid.proton.amqp.messaging.Header) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 5 with AMQPMessage

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());
}
Also used : MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Aggregations

AMQPMessage (org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage)57 Test (org.junit.Test)49 ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)35 Message (org.apache.qpid.proton.message.Message)26 MessageImpl (org.apache.qpid.proton.message.impl.MessageImpl)21 ServerJMSBytesMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage)20 ServerJMSMapMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage)20 ServerJMSMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMessage)20 ServerJMSStreamMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage)20 ServerJMSTextMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage)20 TextMessage (javax.jms.TextMessage)19 ServerJMSObjectMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSObjectMessage)19 AmqpValue (org.apache.qpid.proton.amqp.messaging.AmqpValue)19 Header (org.apache.qpid.proton.amqp.messaging.Header)11 ApplicationProperties (org.apache.qpid.proton.amqp.messaging.ApplicationProperties)10 HashMap (java.util.HashMap)9 Binary (org.apache.qpid.proton.amqp.Binary)9 Data (org.apache.qpid.proton.amqp.messaging.Data)6 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)5 ByteBuf (io.netty.buffer.ByteBuf)4