diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AbstractServlet3Test.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AbstractServlet3Test.java index c5dbdeee8543..ab29dbd9613b 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AbstractServlet3Test.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/AbstractServlet3Test.java @@ -19,7 +19,6 @@ import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.api.internal.HttpConstants; -import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest; import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions; import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint; @@ -33,12 +32,6 @@ public abstract class AbstractServlet3Test extends AbstractHttpServerTest { - protected final InstrumentationExtension testing; - - public AbstractServlet3Test(InstrumentationExtension testing) { - this.testing = testing; - } - public static final ServerEndpoint HTML_PRINT_WRITER = new ServerEndpoint( "HTML_PRINT_WRITER", @@ -171,17 +164,18 @@ void snippetInjectionWithServletOutputStream() { ExperimentalSnippetHolder.setSnippet(""); String expectedRoute = expectedHttpRoute(HTML_SERVLET_OUTPUT_STREAM, "GET"); - testing.waitAndAssertTraces( - trace -> - trace.hasSpansSatisfyingExactly( - span -> - span.hasName("GET" + (expectedRoute != null ? " " + expectedRoute : "")) - .hasKind(SpanKind.SERVER) - .hasNoParent(), - span -> - span.hasName("controller") - .hasKind(SpanKind.INTERNAL) - .hasParent(trace.getSpan(0)))); + testing() + .waitAndAssertTraces( + trace -> + trace.hasSpansSatisfyingExactly( + span -> + span.hasName("GET" + (expectedRoute != null ? " " + expectedRoute : "")) + .hasKind(SpanKind.SERVER) + .hasNoParent(), + span -> + span.hasName("controller") + .hasKind(SpanKind.INTERNAL) + .hasParent(trace.getSpan(0)))); } @Test @@ -210,16 +204,17 @@ void snippetInjectionWithPrintWriter() { ExperimentalSnippetHolder.setSnippet(""); String expectedRoute = expectedHttpRoute(HTML_PRINT_WRITER, "GET"); - testing.waitAndAssertTraces( - trace -> - trace.hasSpansSatisfyingExactly( - span -> - span.hasName("GET" + (expectedRoute != null ? " " + expectedRoute : "")) - .hasKind(SpanKind.SERVER) - .hasNoParent(), - span -> - span.hasName("controller") - .hasKind(SpanKind.INTERNAL) - .hasParent(trace.getSpan(0)))); + testing() + .waitAndAssertTraces( + trace -> + trace.hasSpansSatisfyingExactly( + span -> + span.hasName("GET" + (expectedRoute != null ? " " + expectedRoute : "")) + .hasKind(SpanKind.SERVER) + .hasNoParent(), + span -> + span.hasName("controller") + .hasKind(SpanKind.INTERNAL) + .hasParent(trace.getSpan(0)))); } } diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServlet3Test.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServlet3Test.java index da7d40d6f5ea..48a540b922bb 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServlet3Test.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServlet3Test.java @@ -36,10 +36,6 @@ public abstract class JettyServlet3Test protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public JettyServlet3Test() { - super(testing); - } - static final boolean IS_BEFORE_94 = isBefore94(); public static boolean isBefore94() { diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServletHandlerTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServletHandlerTest.java index 91d5e9ed23f2..49b72bda72e0 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServletHandlerTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/jetty/JettyServletHandlerTest.java @@ -39,10 +39,6 @@ public class JettyServletHandlerTest extends AbstractServlet3Test servlet() { return TestServlet3.Async.class; diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3FakeAsyncTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3FakeAsyncTest.java index 1625759009ef..de245fc837ab 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3FakeAsyncTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3FakeAsyncTest.java @@ -16,10 +16,6 @@ class TomcatServlet3FakeAsyncTest extends TomcatServlet3Test { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3FakeAsyncTest() { - super(testing); - } - @Override public Class servlet() { return TestServlet3.FakeAsync.class; diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3SyncTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3SyncTest.java index 924500cb38f1..b15b04d4153c 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3SyncTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3SyncTest.java @@ -16,10 +16,6 @@ class TomcatServlet3SyncTest extends TomcatServlet3Test { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3SyncTest() { - super(testing); - } - @Override public Class servlet() { return TestServlet3.Sync.class; diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3Test.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3Test.java index 30147e49c5f4..70170cbf8552 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3Test.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/TomcatServlet3Test.java @@ -12,7 +12,6 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.trace.SpanKind; -import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions; import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint; import io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil; @@ -61,10 +60,6 @@ public abstract class TomcatServlet3Test extends AbstractServlet3Test assertServerSpan(span, "GET", ACCESS_LOG_SUCCESS, SUCCESS.getStatus()), span -> assertControllerSpan(span, null)); - testing.waitAndAssertTraces( - IntStream.range(0, count).mapToObj(i -> check).collect(Collectors.toList())); + testing() + .waitAndAssertTraces( + IntStream.range(0, count).mapToObj(i -> check).collect(Collectors.toList())); - List> traces = TelemetryDataUtil.groupTraces(testing.spans()); + List> traces = TelemetryDataUtil.groupTraces(testing().getExportedSpans()); for (int i = 0; i < count; i++) { assertThat(loggedTraces).contains(traces.get(i).get(0).getTraceId()); @@ -209,7 +205,7 @@ void accessLogHasIdsForErrorRequest() { spanCount++; } - List spanData = TelemetryDataUtil.groupTraces(testing.spans()).get(0); + List spanData = TelemetryDataUtil.groupTraces(testing().getExportedSpans()).get(0); List spans = spanData.stream().map(OpenTelemetryAssertions::assertThat).collect(Collectors.toList()); assertThat(spans).hasSize(spanCount); diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatDispatchTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatDispatchTest.java index aa9ce8cf7fd1..bbcf1374133c 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatDispatchTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatDispatchTest.java @@ -5,16 +5,11 @@ package io.opentelemetry.javaagent.instrumentation.servlet.v3_0.tomcat.dispatch; -import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions; import io.opentelemetry.javaagent.instrumentation.servlet.v3_0.tomcat.TomcatServlet3Test; abstract class TomcatDispatchTest extends TomcatServlet3Test { - public TomcatDispatchTest(InstrumentationExtension testing) { - super(testing); - } - @Override protected void configure(HttpServerTestOptions options) { super.configure(options); diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchAsyncTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchAsyncTest.java index e0aa26201af7..932b0240c7c9 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchAsyncTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchAsyncTest.java @@ -29,10 +29,6 @@ class TomcatServlet3DispatchAsyncTest extends TomcatDispatchTest { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3DispatchAsyncTest() { - super(testing); - } - @Override protected void configure(HttpServerTestOptions options) { super.configure(options); diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchImmediateTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchImmediateTest.java index 25dbd3db2dd8..394b22efe1b9 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchImmediateTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3DispatchImmediateTest.java @@ -29,10 +29,6 @@ class TomcatServlet3DispatchImmediateTest extends TomcatDispatchTest { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3DispatchImmediateTest() { - super(testing); - } - @Override public Class servlet() { return TestServlet3.Sync.class; diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3ForwardTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3ForwardTest.java index 9552fcbf3089..3c66be4068a4 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3ForwardTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3ForwardTest.java @@ -30,10 +30,6 @@ class TomcatServlet3ForwardTest extends TomcatDispatchTest { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3ForwardTest() { - super(testing); - } - @Override public Class servlet() { return TestServlet3.Sync.class; // dispatch to sync servlet diff --git a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3IncludeTest.java b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3IncludeTest.java index ea392d84312e..e6d76ac0c0e4 100644 --- a/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3IncludeTest.java +++ b/instrumentation/servlet/servlet-3.0/javaagent-tests/src/test/java/io/opentelemetry/javaagent/instrumentation/servlet/v3_0/tomcat/dispatch/TomcatServlet3IncludeTest.java @@ -29,10 +29,6 @@ class TomcatServlet3IncludeTest extends TomcatDispatchTest { protected static final InstrumentationExtension testing = HttpServerInstrumentationExtension.forAgent(); - public TomcatServlet3IncludeTest() { - super(testing); - } - @Override public Class servlet() { return TestServlet3.Sync.class; // dispatch to sync servlet