Search in sources :

Example 41 with AMQPMessage

use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.

the class AMQPMessageTest method testIsDurableFromMessageWithNoValueSet.

@Test
public void testIsDurableFromMessageWithNoValueSet() {
    MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
    AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
    assertFalse(decoded.isDurable());
}
Also used : MessageImpl(org.apache.qpid.proton.message.impl.MessageImpl) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 42 with AMQPMessage

use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.

the class AMQPMessageTest method testGetAddressSimpleStringFromMessage.

@Test
public void testGetAddressSimpleStringFromMessage() {
    final String ADDRESS = "myQueue";
    MessageImpl protonMessage = (MessageImpl) Message.Factory.create();
    protonMessage.setHeader(new Header());
    protonMessage.setAddress(ADDRESS);
    AMQPMessage decoded = encodeAndDecodeMessage(protonMessage);
    assertEquals(ADDRESS, decoded.getAddressSimpleString().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)

Example 43 with AMQPMessage

use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.

the class MessageTransformationTest method testHeaderButNoPropertiesEncodeDecode.

@Test
public void testHeaderButNoPropertiesEncodeDecode() throws Exception {
    Message incomingMessage = Proton.message();
    incomingMessage.setBody(new AmqpValue("String payload for AMQP message conversion performance testing."));
    incomingMessage.setDurable(true);
    ICoreMessage core = new AMQPMessage(incomingMessage).toCore();
    Message outboudMessage = AMQPConverter.getInstance().fromCore(core).getProtonMessage();
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Message(org.apache.qpid.proton.message.Message) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Test(org.junit.Test)

Example 44 with AMQPMessage

use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.

the class MessageTransformationTest method testPropertiesButNoHeadersEncodeDecode.

@Test
public void testPropertiesButNoHeadersEncodeDecode() throws Exception {
    Message incomingMessage = Proton.message();
    incomingMessage.setBody(new AmqpValue("String payload for AMQP message conversion performance testing."));
    incomingMessage.setMessageId("ID:SomeQualifier:0:0:1");
    ICoreMessage core = new AMQPMessage(incomingMessage).toCore();
    Message outboudMessage = AMQPConverter.getInstance().fromCore(core).getProtonMessage();
    assertNull(outboudMessage.getHeader());
    assertNotNull(outboudMessage.getProperties());
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Message(org.apache.qpid.proton.message.Message) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Test(org.junit.Test)

Example 45 with AMQPMessage

use of org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage in project activemq-artemis by apache.

the class MessageTransformationTest method testBodyOnlyEncodeDecode.

@Test
public void testBodyOnlyEncodeDecode() throws Exception {
    Message incomingMessage = Proton.message();
    incomingMessage.setBody(new AmqpValue("String payload for AMQP message conversion performance testing."));
    ICoreMessage core = new AMQPMessage(incomingMessage).toCore();
    Message outboudMessage = AMQPConverter.getInstance().fromCore(core).getProtonMessage();
    assertNull(outboudMessage.getHeader());
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Message(org.apache.qpid.proton.message.Message) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) 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