use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testMessageIdUUIDConversion.
public void testMessageIdUUIDConversion() {
final UUID messageId = UUID.randomUUID();
Properties properties = new Properties();
properties.setMessageId(messageId);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected messageId", messageId.toString(), convertedProperties.getMessageId().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testSubjectConversion.
public void testSubjectConversion() {
final String subject = "testSubject";
Properties properties = new Properties();
properties.setSubject(subject);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
final Map<String, Object> headers = FieldTable.convertToMap(convertedProperties.getHeaders());
assertEquals("Unexpected qpid.subject is missing from headers", subject, headers.get("qpid.subject"));
assertEquals("Unexpected type", subject, convertedProperties.getType().toString());
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected routing-key", subject, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test 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);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected expiration", expiryTime, convertedProperties.getExpiration());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testMessageIdLongStringConversion.
public void testMessageIdLongStringConversion() {
final String messageId = generateLongString();
Properties properties = new Properties();
properties.setMessageId(messageId);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertNull("Unexpected messageId", convertedProperties.getMessageId());
}
use of org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testReplyToConversionWhenExchangeAndRoutingKeyAreSpecifiedAndGlobalPrefixIsUsed.
public void testReplyToConversionWhenExchangeAndRoutingKeyAreSpecifiedAndGlobalPrefixIsUsed() throws IOException {
final String exchangeName = "testExchnageName";
final String routingKey = "testRoutingKey";
final String globalPrefix = "/testPrefix";
final String replyTo = String.format("%s/%s/%s", globalPrefix, exchangeName, routingKey);
when(_namedAddressSpace.getLocalAddress(replyTo)).thenReturn(exchangeName + "/" + routingKey);
final Exchange exchange = mock(Exchange.class);
when(exchange.getName()).thenReturn(exchangeName);
when(exchange.getType()).thenReturn(ExchangeDefaults.TOPIC_EXCHANGE_CLASS);
when(_namedAddressSpace.getAttainedMessageDestination(exchangeName)).thenReturn(exchange);
Properties properties = new Properties();
properties.setReplyTo(replyTo);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected reply-to", "topic://" + exchangeName + "//?routingkey='" + routingKey + "'", convertedProperties.getReplyToAsString());
}
Aggregations