use of org.apache.activemq.command.ActiveMQMapMessage in project nifi by apache.
the class TestJmsConsumer method createMapMessage.
protected static MapMessage createMapMessage() throws JMSException {
MapMessage mapMessage = new ActiveMQMapMessage();
mapMessage.setString("name", "Arnold");
mapMessage.setInt("age", 97);
mapMessage.setDouble("xyz", 89686.564);
mapMessage.setBoolean("good", true);
return mapMessage;
}
use of org.apache.activemq.command.ActiveMQMapMessage in project activemq-artemis by apache.
the class ActiveMQMapMessageTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQMapMessage info = (ActiveMQMapMessage) object;
}
use of org.apache.activemq.command.ActiveMQMapMessage in project activemq-artemis by apache.
the class ActiveMQMapMessageTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQMapMessage info = (ActiveMQMapMessage) object;
}
use of org.apache.activemq.command.ActiveMQMapMessage in project rocketmq-externals by apache.
the class ActivemqSourceTaskTest method getMessageConnentTest.
@Test(expected = RuntimeException.class)
public void getMessageConnentTest() throws JMSException {
String value = "hello rocketmq";
ActivemqSourceTask task = new ActivemqSourceTask();
TextMessage textMessage = new ActiveMQTextMessage();
textMessage.setText(value);
ByteBuffer buffer = task.getMessageConnent(textMessage);
Assert.assertEquals(new String(buffer.array()), textMessage.getText());
ObjectMessage objectMessage = new ActiveMQObjectMessage();
objectMessage.setObject(value);
buffer = task.getMessageConnent(objectMessage);
Assert.assertEquals(new String(buffer.array()), "\"" + objectMessage.getObject().toString() + "\"");
BytesMessage bytes = new ActiveMQBytesMessage();
bytes.writeBytes(value.getBytes());
bytes.reset();
buffer = task.getMessageConnent(bytes);
Assert.assertEquals(new String(buffer.array()), value);
MapMessage mapMessage = new ActiveMQMapMessage();
mapMessage.setString("hello", "rocketmq");
buffer = task.getMessageConnent(mapMessage);
Map<String, String> map = JSON.parseObject(buffer.array(), Map.class);
Assert.assertEquals(map.get("hello"), "rocketmq");
Assert.assertEquals(map.size(), 1);
StreamMessage streamMessage = new ActiveMQStreamMessage();
String valueTwo = null;
for (int i = 0; i < 200; i++) {
valueTwo = valueTwo + value;
}
streamMessage.writeBytes(valueTwo.getBytes());
streamMessage.reset();
buffer = task.getMessageConnent(streamMessage);
Assert.assertEquals(new String(buffer.array()), valueTwo);
task.getMessageConnent(null);
}
Aggregations