Search in sources :

Example 1 with Header

use of org.apache.qpid.proton.amqp.messaging.Header 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 2 with Header

use of org.apache.qpid.proton.amqp.messaging.Header 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 3 with Header

use of org.apache.qpid.proton.amqp.messaging.Header in project activemq-artemis by apache.

the class AMQPMessageTest method testIsDurableFromMessage.

@Test
public void testIsDurableFromMessage() {
    MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
    protonMessage.setHeader(new Header());
    protonMessage.setDurable(true);
    AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
    assertTrue(decoded.isDurable());
}
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 Header

use of org.apache.qpid.proton.amqp.messaging.Header in project activemq-artemis by apache.

the class AMQPMessageTest method testGetTimestampFromMessageWithNoCreateTimeSet.

@Test
public void testGetTimestampFromMessageWithNoCreateTimeSet() {
    MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
    protonMessage.setHeader(new Header());
    AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
    assertEquals(0L, decoded.getTimestamp());
}
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 5 with Header

use of org.apache.qpid.proton.amqp.messaging.Header in project activemq-artemis by apache.

the class AMQPMessageTest method testGetGroupIDFromMessage.

@Test
public void testGetGroupIDFromMessage() {
    final String GROUP_ID = "group-1";
    MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
    protonMessage.setHeader(new Header());
    protonMessage.setGroupId(GROUP_ID);
    AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
    assertEquals(GROUP_ID, decoded.getGroupID().toString());
}
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)

Aggregations

Header (org.apache.qpid.proton.amqp.messaging.Header)19 Test (org.junit.Test)12 AMQPMessage (org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage)11 MessageImpl (org.apache.qpid.proton.message.impl.MessageImpl)10 Properties (org.apache.qpid.proton.amqp.messaging.Properties)8 ApplicationProperties (org.apache.qpid.proton.amqp.messaging.ApplicationProperties)7 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)5 UnsignedInteger (org.apache.qpid.proton.amqp.UnsignedInteger)5 HashMap (java.util.HashMap)4 NettyWritable (org.apache.activemq.artemis.protocol.amqp.util.NettyWritable)3 TypedProperties (org.apache.activemq.artemis.utils.collections.TypedProperties)3 DeliveryAnnotations (org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations)3 MessageAnnotations (org.apache.qpid.proton.amqp.messaging.MessageAnnotations)3 ByteBuf (io.netty.buffer.ByteBuf)2 URI (java.net.URI)2 Date (java.util.Date)2 Connection (javax.jms.Connection)2 Message (javax.jms.Message)2 MessageConsumer (javax.jms.MessageConsumer)2 Session (javax.jms.Session)2