use of org.apache.activemq.artemis.core.client.impl.ClientMessageImpl in project activemq-artemis by apache.
the class ManagementHelperTest method testMapWithArrayValues.
@Test
public void testMapWithArrayValues() throws Exception {
String resource = RandomUtil.randomString();
String operationName = RandomUtil.randomString();
Map<String, Object> map = new HashMap<>();
String key1 = RandomUtil.randomString();
String[] val1 = new String[] { "a", "b", "c" };
ManagementHelperTest.log.info("val1 type is " + Arrays.toString(val1));
String key2 = RandomUtil.randomString();
Long[] val2 = new Long[] { 1L, 2L, 3L, 4L, 5L };
ManagementHelperTest.log.info("val2 type is " + Arrays.toString(val2));
map.put(key1, val1);
map.put(key2, val2);
Object[] params = new Object[] { "hello", map };
ClientMessageImpl msg = new ClientMessageImpl((byte) 0, false, 0, 0, (byte) 4, 1000);
ManagementHelper.putOperationInvocation(msg, resource, operationName, params);
Object[] parameters = ManagementHelper.retrieveOperationParameters(msg);
Assert.assertEquals(params.length, parameters.length);
Assert.assertEquals("hello", parameters[0]);
Map map2 = (Map) parameters[1];
Assert.assertEquals(2, map2.size());
Object[] arr1 = (Object[]) map2.get(key1);
Assert.assertEquals(val1.length, arr1.length);
Assert.assertEquals(arr1[0], val1[0]);
Assert.assertEquals(arr1[1], val1[1]);
Assert.assertEquals(arr1[2], val1[2]);
Object[] arr2 = (Object[]) map2.get(key2);
Assert.assertEquals(val2.length, arr2.length);
Assert.assertEquals(arr2[0], val2[0]);
Assert.assertEquals(arr2[1], val2[1]);
Assert.assertEquals(arr2[2], val2[2]);
}
use of org.apache.activemq.artemis.core.client.impl.ClientMessageImpl in project activemq-artemis by apache.
the class MessageHeaderTest method testCopyOnForeignTextMessage.
@Test
public void testCopyOnForeignTextMessage() throws JMSException {
ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
ClientSession session = new FakeSession(clientMessage);
TextMessage foreignTextMessage = new SimpleJMSTextMessage();
ActiveMQTextMessage copy = new ActiveMQTextMessage(foreignTextMessage, session);
MessageHeaderTestBase.ensureEquivalent(foreignTextMessage, copy);
}
use of org.apache.activemq.artemis.core.client.impl.ClientMessageImpl in project activemq-artemis by apache.
the class MessageHeaderTest method testCopyOnJBossMessage.
@Test
public void testCopyOnJBossMessage() throws JMSException {
ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
ClientSession session = new FakeSession(clientMessage);
ActiveMQMessage jbossMessage = ActiveMQMessage.createMessage(clientMessage, session);
jbossMessage.clearProperties();
MessageHeaderTestBase.configureMessage(jbossMessage);
ActiveMQMessage copy = new ActiveMQMessage(jbossMessage, session);
MessageHeaderTestBase.ensureEquivalent(jbossMessage, copy);
}
use of org.apache.activemq.artemis.core.client.impl.ClientMessageImpl in project activemq-artemis by apache.
the class MessageHeaderTest method testCopyOnForeignObjectMessage.
@Test
public void testCopyOnForeignObjectMessage() throws JMSException {
ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
ClientSession session = new FakeSession(clientMessage);
ObjectMessage foreignObjectMessage = new SimpleJMSObjectMessage();
ActiveMQObjectMessage copy = new ActiveMQObjectMessage(foreignObjectMessage, session, null);
MessageHeaderTestBase.ensureEquivalent(foreignObjectMessage, copy);
}
use of org.apache.activemq.artemis.core.client.impl.ClientMessageImpl in project activemq-artemis by apache.
the class MessageHeaderTest method testCopyOnForeignStreamMessage.
@Test
public void testCopyOnForeignStreamMessage() throws JMSException {
ClientMessage clientMessage = new ClientMessageImpl(ActiveMQTextMessage.TYPE, true, 0, System.currentTimeMillis(), (byte) 4, 1000);
ClientSession session = new FakeSession(clientMessage);
StreamMessage foreignStreamMessage = new SimpleJMSStreamMessage();
foreignStreamMessage.writeByte((byte) 1);
foreignStreamMessage.writeByte((byte) 2);
foreignStreamMessage.writeByte((byte) 3);
ActiveMQStreamMessage copy = new ActiveMQStreamMessage(foreignStreamMessage, session);
MessageHeaderTestBase.ensureEquivalent(foreignStreamMessage, copy);
}
Aggregations