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

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

1. TestConversions#testSimpleConversionBytes()

View license
@Test
public void testSimpleConversionBytes() throws Exception {
    Map<String, Object> mapprop = createPropertiesMap();
    ApplicationProperties properties = new ApplicationProperties(mapprop);
    MessageImpl message = (MessageImpl) Message.Factory.create();
    message.setApplicationProperties(properties);
    byte[] bodyBytes = new byte[4];
    for (int i = 0; i < bodyBytes.length; i++) {
        bodyBytes[i] = (byte) 0xff;
    }
    message.setBody(new Data(new Binary(bodyBytes)));
    EncodedMessage encodedMessage = encodeMessage(message);
    ProtonMessageConverter converter = new ProtonMessageConverter(new SimpleIDGenerator(0));
    ServerJMSBytesMessage serverMessage = (ServerJMSBytesMessage) converter.inboundJMSType(encodedMessage);
    verifyProperties(serverMessage);
    assertEquals(bodyBytes.length, serverMessage.getBodyLength());
    byte[] newBodyBytes = new byte[4];
    serverMessage.readBytes(newBodyBytes);
    Assert.assertArrayEquals(bodyBytes, newBodyBytes);
    Object obj = converter.outbound((ServerMessage) serverMessage.getInnerMessage(), 0);
    System.out.println("output = " + obj);
}