Search in sources :

Example 46 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromShort.

@Test
public void testReadStringFromShort() throws Exception {
    short value = RandomUtil.randomShort();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeShort(value);
    message.reset();
    Assert.assertEquals(Short.toString(value), message.readString());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 47 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadIntFromString.

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

Example 48 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadBooleanFromString.

@Test
public void testReadBooleanFromString() throws Exception {
    boolean value = RandomUtil.randomBoolean();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeString(Boolean.toString(value));
    message.reset();
    Assert.assertEquals(value, message.readBoolean());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 49 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadByteFromString.

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

Example 50 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadDoubleFromFloat.

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