use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties 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.server.protocol.v0_10.transport.MessageProperties 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.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testGroupIdConversion.
public void testGroupIdConversion() {
String testGroupId = generateLongString();
Properties properties = new Properties();
properties.setGroupId(testGroupId);
Message_1_0 message = createTestMessage(properties);
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", testGroupId, applicationHeaders.get("JMSXGroupID"));
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testCorrelationIdUUIDConversion.
public void testCorrelationIdUUIDConversion() {
final UUID correlationId = UUID.randomUUID();
Properties properties = new Properties();
properties.setCorrelationId(correlationId);
Message_1_0 message = createTestMessage(properties);
final MessageTransferMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessageProperties messageProperties = convertedMessage.getStoredMessage().getMetaData().getMessageProperties();
final byte[] expectedBytes = longToBytes(correlationId.getMostSignificantBits(), correlationId.getLeastSignificantBits());
assertTrue("Unexpected correlationId", Arrays.equals(expectedBytes, messageProperties.getCorrelationId()));
}
use of org.apache.qpid.server.protocol.v0_10.transport.MessageProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_10Test method testGroupSequenceDoesNotReplaceApplicationPropertiesJMSXGroupSeq.
public void testGroupSequenceDoesNotReplaceApplicationPropertiesJMSXGroupSeq() {
int testGroupSequence = 1;
Properties properties = new Properties();
properties.setGroupSequence(UnsignedInteger.valueOf(testGroupSequence));
final int JMSXGroupSeq = 2;
Map<String, Object> applicationPropertiesMap = Collections.singletonMap("JMSXGroupSeq", JMSXGroupSeq);
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 JMSXGroupSeq", JMSXGroupSeq, applicationHeaders.get("JMSXGroupSeq"));
}
Aggregations