org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSMapMessage

Here are the examples of the java api class org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSMapMessage taken from open source projects.

1. TestConversions#testSimpleConversionMap()

View license
@Test
public void testSimpleConversionMap() throws Exception {
    Map<String, Object> mapprop = createPropertiesMap();
    ApplicationProperties properties = new ApplicationProperties(mapprop);
    MessageImpl message = (MessageImpl) Message.Factory.create();
    message.setApplicationProperties(properties);
    Map<String, Object> mapValues = new HashMap<>();
    mapValues.put("somestr", "value");
    mapValues.put("someint", Integer.valueOf(1));
    message.setBody(new AmqpValue(mapValues));
    EncodedMessage encodedMessage = encodeMessage(message);
    ProtonMessageConverter converter = new ProtonMessageConverter(new SimpleIDGenerator(0));
    ServerJMSMapMessage serverMessage = (ServerJMSMapMessage) converter.inboundJMSType(encodedMessage);
    verifyProperties(serverMessage);
    Assert.assertEquals(1, serverMessage.getInt("someint"));
    Assert.assertEquals("value", serverMessage.getString("somestr"));
    Object obj = converter.outbound((ServerMessage) serverMessage.getInnerMessage(), 0);
    reEncodeMsg(obj);
    MessageImpl outMessage = (MessageImpl) obj;
    AmqpValue value = (AmqpValue) outMessage.getBody();
    Map mapoutput = (Map) value.getValue();
    assertEquals(Integer.valueOf(1), mapoutput.get("someint"));
    System.out.println("output = " + obj);
}