org.apache.activemq.command.ActiveMQTextMessage Java Examples

The following examples show how to use org.apache.activemq.command.ActiveMQTextMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopicClusterTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendReceive() throws Exception {
   for (int i = 0; i < MESSAGE_COUNT; i++) {
      TextMessage textMessage = new ActiveMQTextMessage();
      textMessage.setText("MSG-NO:" + i);
      for (int x = 0; x < producers.length; x++) {
         producers[x].send(textMessage);
      }
   }
   synchronized (receivedMessageCount) {
      while (receivedMessageCount.get() < expectedReceiveCount()) {
         receivedMessageCount.wait(20000);
      }
   }
   // sleep a little - to check we don't get too many messages
   Thread.sleep(2000);
   LOG.info("GOT: " + receivedMessageCount.get() + " Expected: " + expectedReceiveCount());
   Assert.assertEquals("Expected message count not correct", expectedReceiveCount(), receivedMessageCount.get());
}
 
Example #2
Source File: JMSPollingConsumerQueueTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Test Polling Messages From Queue when the JMS Spec Version is 1.1
 *
 * @throws Exception
 */
@Test
public void testPollingMessageFromQueue() throws Exception {
    String queueName = "testQueue1";
    Properties jmsProperties = JMSTestsUtils.getJMSPropertiesForDestination(queueName, PROVIDER_URL, true);
    JMSBrokerController brokerController = new JMSBrokerController(PROVIDER_URL, jmsProperties);
    try {
        brokerController.startProcess();
        brokerController.connect(queueName, true);
        brokerController.pushMessage(SEND_MSG);
        JMSPollingConsumer jmsPollingConsumer = new JMSPollingConsumer(jmsProperties, INTERVAL, INBOUND_EP_NAME);
        Message receivedMsg = JMSTestsUtils.pollMessagesFromDestination(jmsPollingConsumer);
        Assert.assertNotNull("Received message is null", receivedMsg);
        Assert.assertEquals("The send message is not received.", SEND_MSG,
                            ((ActiveMQTextMessage) receivedMsg).getText());
    } finally {
        brokerController.disconnect();
        brokerController.stopProcess();
    }
}
 
Example #3
Source File: Send.java    From netty-chat with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    //创建连接工厂对象
    ConnectionFactory connectionFactory =
            new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
    //获取连接对象
    Connection connection = connectionFactory.createConnection();
    //开启连接
    connection.start();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    //使用Session对象创建Destination对象,其中参数为:消息队列的名称
    javax.jms.Queue queue = session.createQueue("test-queue");
    javax.jms.Queue queue1 = session.createQueue("test-queue1");
    //使用session创建消息生产者对象
    MessageProducer producer = session.createProducer(queue);
    MessageProducer producer1 = session.createProducer(queue1);
    //创建消息对象
    TextMessage message = new ActiveMQTextMessage();
    message.setText("这是一个测试消息");
    //发送消息
    producer.send(message);
    producer1.send(message);
    //关闭资源
    producer.close();
    session.close();
    connection.close();
}
 
Example #4
Source File: JMSPollingConsumerQueueTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Test Polling Messages From Queue when the JMS Spec Version is 1.0
 *
 * @throws Exception
 */
@Test
public void testPollingMessageFromQueueSpecV10() throws Exception {
    String queueName = "testQueue1v20";
    Properties jmsProperties = JMSTestsUtils.getJMSPropertiesForDestination(queueName, PROVIDER_URL, true);
    jmsProperties.put(JMSConstants.PARAM_JMS_SPEC_VER, JMSConstants.JMS_SPEC_VERSION_1_0);
    JMSBrokerController brokerController = new JMSBrokerController(PROVIDER_URL, jmsProperties);
    try {
        brokerController.startProcess();
        brokerController.connect(queueName, true);
        brokerController.pushMessage(SEND_MSG);
        JMSPollingConsumer jmsPollingConsumer = new JMSPollingConsumer(jmsProperties, INTERVAL, INBOUND_EP_NAME);
        Message receivedMsg = JMSTestsUtils.pollMessagesFromDestination(jmsPollingConsumer);
        Assert.assertNotNull("Received message is null", receivedMsg);
        Assert.assertEquals("The send message is not received.", SEND_MSG,
                            ((ActiveMQTextMessage) receivedMsg).getText());
    } finally {
        brokerController.disconnect();
        brokerController.stopProcess();
    }
}
 
