Search in sources :

Example 31 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testJmsTypeConversion.

public void testJmsTypeConversion() {
    final String type = "test-type";
    final Map<String, Object> headers = Collections.singletonMap("x-jms-type", type);
    final MessageProperties messageProperties = new MessageProperties();
    messageProperties.setApplicationHeaders(headers);
    MessageTransferMessage message = createTestMessage(messageProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected subject", type, convertedMessage.getMessageHeader().getType());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 32 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testApplicationIdConversion.

public void testApplicationIdConversion() {
    String applicationId = "testAppId";
    MessageProperties messageProperties = new MessageProperties();
    messageProperties.setAppId(applicationId.getBytes(UTF_8));
    MessageTransferMessage message = createTestMessage(messageProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected app-id", applicationId, convertedMessage.getMessageHeader().getAppId());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageProperties(org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)

Example 33 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testInitialRoutingAddressConversion.

public void testInitialRoutingAddressConversion() {
    final String testExchange = "testExchange";
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setExchange(testExchange);
    final String testRoutingKey = "testRoutingKey";
    deliveryProperties.setRoutingKey(testRoutingKey);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertEquals("Unexpected initial routing address", testRoutingKey, convertedMessage.getInitialRoutingAddress());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)

Example 34 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_0_10_to_InternalTest method testPersistentDeliveryModeConversion.

public void testPersistentDeliveryModeConversion() {
    MessageDeliveryMode deliveryMode = MessageDeliveryMode.PERSISTENT;
    final DeliveryProperties deliveryProperties = new DeliveryProperties();
    deliveryProperties.setDeliveryMode(deliveryMode);
    MessageTransferMessage message = createTestMessage(deliveryProperties);
    final InternalMessage convertedMessage = _messageConverter.convert(message, _namedAddressSpace);
    assertTrue("Unexpected persistence", convertedMessage.isPersistent());
    assertTrue("Unexpected persistence of meta data", convertedMessage.getStoredMessage().getMetaData().isPersistent());
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) DeliveryProperties(org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties) MessageDeliveryMode(org.apache.qpid.server.protocol.v0_10.transport.MessageDeliveryMode)

Example 35 with InternalMessage

use of org.apache.qpid.server.message.internal.InternalMessage in project qpid-broker-j by apache.

the class PropertyConverter_Internal_to_v0_10Test method testToConversionWhenRoutingKeyLengthExceeds255.

public void testToConversionWhenRoutingKeyLengthExceeds255() throws Exception {
    final String testExchange = "testExchange";
    final String testRoutingKey = generateLongString();
    String to = testExchange + "/" + testRoutingKey;
    InternalMessage message = createTestMessage(to);
    try {
        _messageConverter.convert(message, _addressSpace);
        fail("Exception is not thrown");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : InternalMessage(org.apache.qpid.server.message.internal.InternalMessage) MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) Matchers.anyString(org.mockito.Matchers.anyString) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString)

Aggregations

InternalMessage (org.apache.qpid.server.message.internal.InternalMessage)185 AMQMessageHeader (org.apache.qpid.server.message.AMQMessageHeader)60 Matchers.anyString (org.mockito.Matchers.anyString)45 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)36 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)25 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)24 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)23 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)18 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)18 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)17 AmqpValue (org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)15 HashMap (java.util.HashMap)13 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)12 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)9 UUID (java.util.UUID)8 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)8 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)7 Map (java.util.Map)6 Exchange (org.apache.qpid.server.model.Exchange)6 ArrayList (java.util.ArrayList)5