Search in sources :

Example 41 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromInt.

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

Example 42 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromByte.

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

Example 43 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromDouble.

@Test
public void testReadStringFromDouble() throws Exception {
    double value = RandomUtil.randomDouble();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeDouble(value);
    message.reset();
    Assert.assertEquals(Double.toString(value), message.readString());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 44 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method doReadTypeFromEmptyMessage.

// Private -------------------------------------------------------
private void doReadTypeFromEmptyMessage(final TypeReader reader) throws Exception {
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.reset();
    try {
        reader.readType(message);
        Assert.fail("MessageEOFException");
    } catch (MessageEOFException e) {
    }
}
Also used : MessageEOFException(javax.jms.MessageEOFException) ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage)

Example 45 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromBoolean.

@Test
public void testReadStringFromBoolean() throws Exception {
    boolean value = RandomUtil.randomBoolean();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeBoolean(value);
    message.reset();
    Assert.assertEquals(Boolean.toString(value), message.readString());
}
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