Search in sources :

Example 31 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testWriteObjectWithNull.

@Test
public void testWriteObjectWithNull() throws Exception {
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeObject(null);
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 32 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromLong.

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

Example 33 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadBytesFromBytes.

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

Example 34 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromDouble.

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

Example 35 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method doReadTypeFromInvalidType.

private void doReadTypeFromInvalidType(final Object invalidValue, final TypeReader reader) throws Exception {
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeObject(invalidValue);
    message.reset();
    try {
        reader.readType(message);
        Assert.fail("MessageFormatException");
    } catch (MessageFormatException e) {
    }
}
Also used : MessageFormatException(javax.jms.MessageFormatException) ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage)

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