Example #5
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testActiveAlarmsMessageConversion() {
  JsonRequest<AlarmValue> request = new ClientRequestImpl<AlarmValue>(
      ClientRequest.ResultType.TRANSFER_ACTIVE_ALARM_LIST,
      ClientRequest.RequestType.ACTIVE_ALARMS_REQUEST,
      10000);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.ACTIVE_ALARMS_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_ACTIVE_ALARM_LIST);
    assertTrue(receivedRequest.getTimeout() == 10000);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #6
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testTransferTagMessageConversion() {
  JsonRequest<TagUpdate> request = new ClientRequestImpl<TagUpdate>(TagUpdate.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.TAG_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_TAG_LIST);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #7
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testAlarmValueMessageConversion() {
  JsonRequest<AlarmValue> request = new ClientRequestImpl<AlarmValue>(AlarmValue.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.ALARM_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_ALARM_LIST);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #8
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testTransferTagValueMessageConversion() {
  JsonRequest<TagValueUpdate> request = new ClientRequestImpl<TagValueUpdate>(TagValueUpdate.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.TAG_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_TAG_VALUE_LIST);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #9
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testTagConfigMessageConversion() {
  JsonRequest<TagConfig> request = new ClientRequestImpl<TagConfig>(TagConfig.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.TAG_CONFIGURATION_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_TAG_CONFIGURATION_LIST);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #10
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testCommandTagHandleMessageConversion() {
  JsonRequest<CommandTagHandle> request = new ClientRequestImpl<CommandTagHandle>(CommandTagHandle.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.COMMAND_HANDLE_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_COMMAND_HANDLES_LIST);
    assertTrue(receivedRequest.requiresObjectResponse());
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #11
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testProcessNamesMessageConversion() {

  ClientRequestImpl<ProcessNameResponse> request = new ClientRequestImpl<ProcessNameResponse>(ProcessNameResponse.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.PROCESS_NAMES_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_PROCESS_NAMES);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #12
Source File: JMSPollingConsumerQueueTest.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Test Polling Messages From Queue when the JMS Spec Version is 2.0
 *
 * @throws Exception
 */
@Test
public void testPollingMessageFromQueueSpecV20() throws Exception {
    String queueName = "testQueue1v20";
    Properties jmsProperties = JMSTestsUtils.getJMSPropertiesForDestination(queueName, PROVIDER_URL, true);
    jmsProperties.put(JMSConstants.PARAM_JMS_SPEC_VER, JMSConstants.JMS_SPEC_VERSION_2_0);
    JMSBrokerController brokerController = new JMSBrokerController(PROVIDER_URL, jmsProperties);
    try {
        brokerController.startProcess();
        brokerController.connect(queueName, true);
        brokerController.pushMessage(SEND_MSG);
        JMSPollingConsumer jmsPollingConsumer = new JMSPollingConsumer(jmsProperties, INTERVAL, INBOUND_EP_NAME);
        Message receivedMsg = JMSTestsUtils.pollMessagesFromDestination(jmsPollingConsumer);
        Assert.assertNotNull("Received message is null", receivedMsg);
        Assert.assertEquals("The send message is not received.", SEND_MSG,
                            ((ActiveMQTextMessage) receivedMsg).getText());
    } finally {
        brokerController.disconnect();
        brokerController.stopProcess();
    }
}
 
Example #13
Source File: NumberRangesWhileMarshallingTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public void testMaxFrameSize() throws Exception {
   OpenWireFormat wf = new OpenWireFormat();
   wf.setMaxFrameSize(10);
   ActiveMQTextMessage msg = new ActiveMQTextMessage();
   msg.setText("This is a test");

   writeObject(msg);
   ds.writeInt(endOfStreamMarker);

   // now lets read from the stream
   ds.close();

   ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray());
   DataInputStream dis = new DataInputStream(in);

   try {
      wf.unmarshal(dis);
   } catch (IOException ioe) {
      return;
   }

   fail("Should fail because of the large frame size");

}
 
Example #14
Source File: DummyMessageQuery.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(ActiveMQDestination destination, MessageListener listener) throws Exception {
   LOG.info("Initial query is creating: " + MESSAGE_COUNT + " messages");
   for (int i = 0; i < MESSAGE_COUNT; i++) {
      ActiveMQTextMessage message = new ActiveMQTextMessage();
      message.setText("Initial message: " + i + " loaded from query");
      listener.onMessage(message);
   }
}
 
Example #15
Source File: ActiveMQMessageConsumerReceiveInterceptor.java    From pinpoint with Apache License 2.0 6 votes vote down vote up
private String getMessage(Object result) {
    final String simpleClassName = result.getClass().getSimpleName();
    try {
        // should we record other message types as well?
        if (result instanceof ActiveMQTextMessage) {

            // could trigger decoding (would it affect the client? if so, we might need to copy first)
            String text = ((ActiveMQTextMessage) result).getText();

            StringBuilder sb = new StringBuilder(simpleClassName);
            sb.append('{').append(text).append('}');
            return sb.toString();
        }
    } catch (JMSException e) {
        // ignore
    }
    return simpleClassName;
}
 
Example #16
Source File: CompressionOverNetworkTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testTextMessageCompression() throws Exception {

   MessageConsumer consumer1 = remoteSession.createConsumer(included);
   MessageProducer producer = localSession.createProducer(included);
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

   waitForConsumerRegistration(localBroker, 1, included);

   StringBuilder payload = new StringBuilder("test-");
   for (int i = 0; i < 100; ++i) {
      payload.append(UUID.randomUUID().toString());
   }

   Message test = localSession.createTextMessage(payload.toString());
   producer.send(test);
   Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
   assertNotNull(msg);
   ActiveMQTextMessage message = (ActiveMQTextMessage) msg;
   assertTrue(message.isCompressed());
   assertEquals(payload.toString(), message.getText());
}
 
Example #17
Source File: CompressionOverNetworkTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Test
public void testCompressedOverCompressedNetwork() throws Exception {

   ActiveMQConnection localAmqConnection = (ActiveMQConnection) localConnection;
   localAmqConnection.setUseCompression(true);

   MessageConsumer consumer1 = remoteSession.createConsumer(included);
   MessageProducer producer = localSession.createProducer(included);
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

   waitForConsumerRegistration(localBroker, 1, included);

   StringBuilder payload = new StringBuilder("test-");
   for (int i = 0; i < 100; ++i) {
      payload.append(UUID.randomUUID().toString());
   }

   Message test = localSession.createTextMessage(payload.toString());
   producer.send(test);
   Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
   assertNotNull(msg);
   ActiveMQTextMessage message = (ActiveMQTextMessage) msg;
   assertTrue(message.isCompressed());
   assertEquals(payload.toString(), message.getText());
}
 
Example #18
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testDevicesMessageConversion() {
  ClientRequestImpl<TransferDevice> request = new ClientRequestImpl<>(TransferDevice.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.DEVICE_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_DEVICE_LIST);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #19
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testDeviceClassNamesMessageConversion() {
  ClientRequestImpl<DeviceClassNameResponse> request = new ClientRequestImpl<>(DeviceClassNameResponse.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.DEVICE_CLASS_NAMES_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_DEVICE_CLASS_NAMES);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #20
Source File: ClientRequestMessageConverterTest.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testExecuteCommandMessageConversion() {
  JsonRequest<CommandReport> request = new ClientRequestImpl<CommandReport>(CommandReport.class);

  TextMessage message = new ActiveMQTextMessage();
  try {
    message.setText(request.toJson());
    ClientRequest receivedRequest = ClientRequestMessageConverter.fromMessage(message);

    assertTrue(receivedRequest.getRequestType() == ClientRequest.RequestType.EXECUTE_COMMAND_REQUEST);
    assertTrue(receivedRequest.getResultType() == ClientRequest.ResultType.TRANSFER_COMMAND_REPORT);
  }
  catch (JMSException e) {
    assertTrue(e.getMessage(), false);
  }
}
 
Example #21
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void listener_has_no_remote_service_name() {
  tracingMessageListener =
    new TracingMessageListener(delegate, jmsTracing, false);

  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  testSpanHandler.takeLocalSpan();
}
 
Example #22
Source File: TracingJMSConsumerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void receive_retains_baggage_properties() throws Exception {
  ActiveMQTextMessage message = new ActiveMQTextMessage();
  B3Propagation.B3_STRING.injector(SETTER).inject(parent, message);
  message.setStringProperty(BAGGAGE_FIELD_KEY, "");

  receive(message);

  assertThat(message.getProperties())
    .containsEntry(BAGGAGE_FIELD_KEY, "");

  testSpanHandler.takeRemoteSpan(CONSUMER);
}
 
Example #23
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void consumer_has_remote_service_name() {
  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  assertThat(testSpanHandler.takeRemoteSpan(CONSUMER).remoteServiceName())
    .isEqualTo(jmsTracing.remoteServiceName);
  testSpanHandler.takeLocalSpan();
}
 
Example #24
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void listener_has_name() {
  tracingMessageListener =
    new TracingMessageListener(delegate, jmsTracing, false);

  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  assertThat(testSpanHandler.takeLocalSpan().name()).isEqualTo("on-message");
}
 
Example #25
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void consumer_and_listener_have_names() {
  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  assertThat(testSpanHandler.takeRemoteSpan(CONSUMER).name()).isEqualTo("receive");
  assertThat(testSpanHandler.takeLocalSpan().name()).isEqualTo("on-message");
}
 
Example #26
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void starts_new_trace_if_none_exists_noConsumer() {
  tracingMessageListener =
    new TracingMessageListener(delegate, jmsTracing, false);

  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  testSpanHandler.takeLocalSpan();
}
 
Example #27
Source File: TracingJMSConsumerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #28
Source File: BrowseOverNetworkTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #29
Source File: JmsCollectorTest.java    From karaf-decanter with Apache License 2.0 5 votes vote down vote up
@Test
public void test() throws Exception {
    Connection connection = null;
    Session session = null;
    try {
        connection = connectionFactory.createConnection();
        connection.start();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(session.createQueue("decanter"));
        ActiveMQMapMessage mapMessage = new ActiveMQMapMessage();
        mapMessage.setString("message", "map");
        producer.send(mapMessage);

        Thread.sleep(200L);

        Assert.assertEquals(1, dispatcher.getPostEvents().size());
        Event event = dispatcher.getPostEvents().get(0);
        Assert.assertEquals("map", event.getProperty("message"));
        Assert.assertEquals("jms", event.getProperty("type"));

        ActiveMQTextMessage textMessage = new ActiveMQTextMessage();
        textMessage.setText("{ \"message\" : \"text\" }");
        producer.send(textMessage);

        Thread.sleep(200L);

        Assert.assertEquals(2, dispatcher.getPostEvents().size());
        event = dispatcher.getPostEvents().get(1);
        Assert.assertEquals("text", event.getProperty("message"));
        Assert.assertEquals("jms", event.getProperty("type"));
    } finally {
        if (session != null) {
            session.close();
        }
        if (connection != null) {
            connection.close();
        }
    }
}
 
Example #30
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void starts_new_trace_if_none_exists() {
  ActiveMQTextMessage message = new ActiveMQTextMessage();
  onMessageConsumed(message);

  testSpanHandler.takeRemoteSpan(CONSUMER);
  testSpanHandler.takeLocalSpan();
}