Search in sources :

Example 76 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method testContentEncodingConversion.

public void testContentEncodingConversion() {
    String contentEncoding = "my-test-encoding";
    BasicContentHeaderProperties header = new BasicContentHeaderProperties();
    header.setEncoding(contentEncoding);
    final AMQMessage originalMessage = createTestMessage(header);
    InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    assertEquals("Unexpected content encoding", contentEncoding, convertedMessage.getMessageHeader().getEncoding());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)

Example 77 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method testHeadersConversion.

public void testHeadersConversion() {
    Map<String, Object> properties = new HashMap<>();
    properties.put("testProperty1", "testProperty1Value");
    properties.put("intProperty", 1);
    BasicContentHeaderProperties header = new BasicContentHeaderProperties();
    header.setHeaders(FieldTable.convertToFieldTable(properties));
    final AMQMessage originalMessage = createTestMessage(header);
    final InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    final Map<String, Object> headers = convertedMessage.getMessageHeader().getHeaderMap();
    assertEquals("Unexpected headers", properties, new HashMap<>(headers));
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) HashMap(java.util.HashMap) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)

Example 78 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method testExpirationConversion.

public void testExpirationConversion() {
    long ttl = 10000;
    long arrivalTime = System.currentTimeMillis();
    long expiryTime = arrivalTime + ttl;
    BasicContentHeaderProperties header = new BasicContentHeaderProperties();
    header.setExpiration(expiryTime);
    final AMQMessage originalMessage = createTestMessage(header, arrivalTime);
    InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    assertEquals("Unexpected expiration", expiryTime, convertedMessage.getMessageHeader().getExpiration());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)

Example 79 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method testReplyToConversionForDirectExchangeAndRoutingKey.

public void testReplyToConversionForDirectExchangeAndRoutingKey() {
    String exchangeName = "amq.direct";
    String routingKey = "testRoutingKey";
    final String replyTo = String.format("%s://%s//?routingkey='%s'", "direct", exchangeName, routingKey);
    BasicContentHeaderProperties header = new BasicContentHeaderProperties();
    header.setReplyTo(replyTo);
    final AMQMessage originalMessage = createTestMessage(header);
    InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    assertEquals("Unexpected replyTo", exchangeName + "/" + routingKey, convertedMessage.getMessageHeader().getReplyTo());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)

Example 80 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_v0_8_to_InternalTest method testUserIdConversion.

public void testUserIdConversion() {
    final String userId = "testUserId";
    BasicContentHeaderProperties header = new BasicContentHeaderProperties();
    header.setUserId(userId);
    final AMQMessage originalMessage = createTestMessage(header);
    InternalMessage convertedMessage = _messageConverter.convert(originalMessage, _addressSpace);
    assertEquals("Unexpected userId", userId, convertedMessage.getMessageHeader().getUserId());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) BasicContentHeaderProperties(org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)

Aggregations

InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)185 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)60 Matchers.anyString (org.mockito.Matchers.anyString)45 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)36 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)25 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)24 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)23 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)18 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)18 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)17 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)15 HashMap (java.util.HashMap)13 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)12 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)9 UUID (java.util.UUID)8 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)8 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)7 Map (java.util.Map)6 Exchange (org.apache.qpid.server.model.Exchange)6 ArrayList (java.util.ArrayList)5