Search in sources :

Example 51 with ActiveMQStreamMessage

use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.

the class ActiveMQStreamMessageTest method testReadLongFromString.

@Test
public void testReadLongFromString() throws Exception {
    long value = RandomUtil.randomLong();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeString(Long.toString(value));
    message.reset();
    Assert.assertEquals(value, message.readLong());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 52 with ActiveMQStreamMessage

use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.

the class ActiveMQStreamMessageTest method testReadLongFromLong.

@Test
public void testReadLongFromLong() throws Exception {
    long value = RandomUtil.randomLong();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeLong(value);
    message.reset();
    Assert.assertEquals(value, message.readLong());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 53 with ActiveMQStreamMessage

use of org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage in project activemq-artemis by apache.

the class ActiveMQStreamMessageTest method testReadBytesFromBytes_2.

@Test
public void testReadBytesFromBytes_2() throws Exception {
    byte[] value = RandomUtil.randomBytes(512);
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeBytes(value, 0, 256);
    message.reset();
    byte[] v = new byte[256];
    message.readBytes(v);
    ActiveMQTestBase.assertEqualsByteArrays(256, value, v);
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Aggregations

ActiveMQStreamMessage (org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage)53 Test (org.junit.Test)50 MessageFormatException (javax.jms.MessageFormatException)2 MessageEOFException (javax.jms.MessageEOFException)1 StreamMessage (javax.jms.StreamMessage)1 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 ClientMessageImpl (org.apache.activemq.artemis.core.client.impl.ClientMessageImpl)1