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

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

1. TestConversions#testSimpleConversionStream()

View license
@Test
public void testSimpleConversionStream() throws Exception {
    Map<String, Object> mapprop = createPropertiesMap();
    ApplicationProperties properties = new ApplicationProperties(mapprop);
    MessageImpl message = (MessageImpl) Message.Factory.create();
    message.setApplicationProperties(properties);
    List<Object> objects = new LinkedList<>();
    objects.add(new Integer(10));
    objects.add("10");
    message.setBody(new AmqpSequence(objects));
    EncodedMessage encodedMessage = encodeMessage(message);
    ProtonMessageConverter converter = new ProtonMessageConverter(new SimpleIDGenerator(0));
    ServerJMSStreamMessage serverMessage = (ServerJMSStreamMessage) converter.inboundJMSType(encodedMessage);
    simulatePersistence(serverMessage);
    verifyProperties(serverMessage);
    serverMessage.reset();
    assertEquals(10, serverMessage.readInt());
    assertEquals("10", serverMessage.readString());
    Object obj = converter.outbound((ServerMessage) serverMessage.getInnerMessage(), 0);
    reEncodeMsg(obj);
    MessageImpl outMessage = (MessageImpl) obj;
    List list = ((AmqpSequence) outMessage.getBody()).getValue();
    Assert.assertEquals(Integer.valueOf(10), list.get(0));
    Assert.assertEquals("10", list.get(1));
}