Search in sources :

Example 41 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testCheckItemNameIsNull.

@Test
public void testCheckItemNameIsNull() throws Exception {
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    try {
        message.setBoolean(null, true);
        Assert.fail("item name can not be null");
    } catch (IllegalArgumentException e) {
    }
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 42 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetShortFromInvalidType.

@Test
public void testGetShortFromInvalidType() throws Exception {
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setFloat(itemName, RandomUtil.randomFloat());
    try {
        message.getShort(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 43 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetByteFromString.

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

Example 44 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetIntFromString.

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

Example 45 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetBooleanFromString.

@Test
public void testGetBooleanFromString() throws Exception {
    boolean value = true;
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setString(itemName, Boolean.toString(value));
    Assert.assertEquals(value, message.getBoolean(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