diff --git a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
index 6cc656678535..b01d760db54f 100644
--- a/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
+++ b/conventions/src/main/kotlin/otel.java-conventions.gradle.kts
@@ -102,12 +102,24 @@ dependencies {
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
testImplementation("org.objenesis:objenesis")
- testImplementation("org.spockframework:spock-core")
+ testImplementation("org.spockframework:spock-core") {
+ // exclude optional dependencies
+ exclude(group = "cglib", module = "cglib-nodep")
+ exclude(group = "net.bytebuddy", module = "byte-buddy")
+ exclude(group = "org.junit.platform", module = "junit-platform-testkit")
+ exclude(group = "org.jetbrains", module = "annotations")
+ exclude(group = "org.objenesis", module = "objenesis")
+ exclude(group = "org.ow2.asm", module = "asm")
+ }
+ testImplementation("org.spockframework:spock-junit4") {
+ // spock-core is already added as dependency
+ // exclude it here to avoid pulling in optional dependencies
+ exclude(group = "org.spockframework", module = "spock-core")
+ }
testImplementation("ch.qos.logback:logback-classic")
testImplementation("org.slf4j:log4j-over-slf4j")
testImplementation("org.slf4j:jcl-over-slf4j")
testImplementation("org.slf4j:jul-to-slf4j")
- testImplementation("info.solidsoft.spock:spock-global-unroll")
testImplementation("com.github.stefanbirkner:system-rules")
}
diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts
index 032a4dd35e42..69afcbb9a0da 100644
--- a/dependencyManagement/build.gradle.kts
+++ b/dependencyManagement/build.gradle.kts
@@ -18,7 +18,7 @@ val grpcVersion = "1.41.0"
rootProject.extra["otelVersion"] = otelVersion
// Need both BOM and -all
-val groovyVersion = "2.5.11"
+val groovyVersion = "2.5.14"
rootProject.extra["caffeine2Version"] = "2.9.2"
rootProject.extra["caffeine3Version"] = "3.0.4"
@@ -105,14 +105,14 @@ val DEPENDENCIES = listOf(
"commons-lang:commons-lang:2.6",
"commons-logging:commons-logging:1.2",
"commons-validator:commons-validator:1.7",
- "info.solidsoft.spock:spock-global-unroll:0.5.1",
"io.netty:netty:3.10.6.Final",
"org.assertj:assertj-core:3.21.0",
"org.awaitility:awaitility:4.1.0",
"com.google.code.findbugs:jsr305:3.0.2",
"org.codehaus.groovy:groovy-all:${groovyVersion}",
"org.objenesis:objenesis:3.2",
- "org.spockframework:spock-core:1.3-groovy-2.5",
+ "org.spockframework:spock-core:2.0-groovy-2.5",
+ "org.spockframework:spock-junit4:2.0-groovy-2.5",
"org.scala-lang:scala-library:2.11.12",
"org.springframework.boot:spring-boot-dependencies:2.3.1.RELEASE",
"io.grpc:grpc-netty-shaded:${grpcVersion}"
diff --git a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/SnsCamelTest.groovy b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/SnsCamelTest.groovy
index f3c7fa2b47e0..bc14f5aae2e1 100644
--- a/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/SnsCamelTest.groovy
+++ b/instrumentation/apache-camel-2.20/javaagent/src/test/groovy/io/opentelemetry/javaagent/instrumentation/apachecamel/aws/SnsCamelTest.groovy
@@ -24,7 +24,12 @@ class SnsCamelTest extends AgentInstrumentationSpecification {
String queueName = "snsCamelTest"
def camelApp = new CamelSpringApp(awsConnector, SnsConfig, ImmutableMap.of("topicName", topicName, "queueName", queueName))
- def (queueUrl, topicArn) = setupTestInfrastructure(queueName, topicName)
+ // TODO: def (queueUrl, topicArn) fails to compile, switch back when this is fixed in spock
+ // https://github.com/spockframework/spock/pull/1333
+ // def (queueUrl, topicArn) = setupTestInfrastructure(queueName, topicName)
+ Tuple tuple = setupTestInfrastructure(queueName, topicName)
+ def queueUrl = tuple.get(0)
+ def topicArn = tuple.get(1)
waitAndClearSetupTraces(queueUrl, queueName)
when:
@@ -61,7 +66,12 @@ class SnsCamelTest extends AgentInstrumentationSpecification {
String queueName = "snsCamelTest"
def camelApp = new CamelSpringApp(awsConnector, SnsConfig, ImmutableMap.of("topicName", topicName, "queueName", queueName))
- def (queueUrl, topicArn) = setupTestInfrastructure(queueName, topicName)
+ // TODO: def (queueUrl, topicArn) fails to compile, switch back when this is fixed in spock
+ // https://github.com/spockframework/spock/pull/1333
+ // def (queueUrl, topicArn) = setupTestInfrastructure(queueName, topicName)
+ Tuple tuple = setupTestInfrastructure(queueName, topicName)
+ def queueUrl = tuple.get(0)
+ def topicArn = tuple.get(1)
waitAndClearSetupTraces(queueUrl, queueName)
when:
diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy
index b63538dac8a2..0532f257202b 100644
--- a/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy
+++ b/instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/test_before_1_11_106/groovy/Aws0ClientTest.groovy
@@ -129,17 +129,17 @@ class Aws0ClientTest extends AgentInstrumentationSpecification {
request.request().headers().get("traceparent") == null
where:
- service | operation | method | path | handlerCount | client | additionalAttributes | call | body
- "S3" | "CreateBucket" | "PUT" | "/testbucket/" | 1 | new AmazonS3Client().withEndpoint("${server.httpUri()}") | ["aws.bucket.name": "testbucket"] | { client -> client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); client.createBucket("testbucket") } | ""
- "S3" | "GetObject" | "GET" | "/someBucket/someKey" | 1 | new AmazonS3Client().withEndpoint("${server.httpUri()}") | ["aws.bucket.name": "someBucket"] | { client -> client.getObject("someBucket", "someKey") } | ""
- "EC2" | "AllocateAddress" | "POST" | "/" | 4 | new AmazonEC2Client().withEndpoint("${server.httpUri()}") | [:] | { client -> client.allocateAddress() } | """
+ service | operation | method | path | handlerCount | client | additionalAttributes | call | body
+ "S3" | "CreateBucket" | "PUT" | "/testbucket/" | 1 | new AmazonS3Client().withEndpoint("${server.httpUri()}") | ["aws.bucket.name": "testbucket"] | { c -> c.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); c.createBucket("testbucket") } | ""
+ "S3" | "GetObject" | "GET" | "/someBucket/someKey" | 1 | new AmazonS3Client().withEndpoint("${server.httpUri()}") | ["aws.bucket.name": "someBucket"] | { c -> c.getObject("someBucket", "someKey") } | ""
+ "EC2" | "AllocateAddress" | "POST" | "/" | 4 | new AmazonEC2Client().withEndpoint("${server.httpUri()}") | [:] | { c -> c.allocateAddress() } | """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
192.0.2.1
standard
"""
- "RDS" | "DeleteOptionGroup" | "POST" | "/" | 1 | new AmazonRDSClient().withEndpoint("${server.httpUri()}") | [:] | { client -> client.deleteOptionGroup(new DeleteOptionGroupRequest()) } | """
+ "RDS" | "DeleteOptionGroup" | "POST" | "/" | 1 | new AmazonRDSClient().withEndpoint("${server.httpUri()}") | [:] | { c -> c.deleteOptionGroup(new DeleteOptionGroupRequest()) } | """
0ac9cda2-bbf4-11d3-f92b-31fa5e8dbc99
diff --git a/instrumentation/grpc-1.6/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.groovy b/instrumentation/grpc-1.6/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.groovy
index 32a23775bbae..8b3ae32798b5 100644
--- a/instrumentation/grpc-1.6/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.groovy
+++ b/instrumentation/grpc-1.6/testing/src/main/groovy/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.groovy
@@ -81,7 +81,7 @@ abstract class AbstractGrpcStreamingTest extends InstrumentationSpecification {
GreeterGrpc.GreeterStub client = GreeterGrpc.newStub(channel).withWaitForReady()
when:
- def observer = client.conversation(new StreamObserver() {
+ def observer2 = client.conversation(new StreamObserver() {
@Override
void onNext(Helloworld.Response value) {
clientReceived << value.message
@@ -99,9 +99,9 @@ abstract class AbstractGrpcStreamingTest extends InstrumentationSpecification {
clientRange.each {
def message = Helloworld.Response.newBuilder().setMessage("call $it").build()
- observer.onNext(message)
+ observer2.onNext(message)
}
- observer.onCompleted()
+ observer2.onCompleted()
then:
assertTraces(1) {
diff --git a/instrumentation/gwt-2.0/javaagent/src/test/groovy/GwtTest.groovy b/instrumentation/gwt-2.0/javaagent/src/test/groovy/GwtTest.groovy
index 31438af2fb10..20b66fda921b 100644
--- a/instrumentation/gwt-2.0/javaagent/src/test/groovy/GwtTest.groovy
+++ b/instrumentation/gwt-2.0/javaagent/src/test/groovy/GwtTest.groovy
@@ -51,6 +51,8 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
}
def setupSpec() {
+ setupServer()
+
Testcontainers.exposeHostPorts(port)
browser = new BrowserWebDriverContainer<>()
@@ -62,6 +64,7 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
}
def cleanupSpec() {
+ cleanupServer()
browser?.stop()
}
diff --git a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy
index 09de69f9e820..272695456466 100644
--- a/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy
+++ b/instrumentation/hibernate/hibernate-procedure-call-4.3/javaagent/src/test/groovy/ProcedureCallTest.groovy
@@ -10,7 +10,7 @@ import org.hibernate.SessionFactory
import org.hibernate.cfg.Configuration
import org.hibernate.exception.SQLGrammarException
import org.hibernate.procedure.ProcedureCall
-import org.junit.Assume
+import org.junit.jupiter.api.Assumptions
import spock.lang.Shared
import javax.persistence.ParameterMode
@@ -62,7 +62,7 @@ class ProcedureCallTest extends AgentInstrumentationSpecification {
call.getOutputs()
} catch (Exception exception) {
// ignore failures on hibernate 6 where this functionality has not been implemented yet
- Assume.assumeFalse("org.hibernate.NotYetImplementedFor6Exception" == exception.getClass().getName())
+ Assumptions.assumeFalse("org.hibernate.NotYetImplementedFor6Exception" == exception.getClass().getName())
throw exception
}
}
@@ -127,7 +127,7 @@ class ProcedureCallTest extends AgentInstrumentationSpecification {
ProcedureCall call = session.createStoredProcedureCall("TEST_PROC")
def parameterRegistration = call.registerParameter("nonexistent", Long, ParameterMode.IN)
- Assume.assumeTrue(parameterRegistration.metaClass.getMetaMethod("bindValue", Object) != null)
+ Assumptions.assumeTrue(parameterRegistration.metaClass.getMetaMethod("bindValue", Object) != null)
parameterRegistration.bindValue(420L)
try {
callProcedure(call)
diff --git a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy
index 9b269049c4ae..83f610a4b9ee 100644
--- a/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy
+++ b/instrumentation/http-url-connection/javaagent/src/test/groovy/HttpUrlConnectionTest.groovy
@@ -154,11 +154,11 @@ class HttpUrlConnectionTest extends HttpClientTest implements
setup:
def url = resolveAddress("/success").toURL()
HttpURLConnection connection = runWithSpan("someTrace") {
- HttpURLConnection connection = url.openConnection()
- connection.setRequestProperty("Connection", "close")
+ HttpURLConnection con = url.openConnection()
+ con.setRequestProperty("Connection", "close")
assert Span.current().getSpanContext().isValid()
- assert connection.getResponseCode() == STATUS
- return connection
+ assert con.getResponseCode() == STATUS
+ return con
}
expect:
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/build.gradle.kts b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/build.gradle.kts
index 8235880b215d..72a4deb75413 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/build.gradle.kts
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/build.gradle.kts
@@ -8,9 +8,8 @@ dependencies {
api(project(":testing-common"))
implementation("io.opentelemetry:opentelemetry-api")
- val arquillianVersion = "1.4.0.Final"
- implementation("org.jboss.arquillian.junit:arquillian-junit-container:$arquillianVersion")
+ val arquillianVersion = "1.7.0.Alpha10"
+ implementation("org.jboss.arquillian.junit5:arquillian-junit5-container:$arquillianVersion")
implementation("org.jboss.arquillian.protocol:arquillian-protocol-servlet:$arquillianVersion")
- implementation("org.jboss.arquillian.spock:arquillian-spock-container:1.0.0.CR1")
api("org.jboss.shrinkwrap:shrinkwrap-impl-base:1.2.6")
}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/groovy/ArquillianRestTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/groovy/ArquillianRestTest.groovy
deleted file mode 100644
index 75c75a25dea1..000000000000
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/groovy/ArquillianRestTest.groovy
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
-import io.opentelemetry.testing.internal.armeria.client.WebClient
-import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse
-import org.jboss.arquillian.container.test.api.Deployment
-import org.jboss.arquillian.container.test.api.RunAsClient
-import org.jboss.arquillian.spock.ArquillianSputnik
-import org.jboss.arquillian.test.api.ArquillianResource
-import org.jboss.shrinkwrap.api.ShrinkWrap
-import org.jboss.shrinkwrap.api.asset.EmptyAsset
-import org.jboss.shrinkwrap.api.spec.WebArchive
-import org.junit.runner.RunWith
-import spock.lang.Unroll
-import test.CdiRestResource
-import test.EjbRestResource
-import test.RestApplication
-
-import static io.opentelemetry.api.trace.SpanKind.SERVER
-
-@RunWith(ArquillianSputnik)
-@RunAsClient
-abstract class ArquillianRestTest extends AgentInstrumentationSpecification {
-
- static WebClient client = WebClient.of()
-
- @ArquillianResource
- static URI url
-
- @Deployment
- static WebArchive createDeployment() {
- return ShrinkWrap.create(WebArchive)
- .addClass(RestApplication)
- .addClass(CdiRestResource)
- .addClass(EjbRestResource)
- .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
- }
-
- def getContextRoot() {
- return url.getPath()
- }
-
- @Unroll
- def "test #path"() {
- when:
- AggregatedHttpResponse response = client.get(url.resolve(path).toString()).aggregate().join()
-
- then:
- response.status().code() == 200
- response.contentUtf8() == "hello"
-
- and:
- assertTraces(1) {
- trace(0, 2) {
- span(0) {
- name getContextRoot() + path
- kind SERVER
- hasNoParent()
- }
- span(1) {
- name className + ".hello"
- childOf span(0)
- }
- }
- }
-
- where:
- path | className
- "rest-app/cdiHello" | "CdiRestResource"
- "rest-app/ejbHello" | "EjbRestResource"
- }
-}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/java/AbstractArquillianRestTest.java b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/java/AbstractArquillianRestTest.java
new file mode 100644
index 000000000000..c100aa48675f
--- /dev/null
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-arquillian-testing/src/main/java/AbstractArquillianRestTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
+import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
+import io.opentelemetry.testing.internal.armeria.client.WebClient;
+import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
+import java.net.URI;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import test.CdiRestResource;
+import test.EjbRestResource;
+import test.RestApplication;
+
+@ExtendWith(ArquillianExtension.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@RunAsClient
+public abstract class AbstractArquillianRestTest {
+
+ @RegisterExtension
+ static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
+
+ public final WebClient client = WebClient.of();
+
+ @ArquillianResource public URI url;
+
+ @Deployment
+ static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class)
+ .addClass(RestApplication.class)
+ .addClass(CdiRestResource.class)
+ .addClass(EjbRestResource.class)
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ private String getContextRoot() {
+ return url.getPath();
+ }
+
+ @ParameterizedTest
+ @CsvSource({"rest-app/cdiHello, CdiRestResource", "rest-app/ejbHello, EjbRestResource"})
+ public void testHelloRequest(String path, String className) {
+ AggregatedHttpResponse response = client.get(url.resolve(path).toString()).aggregate().join();
+
+ assertThat(response.status().code()).isEqualTo(200);
+ assertThat(response.contentUtf8()).isEqualTo("hello");
+
+ testing.waitAndAssertTraces(
+ trace ->
+ trace.hasSpansSatisfyingExactly(
+ span ->
+ span.hasName(getContextRoot() + path).hasKind(SpanKind.SERVER).hasNoParent(),
+ span -> span.hasName(className + ".hello").hasParent(trace.getSpan(0))));
+ }
+}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsFilterTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsFilterTest.groovy
index da7c291a1f86..e3dbf25a4052 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsFilterTest.groovy
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsFilterTest.groovy
@@ -5,7 +5,7 @@
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
-import org.junit.Assume
+import org.junit.jupiter.api.Assumptions
import spock.lang.Shared
import spock.lang.Unroll
@@ -51,7 +51,7 @@ abstract class JaxRsFilterTest extends AgentInstrumentationSpecification {
}
def "test #resource, #abortNormal, #abortPrematch"() {
- Assume.assumeTrue(!abortPrematch || testAbortPrematch())
+ Assumptions.assumeTrue(!abortPrematch || testAbortPrematch())
given:
simpleRequestFilter.abort = abortNormal
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsHttpServerTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsHttpServerTest.groovy
index 2df38b723e9a..a52d38ed459f 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsHttpServerTest.groovy
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/testing/src/main/groovy/JaxRsHttpServerTest.groovy
@@ -21,7 +21,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.PATH_PARAM
import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEndpoint.SUCCESS
import static java.util.concurrent.TimeUnit.SECONDS
-import static org.junit.Assume.assumeTrue
+import static org.junit.jupiter.api.Assumptions.assumeTrue
abstract class JaxRsHttpServerTest extends HttpServerTest implements AgentTestTrait {
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent/src/test/groovy/CxfFilterTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent/src/test/groovy/CxfFilterTest.groovy
index 0e5c0492a1b2..2423693b816e 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent/src/test/groovy/CxfFilterTest.groovy
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-cxf-3.2/javaagent/src/test/groovy/CxfFilterTest.groovy
@@ -14,6 +14,14 @@ import static Resource.Test3
class CxfFilterTest extends JaxRsFilterTest implements HttpServerTestTrait {
+ def setupSpec() {
+ setupServer()
+ }
+
+ def cleanupSpec() {
+ cleanupServer()
+ }
+
@Override
boolean testAbortPrematch() {
false
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/groovy/WildflyRestTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/java/PayaraArquillianRestTest.java
similarity index 53%
rename from instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/groovy/WildflyRestTest.groovy
rename to instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/java/PayaraArquillianRestTest.java
index 02a0f4afeda0..162626aa2f27 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/groovy/WildflyRestTest.groovy
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/java/PayaraArquillianRestTest.java
@@ -3,5 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/
-class WildflyRestTest extends ArquillianRestTest {
-}
+public class PayaraArquillianRestTest extends AbstractArquillianRestTest {}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/groovy/TomeeRestTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/groovy/TomeeRestTest.groovy
deleted file mode 100644
index ca40e9f5a514..000000000000
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/groovy/TomeeRestTest.groovy
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import javax.enterprise.inject.Vetoed
-
-// exclude this class from CDI as it causes NullPointerException when tomee is run with jdk8
-@Vetoed
-class TomeeRestTest extends ArquillianRestTest {
-}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/groovy/PayaraRestTest.groovy b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/java/TomeeArquillianRestTest.java
similarity index 53%
rename from instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/groovy/PayaraRestTest.groovy
rename to instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/java/TomeeArquillianRestTest.java
index a561d4d213dc..1e90918f0c27 100644
--- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-payara-testing/src/test/groovy/PayaraRestTest.groovy
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-tomee-testing/src/test/java/TomeeArquillianRestTest.java
@@ -3,5 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/
-class PayaraRestTest extends ArquillianRestTest {
-}
+public class TomeeArquillianRestTest extends AbstractArquillianRestTest {}
diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/java/WildflyArquillianRestTest.java b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/java/WildflyArquillianRestTest.java
new file mode 100644
index 000000000000..c0471ba9d620
--- /dev/null
+++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-wildfly-testing/src/test/java/WildflyArquillianRestTest.java
@@ -0,0 +1,6 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+public class WildflyArquillianRestTest extends AbstractArquillianRestTest {}
diff --git a/instrumentation/jaxws/jaxws-2.0-arquillian-testing/build.gradle.kts b/instrumentation/jaxws/jaxws-2.0-arquillian-testing/build.gradle.kts
index 263e4e140dba..356e58138857 100644
--- a/instrumentation/jaxws/jaxws-2.0-arquillian-testing/build.gradle.kts
+++ b/instrumentation/jaxws/jaxws-2.0-arquillian-testing/build.gradle.kts
@@ -9,9 +9,8 @@ dependencies {
implementation("io.opentelemetry:opentelemetry-api")
implementation("org.jsoup:jsoup:1.13.1")
- val arquillianVersion = "1.4.0.Final"
- implementation("org.jboss.arquillian.junit:arquillian-junit-container:$arquillianVersion")
+ val arquillianVersion = "1.7.0.Alpha10"
+ implementation("org.jboss.arquillian.junit5:arquillian-junit5-container:$arquillianVersion")
implementation("org.jboss.arquillian.protocol:arquillian-protocol-servlet:$arquillianVersion")
- implementation("org.jboss.arquillian.spock:arquillian-spock-container:1.0.0.CR1")
api("org.jboss.shrinkwrap:shrinkwrap-impl-base:1.2.6")
}
diff --git a/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/groovy/ArquillianJaxWsTest.groovy b/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/groovy/ArquillianJaxWsTest.groovy
deleted file mode 100644
index 8935e2bd26ed..000000000000
--- a/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/groovy/ArquillianJaxWsTest.groovy
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
-import io.opentelemetry.instrumentation.test.asserts.TraceAssert
-import io.opentelemetry.sdk.trace.data.SpanData
-import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
-import io.opentelemetry.testing.internal.armeria.client.WebClient
-import org.jboss.arquillian.container.test.api.Deployment
-import org.jboss.arquillian.container.test.api.RunAsClient
-import org.jboss.arquillian.spock.ArquillianSputnik
-import org.jboss.arquillian.test.api.ArquillianResource
-import org.jboss.shrinkwrap.api.ShrinkWrap
-import org.jboss.shrinkwrap.api.asset.EmptyAsset
-import org.jboss.shrinkwrap.api.spec.WebArchive
-import org.jsoup.Jsoup
-import org.junit.runner.RunWith
-import spock.lang.Unroll
-import test.EjbHelloServiceImpl
-import test.HelloService
-import test.HelloServiceImpl
-
-import static io.opentelemetry.api.trace.SpanKind.INTERNAL
-import static io.opentelemetry.api.trace.SpanKind.SERVER
-import static io.opentelemetry.api.trace.StatusCode.ERROR
-
-@RunWith(ArquillianSputnik)
-@RunAsClient
-abstract class ArquillianJaxWsTest extends AgentInstrumentationSpecification {
-
- static WebClient client = WebClient.of()
-
- @ArquillianResource
- static URI url
-
- @Deployment
- static WebArchive createDeployment() {
- return ShrinkWrap.create(WebArchive)
- .addClass(HelloService)
- .addClass(HelloServiceImpl)
- .addClass(EjbHelloServiceImpl)
- .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
- }
-
- def getContextRoot() {
- return url.getPath()
- }
-
- def getServicePath(String service) {
- service
- }
-
- def getAddress(String service) {
- return url.resolve(getServicePath(service)).toString()
- }
-
- @Unroll
- def "test #service"() {
- setup:
- def soapMessage =
- """
-
-
-
- Test
-
-
- """
-
- def response = client.post(getAddress(service), soapMessage).aggregate().join()
- def doc = Jsoup.parse(response.contentUtf8())
-
- expect:
- response.status().code() == 200
- doc.selectFirst("message").text() == "Hello Test"
-
- and:
- def methodName = "hello"
- assertTraces(1) {
- trace(0, 3) {
- serverSpan(it, 0, serverSpanName(service, methodName))
- handlerSpan(it, 1, service, methodName, span(0))
- annotationHandlerSpan(it, 2, service, methodName, span(1))
- }
- }
-
- where:
- service << ["HelloService", "EjbHelloService"]
- }
-
- def serverSpanName(String service, String operation) {
- return getContextRoot() + getServicePath(service) + "/" + service + "/" + operation
- }
-
- static serverSpan(TraceAssert trace, int index, String operation, Throwable exception = null) {
- trace.span(index) {
- hasNoParent()
- name operation
- kind SERVER
- if (exception != null) {
- status ERROR
- }
- }
- }
-
- static handlerSpan(TraceAssert trace, int index, String service, String operation, Object parentSpan = null, Throwable exception = null) {
- trace.span(index) {
- if (parentSpan == null) {
- hasNoParent()
- } else {
- childOf((SpanData) parentSpan)
- }
- name service + "/" + operation
- kind INTERNAL
- if (exception) {
- status ERROR
- errorEvent(exception.class, exception.message)
- }
- }
- }
-
- static annotationHandlerSpan(TraceAssert trace, int index, String service, String methodName, Object parentSpan = null, Throwable exception = null) {
- trace.span(index) {
- if (parentSpan == null) {
- hasNoParent()
- } else {
- childOf((SpanData) parentSpan)
- }
- name service + "Impl." + methodName
- kind INTERNAL
- if (exception) {
- status ERROR
- errorEvent(exception.class, exception.message)
- }
- attributes {
- "${SemanticAttributes.CODE_NAMESPACE.key}" "test." + service + "Impl"
- "${SemanticAttributes.CODE_FUNCTION.key}" methodName
- }
- }
- }
-}
diff --git a/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/java/AbstractArquillianJaxWsTest.java b/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/java/AbstractArquillianJaxWsTest.java
new file mode 100644
index 000000000000..c9370bcc9b0d
--- /dev/null
+++ b/instrumentation/jaxws/jaxws-2.0-arquillian-testing/src/main/java/AbstractArquillianJaxWsTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
+
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
+import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
+import io.opentelemetry.sdk.testing.assertj.SpanDataAssert;
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
+import io.opentelemetry.testing.internal.armeria.client.WebClient;
+import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse;
+import java.net.URI;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import test.EjbHelloServiceImpl;
+import test.HelloService;
+import test.HelloServiceImpl;
+
+@ExtendWith(ArquillianExtension.class)
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@RunAsClient
+public abstract class AbstractArquillianJaxWsTest {
+
+ @RegisterExtension
+ static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
+
+ public final WebClient client = WebClient.of();
+
+ @ArquillianResource public URI url;
+
+ @Deployment
+ static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class)
+ .addClass(HelloService.class)
+ .addClass(HelloServiceImpl.class)
+ .addClass(EjbHelloServiceImpl.class)
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ private String getContextRoot() {
+ return url.getPath();
+ }
+
+ protected String getServicePath(String service) {
+ return service;
+ }
+
+ private String getAddress(String service) {
+ return url.resolve(getServicePath(service)).toString();
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"HelloService", "EjbHelloService"})
+ public void testHelloRequest(String service) {
+ String soapMessage =
+ ""
+ + " "
+ + " "
+ + " "
+ + " Test"
+ + " "
+ + " "
+ + "";
+
+ AggregatedHttpResponse response =
+ client.post(getAddress(service), soapMessage).aggregate().join();
+ Document doc = Jsoup.parse(response.contentUtf8());
+
+ assertThat(response.status().code()).isEqualTo(200);
+ assertThat(doc.selectFirst("message").text()).isEqualTo("Hello Test");
+
+ String methodName = "hello";
+ testing.waitAndAssertTraces(
+ trace ->
+ trace.hasSpansSatisfyingExactly(
+ span -> assertServerSpan(span, serverSpanName(service, methodName)).hasNoParent(),
+ span -> assertHandlerSpan(span, service, methodName).hasParent(trace.getSpan(0)),
+ span ->
+ assertAnnotationHandlerSpan(span, service, methodName)
+ .hasParent(trace.getSpan(1))));
+ }
+
+ private String serverSpanName(String service, String operation) {
+ return getContextRoot() + getServicePath(service) + "/" + service + "/" + operation;
+ }
+
+ private static SpanDataAssert assertServerSpan(SpanDataAssert span, String operation) {
+ return span.hasName(operation).hasKind(SpanKind.SERVER);
+ }
+
+ private static SpanDataAssert assertHandlerSpan(
+ SpanDataAssert span, String service, String methodName) {
+ return span.hasName(service + "/" + methodName).hasKind(SpanKind.INTERNAL);
+ }
+
+ private static SpanDataAssert assertAnnotationHandlerSpan(
+ SpanDataAssert span, String service, String methodName) {
+ return span.hasName(service + "Impl." + methodName)
+ .hasKind(SpanKind.INTERNAL)
+ .hasAttributesSatisfying(
+ attrs -> {
+ assertThat(attrs)
+ .containsEntry(SemanticAttributes.CODE_NAMESPACE, "test." + service + "Impl");
+ assertThat(attrs).containsEntry(SemanticAttributes.CODE_FUNCTION, methodName);
+ });
+ }
+}
diff --git a/instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/AbstractJaxWsTest.groovy b/instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/AbstractJaxWsTest.groovy
index d6c9579c7485..4ed94fec4784 100644
--- a/instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/AbstractJaxWsTest.groovy
+++ b/instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/AbstractJaxWsTest.groovy
@@ -33,10 +33,16 @@ abstract class AbstractJaxWsTest extends AgentInstrumentationSpecification imple
protected WebServiceTemplate webServiceTemplate = new WebServiceTemplate(marshaller)
def setupSpec() {
+ setupServer()
+
marshaller.setPackagesToScan(ClassUtils.getPackageName(HelloRequest))
marshaller.afterPropertiesSet()
}
+ def cleanupSpec() {
+ cleanupServer()
+ }
+
@Override
Server startServer(int port) {
List configurationClasses = new ArrayList<>()
diff --git a/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/groovy/TomeeJaxWsTest.groovy b/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/groovy/TomeeJaxWsTest.groovy
deleted file mode 100644
index 2b244470143d..000000000000
--- a/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/groovy/TomeeJaxWsTest.groovy
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import javax.enterprise.inject.Vetoed
-
-// exclude this class from CDI as it causes NullPointerException when tomee is run with jdk8
-@Vetoed
-class TomeeJaxWsTest extends ArquillianJaxWsTest {
-
- @Override
- def getServicePath(String service) {
- if (service == "EjbHelloService") {
- service = "webservices/EjbHelloServiceImpl"
- }
- return service
- }
-}
diff --git a/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/java/TomeeArquillianJaxWsTest.java b/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/java/TomeeArquillianJaxWsTest.java
new file mode 100644
index 000000000000..83037e4ecb15
--- /dev/null
+++ b/instrumentation/jaxws/jaxws-2.0-tomee-testing/src/test/java/TomeeArquillianJaxWsTest.java
@@ -0,0 +1,15 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+public class TomeeArquillianJaxWsTest extends AbstractArquillianJaxWsTest {
+
+ @Override
+ protected String getServicePath(String service) {
+ if ("EjbHelloService".equals(service)) {
+ service = "webservices/EjbHelloServiceImpl";
+ }
+ return service;
+ }
+}
diff --git a/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/groovy/WildflyJaxWsTest.groovy b/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/groovy/WildflyJaxWsTest.groovy
deleted file mode 100644
index bac06e3d3261..000000000000
--- a/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/groovy/WildflyJaxWsTest.groovy
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-class WildflyJaxWsTest extends ArquillianJaxWsTest {
-
- @Override
- def getServicePath(String service) {
- if (service == "EjbHelloService") {
- service = "EjbHelloService/EjbHelloServiceImpl"
- }
- return service
- }
-}
diff --git a/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/java/WildflyArquillianJaxWsTest.java b/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/java/WildflyArquillianJaxWsTest.java
new file mode 100644
index 000000000000..fc9564097b87
--- /dev/null
+++ b/instrumentation/jaxws/jaxws-2.0-wildfly-testing/src/test/java/WildflyArquillianJaxWsTest.java
@@ -0,0 +1,15 @@
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+public class WildflyArquillianJaxWsTest extends AbstractArquillianJaxWsTest {
+
+ @Override
+ protected String getServicePath(String service) {
+ if ("EjbHelloService".equals(service)) {
+ service = "EjbHelloService/EjbHelloServiceImpl";
+ }
+ return service;
+ }
+}
diff --git a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy
index 91fa3af47a46..30cd5147c970 100644
--- a/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy
+++ b/instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy
@@ -495,15 +495,20 @@ class JdbcInstrumentationTest extends AgentInstrumentationSpecification {
connection = driver.connect(jdbcUrl, null)
}
- def (Statement statement, ResultSet rs) = runWithSpan("parent") {
+ // TODO: def (Statement statement, ResultSet rs) fails to compile, switch back when this is fixed in spock
+ // https://github.com/spockframework/spock/pull/1333
+ // def (Statement statement, ResultSet rs) = runWithSpan("parent") {
+ Tuple tuple = runWithSpan("parent") {
if (prepareStatement) {
- def statement = connection.prepareStatement(query)
- return new Tuple(statement, statement.executeQuery())
+ def stmt = connection.prepareStatement(query)
+ return new Tuple(stmt, stmt.executeQuery())
}
- def statement = connection.createStatement()
- return new Tuple(statement, statement.executeQuery(query))
+ def stmt = connection.createStatement()
+ return new Tuple(stmt, stmt.executeQuery(query))
}
+ Statement statement = tuple.get(0)
+ ResultSet rs = tuple.get(1)
then:
rs.next()
diff --git a/instrumentation/jetty/jetty-11.0/javaagent/src/test/groovy/JettyHandlerTest.groovy b/instrumentation/jetty/jetty-11.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
index ed5a8ac75cf4..020cc90016ea 100644
--- a/instrumentation/jetty/jetty-11.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
+++ b/instrumentation/jetty/jetty-11.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
@@ -29,8 +29,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
class JettyHandlerTest extends HttpServerTest implements AgentTestTrait {
- @Shared
- ErrorHandler errorHandler = new ErrorHandler() {
+ static ErrorHandler errorHandler = new ErrorHandler() {
@Override
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {
Throwable th = (Throwable) request.getAttribute("jakarta.servlet.error.exception")
diff --git a/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/JettyHandlerTest.groovy b/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
index 954d2fcc217e..023387c85981 100644
--- a/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
+++ b/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/JettyHandlerTest.groovy
@@ -30,8 +30,7 @@ import static io.opentelemetry.instrumentation.test.base.HttpServerTest.ServerEn
class JettyHandlerTest extends HttpServerTest implements AgentTestTrait {
- @Shared
- ErrorHandler errorHandler = new ErrorHandler() {
+ static ErrorHandler errorHandler = new ErrorHandler() {
@Override
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {
Throwable th = (Throwable) request.getAttribute("javax.servlet.error.exception")
diff --git a/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/QueuedThreadPoolTest.groovy b/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/QueuedThreadPoolTest.groovy
index ec9d2cddb41d..020e9cc4bad6 100644
--- a/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/QueuedThreadPoolTest.groovy
+++ b/instrumentation/jetty/jetty-8.0/javaagent/src/test/groovy/QueuedThreadPoolTest.groovy
@@ -7,7 +7,7 @@ import io.opentelemetry.api.trace.SpanKind
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import org.eclipse.jetty.util.thread.QueuedThreadPool
-import static org.junit.Assume.assumeTrue
+import static org.junit.jupiter.api.Assumptions.assumeTrue
class QueuedThreadPoolTest extends AgentInstrumentationSpecification {
diff --git a/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy b/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy
index 5f24c2796ccc..55c982ac4c17 100644
--- a/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy
+++ b/instrumentation/jsf/jsf-common/testing/src/main/groovy/BaseJsfTest.groovy
@@ -27,6 +27,14 @@ import static io.opentelemetry.api.trace.StatusCode.ERROR
abstract class BaseJsfTest extends AgentInstrumentationSpecification implements HttpServerTestTrait {
+ def setupSpec() {
+ setupServer()
+ }
+
+ def cleanupSpec() {
+ cleanupServer()
+ }
+
@Override
Server startServer(int port) {
String jsfVersion = getJsfVersion()
diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy
index 29acaf440c28..cf729835620f 100644
--- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy
+++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/test/groovy/LettuceAsyncClientTest.groovy
@@ -230,11 +230,11 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
String successStr = "KEY MISSING"
BiFunction firstStage = new BiFunction() {
@Override
- String apply(String res, Throwable throwable) {
+ String apply(String res, Throwable error) {
runWithSpan("callback1") {
conds.evaluate {
assert res == null
- assert throwable == null
+ assert error == null
}
}
return (res == null ? successStr : res)
@@ -295,7 +295,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
def conds = new AsyncConditions()
BiConsumer biConsumer = new BiConsumer() {
@Override
- void accept(String keyRetrieved, Throwable throwable) {
+ void accept(String keyRetrieved, Throwable error) {
runWithSpan("callback") {
conds.evaluate {
assert keyRetrieved != null
@@ -353,9 +353,9 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
RedisFuture