use of org.apache.activemq.command.ActiveMQTextMessage in project activemq-artemis by apache.
the class BrowseOverNetworkTest method browseMessages.
protected int browseMessages(QueueBrowser browser, String name) throws Exception {
Enumeration<?> msgs = browser.getEnumeration();
int browsedMessage = 0;
while (msgs.hasMoreElements()) {
browsedMessage++;
ActiveMQTextMessage message = (ActiveMQTextMessage) msgs.nextElement();
LOG.info(name + " browsed: " + message.getText() + " " + message.getDestination() + " " + message.getMessageId() + " " + Arrays.toString(message.getBrokerPath()));
}
return browsedMessage;
}
use of org.apache.activemq.command.ActiveMQTextMessage in project rocketmq-externals by apache.
the class ReplicatorTest method commitAddGetQueueTest.
@Test
public void commitAddGetQueueTest() {
Message message = new ActiveMQTextMessage();
replicator.commit(message, false);
Assert.assertEquals(replicator.getQueue().poll(), message);
}
use of org.apache.activemq.command.ActiveMQTextMessage in project rocketmq-externals by apache.
the class ActivemqSourceTaskTest method pollTest.
@Test
public void pollTest() throws Exception {
ActivemqSourceTask task = new ActivemqSourceTask();
TextMessage textMessage = new ActiveMQTextMessage();
textMessage.setText("hello rocketmq");
Replicator replicatorObject = Mockito.mock(Replicator.class);
BlockingQueue<Message> queue = new LinkedBlockingQueue<>();
Mockito.when(replicatorObject.getQueue()).thenReturn(queue);
Field replicator = ActivemqSourceTask.class.getDeclaredField("replicator");
replicator.setAccessible(true);
replicator.set(task, replicatorObject);
Field config = ActivemqSourceTask.class.getDeclaredField("config");
config.setAccessible(true);
config.set(task, new Config());
queue.put(textMessage);
Collection<SourceDataEntry> list = task.poll();
Assert.assertEquals(list.size(), 1);
list = task.poll();
Assert.assertEquals(list.size(), 0);
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class PropertyFilterTest method filterProperties_message_empty.
@Test
public void filterProperties_message_empty() {
TextMessage message = new ActiveMQTextMessage();
PropertyFilter.filterProperties(message, Collections.singleton("b3"));
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingJMSConsumerTest method receive_continues_parent_trace_single_header.
@Test
public void receive_continues_parent_trace_single_header() throws Exception {
ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setStringProperty("b3", B3SingleFormat.writeB3SingleFormatWithoutParentId(parent));
receive(message);
// Ensure the current span in on the message, not the parent
MutableSpan consumer = testSpanHandler.takeRemoteSpan(CONSUMER);
assertChildOf(consumer, parent);
TraceContext messageContext = parseB3SingleFormat(message.getStringProperty("b3")).context();
assertThat(messageContext.traceIdString()).isEqualTo(consumer.traceId());
assertThat(messageContext.spanIdString()).isEqualTo(consumer.id());
}
Aggregations