Search in sources :

Example 1 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetDoubleFromString.

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

Example 2 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromBoolean.

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

Example 3 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetStringFromChar.

@Test
public void testGetStringFromChar() throws Exception {
    char value = RandomUtil.randomChar();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setChar(itemName, value);
    Assert.assertEquals(Character.toString(value), message.getString(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 4 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetCharFromNull.

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

Example 5 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetBytesFromBytes.

@Test
public void testGetBytesFromBytes() throws Exception {
    byte[] value = RandomUtil.randomBytes();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setBytes(itemName, value);
    ActiveMQTestBase.assertEqualsByteArrays(value, message.getBytes(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