use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testNonDurableConversion.
public void testNonDurableConversion() {
final Header header = new Header();
header.setDurable(false);
Message_1_0 message = createTestMessage(header);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected deliveryMode", BasicContentHeaderProperties.NON_PERSISTENT, convertedProperties.getDeliveryMode());
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testToConversionWhenExchangeLengthExceeds255.
public void testToConversionWhenExchangeLengthExceeds255() {
final String testExchange = generateLongString();
final String testRoutingKey = "testRoutingKey";
String to = testExchange + "/" + testRoutingKey;
Properties properties = new Properties();
properties.setTo(to);
Message_1_0 message = createTestMessage(properties);
try {
_messageConverter.convert(message, _namedAddressSpace);
fail("Exception is not thrown");
} catch (MessageConversionException e) {
// pass
}
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testSubjectConversionWhenSubjectExceeds255.
public void testSubjectConversionWhenSubjectExceeds255() {
final String subject = generateLongString();
Properties properties = new Properties();
properties.setSubject(subject);
Message_1_0 message = createTestMessage(properties);
try {
_messageConverter.convert(message, _namedAddressSpace);
fail("Expected conversion exception");
} catch (MessageConversionException e) {
// pass
}
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testToConversionWhenQueueIsSpecified.
public void testToConversionWhenQueueIsSpecified() {
final String testQueue = "testQueue";
Properties properties = new Properties();
properties.setTo(testQueue);
Message_1_0 message = createTestMessage(properties);
final Queue queue = mock(Queue.class);
when(queue.getName()).thenReturn(testQueue);
when(_namedAddressSpace.getAttainedMessageDestination(testQueue)).thenReturn(queue);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
final MessagePublishInfo messagePublishInfo = convertedMessage.getMessagePublishInfo();
assertEquals("Unexpected exchange", "", messagePublishInfo.getExchange().toString());
assertEquals("Unexpected routing key", testQueue, messagePublishInfo.getRoutingKey().toString());
}
use of org.apache.qpid.server.protocol.v1_0.Message_1_0 in project qpid-broker-j by apache.
the class PropertyConverter_1_0_to_0_8Test method testMessageIdUUIDConversion.
public void testMessageIdUUIDConversion() {
final UUID messageId = UUID.randomUUID();
Properties properties = new Properties();
properties.setMessageId(messageId);
Message_1_0 message = createTestMessage(properties);
final AMQMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
BasicContentHeaderProperties convertedProperties = convertedMessage.getContentHeaderBody().getProperties();
assertEquals("Unexpected messageId", messageId.toString(), convertedProperties.getMessageId().toString());
}
Aggregations