Search in sources :

Example 26 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testSetObjectFromBoolean.

@Test
public void testSetObjectFromBoolean() throws Exception {
    boolean value = RandomUtil.randomBoolean();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setObject(itemName, value);
    Assert.assertEquals(value, message.getObject(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 27 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromFloat.

@Test
public void testGetStringFromFloat() throws Exception {
    float value = RandomUtil.randomFloat();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setFloat(itemName, value);
    Assert.assertEquals(Float.toString(value), message.getString(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 28 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetCharFromInvalidType.

@Test
public void testGetCharFromInvalidType() throws Exception {
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setFloat(itemName, RandomUtil.randomFloat());
    try {
        message.getChar(itemName);
        Assert.fail("MessageFormatException");
    } catch (MessageFormatException e) {
    }
}
Also used : MessageFormatException(javax.jms.MessageFormatException) ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 29 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetFloatFromFloat.

@Test
public void testGetFloatFromFloat() throws Exception {
    float value = RandomUtil.randomFloat();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setFloat(itemName, value);
    Assert.assertEquals(value, message.getFloat(itemName), 0.000001);
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 30 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromByte.

@Test
public void testGetStringFromByte() throws Exception {
    byte value = RandomUtil.randomByte();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setByte(itemName, value);
    Assert.assertEquals(Byte.toString(value), message.getString(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Aggregations

ActiveMQMapMessage (org.apache.activemq.artemis.jms.client.ActiveMQMapMessage)58 Test (org.junit.Test)57 MessageFormatException (javax.jms.MessageFormatException)9 MapMessage (javax.jms.MapMessage)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