Search in sources :

Example 26 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadCharFromChar.

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

Example 27 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadObjectFromShort.

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

Example 28 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadBooleanFromBoolean.

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

Example 29 with ActiveMQStreamMessage

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

the class MessageHeaderTest method testCopyOnForeignStreamMessage.

@Test
public void testCopyOnForeignStreamMessage() throws JMSException {
    ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
    ClientSession session = new FakeSession(clientMessage);
    StreamMessage foreignStreamMessage = new SimpleJMSStreamMessage();
    foreignStreamMessage.writeByte((byte) 1);
    foreignStreamMessage.writeByte((byte) 2);
    foreignStreamMessage.writeByte((byte) 3);
    ActiveMQStreamMessage copy = new ActiveMQStreamMessage(foreignStreamMessage, session);
    MessageHeaderTestBase.ensureEquivalent(foreignStreamMessage, copy);
}
Also used : ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) StreamMessage(javax.jms.StreamMessage) ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) ActiveMQStreamMessage(org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientMessageImpl(org.apache.activemq.artemis.core.client.impl.ClientMessageImpl) Test(org.junit.Test)

Example 30 with ActiveMQStreamMessage

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

the class ActiveMQStreamMessageTest method testReadStringFromLong.

@Test
public void testReadStringFromLong() throws Exception {
    long value = RandomUtil.randomLong();
    ActiveMQStreamMessage message = new ActiveMQStreamMessage();
    message.writeLong(value);
    message.reset();
    Assert.assertEquals(Long.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