content: /*
   * Copyright The OpenTelemetry Authors
   * SPDX-License-Identifier: Apache-2.0
   */
  
  package io.opentelemetry.javaagent.instrumentation.spring.jms.v6_0;
  
  import static io.opentelemetry.api.trace.SpanKind.CONSUMER;
  import static io.opentelemetry.api.trace.SpanKind.PRODUCER;
  import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
  import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
  import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME;
  import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_MESSAGE_ID;
  import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_OPERATION;
  import static io.opentelemetry.semconv.incubating.MessagingIncubatingAttributes.MESSAGING_SYSTEM;
  
  import org.assertj.core.api.AbstractStringAssert;
  
  class SpringListenerSuppressReceiveSpansTest extends AbstractSpringJmsListenerTest {
  
    @SuppressWarnings("deprecation") // using deprecated semconv
    @Override
    void assertSpringJmsListener() {
      testing.waitAndAssertTraces(
          trace ->
              trace.hasSpansSatisfyingExactly(
                  span -> span.hasName("parent").hasNoParent(),
                  span ->
                      span.hasName("spring-jms-listener publish")
                          .hasKind(PRODUCER)
                          .hasParent(trace.getSpan(0))
                          .hasAttributesSatisfyingExactly(
                              equalTo(MESSAGING_SYSTEM, "jms"),
                              equalTo(MESSAGING_DESTINATION_NAME, "spring-jms-listener"),
                              equalTo(MESSAGING_OPERATION, "publish"),
                              satisfies(MESSAGING_MESSAGE_ID, AbstractStringAssert::isNotBlank)),
                  span ->
                      span.hasName("spring-jms-listener process")
                          .hasKind(CONSUMER)
                          .hasParent(trace.getSpan(1))
                          .hasTotalRecordedLinks(0)
                          .hasAttributesSatisfyingExactly(
                              equalTo(MESSAGING_SYSTEM, "jms"),
                              equalTo(MESSAGING_DESTINATION_NAME, "spring-jms-listener"),
                              equalTo(MESSAGING_OPERATION, "process"),
                              satisfies(MESSAGING_MESSAGE_ID, AbstractStringAssert::isNotBlank)),
                  span -> span.hasName("consumer").hasParent(trace.getSpan(2))));
    }
  }
  