use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testBinaryCorrelationIdConversion.
public void testBinaryCorrelationIdConversion() {
final byte[] correlationId = new byte[] { 0x00, (byte) 0xff, (byte) 0xc3 };
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setCorrelationId(correlationId);
MessageTransferMessage message = createTestMessage(messageProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertTrue(String.format("Unexpected correlationId type. expected 'Binary' actual '%s'", properties.getCorrelationId().getClass().getSimpleName()), properties.getCorrelationId() instanceof Binary);
assertArrayEquals("Unexpected correlationId", correlationId, ((Binary) properties.getCorrelationId()).getArray());
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testContentEncodingConversion.
public void testContentEncodingConversion() {
String contentEncoding = "my-test-encoding";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setContentEncoding(contentEncoding);
MessageTransferMessage message = createTestMessage(new DeliveryProperties(), messageProperties, new byte[] { (byte) 1 }, 0);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected content encoding", contentEncoding, properties.getContentEncoding().toString());
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testTTLConversion.
public void testTTLConversion() {
long timestamp = System.currentTimeMillis();
int ttl = 100000;
final DeliveryProperties deliveryProperties = new DeliveryProperties();
deliveryProperties.setTtl(ttl);
MessageTransferMessage message = createTestMessage(deliveryProperties, new MessageProperties(), null, timestamp);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Header header = convertedMessage.getHeaderSection().getValue();
assertEquals("Unexpected TTL", ttl, header.getTtl().longValue());
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertNull("Unexpected expiration", properties.getAbsoluteExpiryTime());
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testReplyToConversionWhenRoutingKeySpecified.
public void testReplyToConversionWhenRoutingKeySpecified() {
final String routingKey = "test_routing_key";
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setReplyTo(new ReplyTo(null, routingKey));
MessageTransferMessage message = createTestMessage(messageProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected reply-to", routingKey, properties.getReplyTo());
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_10_to_1_0Test method testHeaderWithArrayValueConversionFails.
public void testHeaderWithArrayValueConversionFails() {
Map<String, Object> headers = Collections.singletonMap("listHeader", new int[] { 1 });
final MessageProperties messageProperties = new MessageProperties();
messageProperties.setApplicationHeaders(headers);
MessageTransferMessage message = createTestMessage(messageProperties);
try {
_messageConverter.convert(message, _namedAddressSpace);
fail("Exception is expected");
} catch (MessageConversionException e) {
// pass
}
}
Aggregations