use of org.apache.qpid.amqp_1_0.type.Binary 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.amqp_1_0.type.Binary in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testUserIdConversionWhenLengthExceeds16Bit.
public void testUserIdConversionWhenLengthExceeds16Bit() {
final String userId = generateLongLongString();
Properties properties = new Properties();
properties.setUserId(new Binary(userId.getBytes()));
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertNull("Unexpected user-id", messageProperties.getUserId());
}
use of org.apache.qpid.amqp_1_0.type.Binary in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testUserIdConversion.
public void testUserIdConversion() {
final String userId = "test-userId";
Properties properties = new Properties();
properties.setUserId(new Binary(userId.getBytes()));
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertTrue("Unexpected user-id", Arrays.equals(userId.getBytes(UTF_8), messageProperties.getUserId()));
}
use of org.apache.qpid.amqp_1_0.type.Binary in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testMessageIdBinaryConversionWhenNonUtf8.
public void testMessageIdBinaryConversionWhenNonUtf8() {
final byte[] messageId = new byte[] { (byte) 0xc3, 0x28 };
Properties properties = new Properties();
properties.setMessageId(new Binary(messageId));
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertEquals("Unexpected messageId", UUID.nameUUIDFromBytes(messageId), messageProperties.getMessageId());
}
use of org.apache.qpid.amqp_1_0.type.Binary in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testMessageIdBinaryConversion.
public void testMessageIdBinaryConversion() {
final String messageId = "testMessageId";
Properties properties = new Properties();
properties.setMessageId(new Binary(messageId.getBytes(UTF_8)));
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
assertEquals("Unexpected messageId", UUID.nameUUIDFromBytes(messageId.getBytes(UTF_8)), messageProperties.getMessageId());
}
Aggregations