Search in sources :

Example 6 with MapToAmqpMapConverter

use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.

the class MessageConverter_0_10_to_1_0Test method testConvertAmqpMapMessageBodyWithNonJmsContent.

public void testConvertAmqpMapMessageBodyWithNonJmsContent() throws Exception {
    final Map<String, Object> expected = Collections.singletonMap("key", Collections.singletonList("nonJmsList"));
    final byte[] messageBytes = new MapToAmqpMapConverter().toMimeContent(expected);
    doTestMapMessage(messageBytes, "amqp/map", expected, null);
}
Also used : MapToAmqpMapConverter(org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter)

Example 7 with MapToAmqpMapConverter

use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_10Test method testDataWithMapMessageAnnotationAndContentTypeAmqpMap.

public void testDataWithMapMessageAnnotationAndContentTypeAmqpMap() throws Exception {
    Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
    byte[] data = new MapToAmqpMapConverter().toMimeContent(originalMap);
    String expectedMimeType = "amqp/map";
    final Data value = new Data(new Binary(data));
    Properties properties = new Properties();
    properties.setContentType(Symbol.valueOf(expectedMimeType));
    Message_1_0 sourceMessage = createTestMessage(properties, MAP_MESSAGE_MESSAGE_ANNOTATION, value.createEncodingRetainingSection());
    final MessageTransferMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", expectedMimeType, convertedMessage.getMessageHeader().getMimeType());
    final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
    assertArrayEquals("Unexpected content", data, getBytes(content));
}
Also used : MapToAmqpMapConverter(org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter) MessageTransferMessage(org.apache.qpid.server.protocol.v0_10.MessageTransferMessage) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Data(org.apache.qpid.server.protocol.v1_0.type.messaging.Data) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)

Example 8 with MapToAmqpMapConverter

use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.

the class MessageConverter_0_8_to_1_0Test method testConvertAmqpMapMessageBodyWithNonJmsContent.

public void testConvertAmqpMapMessageBodyWithNonJmsContent() throws Exception {
    final Map<String, Object> expected = Collections.singletonMap("key", Collections.singletonList("nonJmsList"));
    final byte[] messageBytes = new MapToAmqpMapConverter().toMimeContent(expected);
    doTestMapMessage(messageBytes, "amqp/map", expected, null);
}
Also used : MapToAmqpMapConverter(org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter)

Example 9 with MapToAmqpMapConverter

use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_8Test method testDataWithMapMessageAnnotationAndContentTypeAmqpMap.

public void testDataWithMapMessageAnnotationAndContentTypeAmqpMap() throws Exception {
    Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
    byte[] data = new MapToAmqpMapConverter().toMimeContent(originalMap);
    String expectedMimeType = "amqp/map";
    final Data value = new Data(new Binary(data));
    Properties properties = new Properties();
    properties.setContentType(Symbol.valueOf(expectedMimeType));
    Message_1_0 sourceMessage = createTestMessage(properties, MAP_MESSAGE_MESSAGE_ANNOTATION, value.createEncodingRetainingSection());
    final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", expectedMimeType, convertedMessage.getMessageHeader().getMimeType());
    final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
    assertArrayEquals("Unexpected content", data, getBytes(content));
}
Also used : MapToAmqpMapConverter(org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Data(org.apache.qpid.server.protocol.v1_0.type.messaging.Data) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Example 10 with MapToAmqpMapConverter

use of org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_8Test method testDataWithContentTypeAmqpMap.

public void testDataWithContentTypeAmqpMap() throws Exception {
    Map<String, Object> originalMap = Collections.singletonMap("testKey", "testValue");
    byte[] bytes = new MapToAmqpMapConverter().toMimeContent(originalMap);
    final Data value = new Data(new Binary(bytes));
    Properties properties = new Properties();
    properties.setContentType(Symbol.valueOf("amqp/map"));
    Message_1_0 sourceMessage = createTestMessage(properties, value.createEncodingRetainingSection());
    final AMQMessage convertedMessage = _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
    assertEquals("Unexpected mime type", "amqp/map", convertedMessage.getMessageHeader().getMimeType());
    final QpidByteBuffer content = convertedMessage.getContent(0, (int) convertedMessage.getSize());
    assertArrayEquals("Unexpected content", bytes, getBytes(content));
}
Also used : MapToAmqpMapConverter(org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Data(org.apache.qpid.server.protocol.v1_0.type.messaging.Data) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer) Binary(org.apache.qpid.server.protocol.v1_0.type.Binary) ApplicationProperties(org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties) Properties(org.apache.qpid.server.protocol.v1_0.type.messaging.Properties) AMQMessage(org.apache.qpid.server.protocol.v0_8.AMQMessage)

Aggregations

MapToAmqpMapConverter (org.apache.qpid.server.protocol.v0_10.transport.mimecontentconverter.MapToAmqpMapConverter)12 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)4 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)4 Message_1_0 (org.apache.qpid.server.protocol.v1_0.Message_1_0)4 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)4 ApplicationProperties (org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties)4 Data (org.apache.qpid.server.protocol.v1_0.type.messaging.Data)4 Properties (org.apache.qpid.server.protocol.v1_0.type.messaging.Properties)4 HashMap (java.util.HashMap)2 MessageTransferMessage (org.apache.qpid.server.protocol.v0_10.MessageTransferMessage)2 AMQMessage (org.apache.qpid.server.protocol.v0_8.AMQMessage)2