Search in sources :

Example 21 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetLongFromShort.

@Test
public void testGetLongFromShort() throws Exception {
    short value = RandomUtil.randomShort();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setShort(itemName, value);
    Assert.assertEquals(value, message.getLong(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 22 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromInt.

@Test
public void testGetStringFromInt() throws Exception {
    int value = RandomUtil.randomInt();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setInt(itemName, value);
    Assert.assertEquals(Integer.toString(value), message.getString(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 23 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetDoubleFromDouble.

@Test
public void testGetDoubleFromDouble() throws Exception {
    double value = RandomUtil.randomDouble();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setDouble(itemName, value);
    Assert.assertEquals(value, message.getDouble(itemName), 0.000001);
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 24 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetShortFromNull.

@Test
public void testGetShortFromNull() throws Exception {
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    try {
        message.getShort(itemName);
        Assert.fail("NumberFormatException");
    } catch (NumberFormatException e) {
    }
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 25 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromDouble.

@Test
public void testGetStringFromDouble() throws Exception {
    double value = RandomUtil.randomByte();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setDouble(itemName, value);
    Assert.assertEquals(Double.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