Search in sources :

Example 11 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetLongFromInvalidType.

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

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

the class ActiveMQMapMessageTest method testClearBody.

// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testClearBody() throws Exception {
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setBoolean(itemName, true);
    Assert.assertTrue(message.itemExists(itemName));
    message.clearBody();
    Assert.assertFalse(message.itemExists(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 13 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testCheckItemNameIsEmpty.

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

Example 14 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetLongFromInt.

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

Example 15 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetBooleanFromInvalidType.

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

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