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 testMessageIdBinaryConversion.
public void testMessageIdBinaryConversion() {
final String messageId = "testMessageId";
Properties properties = new Properties();
properties.setMessageId(new Binary(messageId.getBytes()));
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected messageId", messageId, 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 testCreationTimeConversion.
public void testCreationTimeConversion() {
final long timestamp = System.currentTimeMillis() - 10000;
final long arrivalTime = timestamp + 1;
Properties properties = new Properties();
properties.setCreationTime(new Date(timestamp));
Message_1_0 message = createTestMessage(new Header(), new DeliveryAnnotations(Collections.emptyMap()), new MessageAnnotations(Collections.emptyMap()), properties, new ApplicationProperties(Collections.emptyMap()), arrivalTime);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected timestamp", timestamp, convertedProperties.getTimestamp());
}
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 testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified.
public void testReplyToConversionWhenExchangeAndRoutingKeyAreSpecified() throws IOException {
final String exchangeName = "testExchnageName";
final String routingKey = "testRoutingKey";
final String replyTo = String.format("%s/%s", 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());
}
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 testUserIdConversionWhenNonUtf8.
public void testUserIdConversionWhenNonUtf8() {
final byte[] userId = new byte[] { (byte) 0xc3, 0x28 };
Properties properties = new Properties();
properties.setUserId(new Binary(userId));
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertTrue("Unexpected user-id", Arrays.equals(userId, convertedProperties.getUserId().getBytes()));
}
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 testCorrelationIdBinaryConversion.
public void testCorrelationIdBinaryConversion() {
final String testCorrelationId = "testCorrelationId";
final Binary correlationId = new Binary(testCorrelationId.getBytes(UTF_8));
Properties properties = new Properties();
properties.setCorrelationId(correlationId);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected correlationId", testCorrelationId, convertedProperties.getCorrelationId().toString());
}
Aggregations