Search in sources :

Example 66 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_10Test method testGroupIdDoesNotReplaceApplicationPropertiesJMSXGroupID.

public void testGroupIdDoesNotReplaceApplicationPropertiesJMSXGroupID() {
    String testGroupId = "group1";
    Properties properties = new Properties();
    properties.setGroupId(testGroupId);
    final String JMSXGroupID = "group2";
    Map<String, Object> applicationPropertiesMap = Collections.singletonMap("JMSXGroupID", JMSXGroupID);
    ApplicationProperties applicationProperties = new ApplicationProperties(applicationPropertiesMap);
    Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, applicationProperties, 0, null);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
    final Map<String, Object> applicationHeaders = messageProperties.getApplicationHeaders();
    assertEquals("Unexpected group-id", JMSXGroupID, applicationHeaders.get("JMSXGroupID"));
}
Also used : Header(org.apache.qpid.server.protocol.v1_0.type.messaging.Header) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) MessageAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations) DeliveryAnnotations(org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 67 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_10Test method testToConversionWhenExchangeAndRoutingKeyIsSpecified.

public void testToConversionWhenExchangeAndRoutingKeyIsSpecified() {
    final String testExchange = "testExchange";
    final String testRoutingKey = "testRoutingKey";
    String to = testExchange + "/" + testRoutingKey;
    Properties properties = new Properties();
    properties.setTo(to);
    Message_1_0 message = createTestMessage(properties);
    final Exchange<?> exchange = mock(Exchange.class);
    when(exchange.getName()).thenReturn(testExchange);
    when(_namedAddressSpace.getAttainedMessageDestination(testExchange)).thenReturn(exchange);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
    assertEquals("Unexpected exchange", testExchange, deliveryProperties.getExchange());
    assertEquals("Unexpected routing key", testRoutingKey, deliveryProperties.getRoutingKey());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 68 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_10Test method testAbsoluteExpiryTimeConversion.

public void testAbsoluteExpiryTimeConversion() {
    long ttl = 10000;
    long arrivalTime = System.currentTimeMillis();
    long expiryTime = arrivalTime + ttl;
    Properties properties = new Properties();
    properties.setAbsoluteExpiryTime(new Date(expiryTime));
    Message_1_0 message = createTestMessage(properties, arrivalTime);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
    assertEquals("Unexpected ttl", ttl, deliveryProperties.getTtl());
    assertEquals("Unexpected expiration", expiryTime, deliveryProperties.getExpiration());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties) Date(java.util.Date)

Example 69 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_10Test method testToConversionWhenGlobalAddressIsKnown.

public void testToConversionWhenGlobalAddressIsKnown() {
    final String queueName = "testQueue";
    final String prefix = "/testPrefix";
    final String globalAddress = prefix + "/" + queueName;
    Properties properties = new Properties();
    properties.setTo(globalAddress);
    Message_1_0 message = createTestMessage(properties);
    final Queue<?> queue = mock(Queue.class);
    when(queue.getName()).thenReturn(queueName);
    when(_namedAddressSpace.getLocalAddress(globalAddress)).thenReturn(queueName);
    when(_namedAddressSpace.getAttainedMessageDestination(queueName)).thenReturn(queue);
    final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final DeliveryProperties deliveryProperties = convertedMessage.getStoredMessage().getMetaData().getDeliveryProperties();
    assertEquals("Unexpected exchange", "", deliveryProperties.getExchange());
    assertEquals("Unexpected routing key", queueName, deliveryProperties.getRoutingKey());
}
Also used : MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 70 with Properties

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Properties in project qpid-broker-j by apache.

the class PropertyConverter_1_0_to_0_10Test method testReplyToConversionWhenExchangeIsSpecified.

public void testReplyToConversionWhenExchangeIsSpecified() throws IOException {
    final String replyTo = "myTestExchange";
    final Exchange exchange = mock(Exchange.class);
    when(exchange.getName()).thenReturn(replyTo);
    when(_namedAddressSpace.getAttainedMessageDestination(replyTo)).thenReturn(exchange);
    Properties properties = new Properties();
    properties.setReplyTo(replyTo);
    Message_1_0 message = createTestMessage(properties);
    MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    final ReplyTo convertedReplyTo = convertedMessage.getHeader().getMessageProperties().getReplyTo();
    assertEquals("Unexpected exchange", replyTo, convertedReplyTo.getExchange());
    assertEquals("Unexpected routing key", "", convertedReplyTo.getRoutingKey());
}
Also used : Exchange(org.apache.qpid.server.model.Exchange) ReplyTo(org.apache.qpid.server.protocol.v0_10.transport.ReplyTo) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Matchers.anyString(org.mockito.Matchers.anyString) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Aggregations

Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)203 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)174 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)156 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)80 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)76 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)68 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)67 Matchers.anyString (org.mockito.Matchers.anyString)67 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)65 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)51 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)50 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)48 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)33 Data (org.apache.qpid.server.protocol.v1_0.type.messaging.Data)27 InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)25 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)18 Header (org.apache.qpid.server.protocol.v1_0.type.messaging.Header)15 Date (java.util.Date)14 MessageAnnotations (org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations)14 HashMap (java.util.HashMap)12