Search in sources :

Example 6 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromString.

@Test
public void testReadStringFromString() throws Exception {
    String value = RandomUtil.randomString();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeString(value);
    message.reset();
    Assert.assertEquals(value, message.readString());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 7 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadIntFromInt.

@Test
public void testReadIntFromInt() throws Exception {
    int value = RandomUtil.randomInt();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeInt(value);
    message.reset();
    Assert.assertEquals(value, message.readInt());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 8 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadFloatFromString.

@Test
public void testReadFloatFromString() throws Exception {
    float value = RandomUtil.randomFloat();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeString(Float.toString(value));
    message.reset();
    Assert.assertEquals(value, message.readFloat(), 0.000001);
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 9 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadLongFromByte.

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

Example 10 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromFloat.

@Test
public void testReadObjectFromFloat() throws Exception {
    float value = RandomUtil.randomFloat();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeFloat(value);
    message.reset();
    Assert.assertEquals(value, message.readObject());
}
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