Search in sources :

Example 56 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetLongFromNull.

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

Example 57 with ActiveMQMapMessage

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

the class ActiveMQMapMessageTest method testGetLongFromString.

@Test
public void testGetLongFromString() throws Exception {
    long value = RandomUtil.randomLong();
    ActiveMQMapMessage message = new ActiveMQMapMessage();
    message.setString(itemName, Long.toString(value));
    Assert.assertEquals(value, message.getLong(itemName));
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) Test(org.junit.Test)

Example 58 with ActiveMQMapMessage

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

the class MessageHeaderTest method testCopyOnForeignMapMessage.

@Test
public void testCopyOnForeignMapMessage() throws JMSException {
    ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
    ClientSession session = new FakeSession(clientMessage);
    MapMessage foreignMapMessage = new SimpleJMSMapMessage();
    foreignMapMessage.setInt("int", 1);
    foreignMapMessage.setString("string", "test");
    ActiveMQMapMessage copy = new ActiveMQMapMessage(foreignMapMessage, session);
    MessageHeaderTestBase.ensureEquivalent(foreignMapMessage, copy);
}
Also used : ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) MapMessage(javax.jms.MapMessage) ActiveMQMapMessage(org.apache.activemq.artemis.jms.client.ActiveMQMapMessage) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientMessageImpl(org.apache.activemq.artemis.core.client.impl.ClientMessageImpl) 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