use of org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testHeaderConversion.
public void testHeaderConversion() {
Map<String, Object> headers = new HashMap<>();
headers.put("testProperty1", "testProperty1Value");
headers.put("intProperty", 1);
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
assertEquals("Unexpected applicationProperties", headers, new HashMap<>(applicationProperties));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testHeaderJMSXGroupSeqConversionWhenWrongType.
public void testHeaderJMSXGroupSeqConversionWhenWrongType() {
Map<String, Object> headers = new HashMap<>();
short testGroupSequenceNumber = (short) 1;
headers.put("JMSXGroupSeq", testGroupSequenceNumber);
headers.put("intProperty", 1);
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected group-sequence", null, properties.getGroupSequence());
Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
assertTrue("JMSXGroupSeq was removed from application properties", applicationProperties.containsKey("JMSXGroupSeq"));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties in project qpid-broker-j by apache.
the class PropertyConverter_0_8_to_1_0Test method testHeaderJMSXGroupIdConversion.
public void testHeaderJMSXGroupIdConversion() {
Map<String, Object> headers = new HashMap<>();
String testGroupId = "testGroupId";
headers.put("JMSXGroupID", testGroupId);
headers.put("intProperty", 1);
BasicContentHeaderProperties basicContentHeaderProperties = new BasicContentHeaderProperties();
basicContentHeaderProperties.setHeaders(FieldTable.convertToFieldTable(headers));
AMQMessage message = createTestMessage(basicContentHeaderProperties);
final Message_1_0 convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
Properties properties = convertedMessage.getPropertiesSection().getValue();
assertEquals("Unexpected group-id", testGroupId, properties.getGroupId());
Map<String, Object> applicationProperties = convertedMessage.getApplicationPropertiesSection().getValue();
assertFalse("Unexpected JMSXGroupID in application properties", applicationProperties.containsKey("JMSXGroupID"));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testApplicationPropertiesConversionWithUuid.
public void testApplicationPropertiesConversionWithUuid() {
Map<String, Object> properties = new HashMap<>();
final String key = "uuidProperty";
properties.put(key, UUID.randomUUID());
ApplicationProperties applicationProperties = new ApplicationProperties(properties);
Message_1_0 message = createTestMessage(applicationProperties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
final Map<String, Object> headers = FieldTable.convertToMap(convertedProperties.getHeaders());
assertEquals("Unexpected headers size", properties.size(), headers.size());
assertEquals("Unexpected headers", properties.get(key), UUID.fromString((String) headers.get(key)));
}
use of org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method createTestMessage.
private Message_1_0 createTestMessage(final Header header, final DeliveryAnnotations deliveryAnnotations, final MessageAnnotations messageAnnotations, final Properties properties, final ApplicationProperties applicationProperties, final long arrivalTime) {
final StoredMessage<MessageMetaData_1_0> storedMessage = mock(StoredMessage.class);
when(storedMessage.getContentSize()).thenReturn(0);
when(storedMessage.getContent(0, 0)).thenReturn(QpidByteBuffer.emptyQpidByteBuffer());
MessageMetaData_1_0 metaData = new MessageMetaData_1_0(header.createEncodingRetainingSection(), deliveryAnnotations.createEncodingRetainingSection(), messageAnnotations.createEncodingRetainingSection(), properties.createEncodingRetainingSection(), applicationProperties.createEncodingRetainingSection(), new Footer(Collections.emptyMap()).createEncodingRetainingSection(), arrivalTime, 0);
when(storedMessage.getMetaData()).thenReturn(metaData);
return new Message_1_0(storedMessage);
}
Aggregations