Search in sources :

Example 16 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromChar.

@Test
public void testReadStringFromChar() throws Exception {
    char value = RandomUtil.randomChar();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeChar(value);
    message.reset();
    Assert.assertEquals(Character.toString(value), message.readString());
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) Test(org.junit.Test)

Example 17 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromByte.

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

Example 18 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromBytes.

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

Example 19 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method doWriteObjectWithType.

private void doWriteObjectWithType(final Object value, final TypeReader reader) throws Exception {
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeObject(value);
    message.reset();
    Object v = reader.readType(message);
    if (value instanceof byte[]) {
        ActiveMQTestBase.assertEqualsByteArrays((byte[]) value, (byte[]) v);
    } else {
        Assert.assertEquals(value, v);
    }
}
Also used : ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage)

Example 20 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testGetType.

// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testGetType() throws Exception {
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    Assert.assertEquals(ActiveMQStreamMessage.TYPE, message.getType());
}
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