Don't use HttpServerTest.controller in java tests (#12347)
This commit is contained in:
parent
f0115c6bdc
commit
7f881d07a3
|
|
@ -16,8 +16,8 @@ import io.opentelemetry.instrumentation.testing.junit.http.{
|
|||
ServerEndpoint
|
||||
}
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
|
||||
|
||||
object AkkaHttpTestAsyncWebServer {
|
||||
|
|
@ -31,7 +31,7 @@ object AkkaHttpTestAsyncWebServer {
|
|||
val endpoint = ServerEndpoint.forPath(uri.path.toString())
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
new Supplier[HttpResponse] {
|
||||
new ThrowingSupplier[HttpResponse, Exception] {
|
||||
def get(): HttpResponse = {
|
||||
val resp = HttpResponse(status =
|
||||
endpoint.getStatus
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import akka.stream.ActorMaterializer
|
|||
import akka.stream.scaladsl.Sink
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.Await
|
||||
|
||||
object AkkaHttpTestServerSourceWebServer {
|
||||
|
|
@ -33,7 +33,7 @@ object AkkaHttpTestServerSourceWebServer {
|
|||
},
|
||||
path(INDEXED_CHILD.rawPath()) {
|
||||
parameterMap { map =>
|
||||
val supplier = new Supplier[String] {
|
||||
val supplier = new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
|
|
@ -114,8 +114,8 @@ object AkkaHttpTestServerSourceWebServer {
|
|||
}
|
||||
}
|
||||
|
||||
def supplier(string: String): Supplier[String] = {
|
||||
new Supplier[String] {
|
||||
def supplier(string: String): ThrowingSupplier[String, Exception] = {
|
||||
new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import io.opentelemetry.instrumentation.testing.junit.http.{
|
|||
ServerEndpoint
|
||||
}
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.Await
|
||||
|
||||
object AkkaHttpTestSyncWebServer {
|
||||
|
|
@ -30,7 +30,7 @@ object AkkaHttpTestSyncWebServer {
|
|||
val endpoint = ServerEndpoint.forPath(uri.path.toString())
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
new Supplier[HttpResponse] {
|
||||
new ThrowingSupplier[HttpResponse, Exception] {
|
||||
def get(): HttpResponse = {
|
||||
val resp = HttpResponse(status = endpoint.getStatus)
|
||||
endpoint match {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import akka.http.scaladsl.server.Directives._
|
|||
import akka.stream.ActorMaterializer
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.Await
|
||||
|
||||
object AkkaHttpTestWebServer {
|
||||
|
|
@ -32,7 +32,7 @@ object AkkaHttpTestWebServer {
|
|||
},
|
||||
path(INDEXED_CHILD.rawPath()) {
|
||||
parameterMap { map =>
|
||||
val supplier = new Supplier[String] {
|
||||
val supplier = new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
|
|
@ -107,8 +107,8 @@ object AkkaHttpTestWebServer {
|
|||
}
|
||||
}
|
||||
|
||||
def supplier(string: String): Supplier[String] = {
|
||||
new Supplier[String] {
|
||||
def supplier(string: String): ThrowingSupplier[String, Exception] = {
|
||||
new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,99 +5,74 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.finatra
|
||||
|
||||
import com.twitter.finagle.http.{Request, Response}
|
||||
import com.twitter.finagle.http.Request
|
||||
import com.twitter.finatra.http.Controller
|
||||
import com.twitter.util.Future
|
||||
import groovy.lang.Closure
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
|
||||
import java.util.function.Supplier
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
class FinatraController extends Controller {
|
||||
any(SUCCESS.getPath) { request: Request =>
|
||||
controller(
|
||||
SUCCESS,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
response.ok(SUCCESS.getBody)
|
||||
}
|
||||
}
|
||||
)
|
||||
controller(SUCCESS, supplier(() => response.ok(SUCCESS.getBody)))
|
||||
}
|
||||
|
||||
any(ERROR.getPath) { request: Request =>
|
||||
controller(
|
||||
ERROR,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
response.internalServerError(ERROR.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.internalServerError(ERROR.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(QUERY_PARAM.getPath) { request: Request =>
|
||||
controller(
|
||||
QUERY_PARAM,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
response.ok(QUERY_PARAM.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.ok(QUERY_PARAM.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(EXCEPTION.getPath) { request: Request =>
|
||||
controller(
|
||||
EXCEPTION,
|
||||
new Supplier[Future[Response]] {
|
||||
override def get(): Future[Response] = {
|
||||
throw new Exception(EXCEPTION.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => throw new Exception(EXCEPTION.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(REDIRECT.getPath) { request: Request =>
|
||||
controller(
|
||||
REDIRECT,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
response.found.location(REDIRECT.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.found.location(REDIRECT.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(CAPTURE_HEADERS.getPath) { request: Request =>
|
||||
controller(
|
||||
CAPTURE_HEADERS,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
response
|
||||
.ok(CAPTURE_HEADERS.getBody)
|
||||
.header(
|
||||
"X-Test-Response",
|
||||
request.headerMap.get("X-Test-Request").get
|
||||
)
|
||||
}
|
||||
}
|
||||
supplier(() =>
|
||||
response
|
||||
.ok(CAPTURE_HEADERS.getBody)
|
||||
.header(
|
||||
"X-Test-Response",
|
||||
request.headerMap.get("X-Test-Request").get
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
any(INDEXED_CHILD.getPath) { request: Request =>
|
||||
controller(
|
||||
INDEXED_CHILD,
|
||||
new Supplier[Response] {
|
||||
override def get(): Response = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
request.getParam(name)
|
||||
})
|
||||
response.ok(INDEXED_CHILD.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => {
|
||||
INDEXED_CHILD.collectSpanAttributes((name: String) =>
|
||||
request.getParam(name)
|
||||
)
|
||||
response.ok(INDEXED_CHILD.getBody)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
def supplier[A](action: () => A): ThrowingSupplier[A, Exception] = { () =>
|
||||
{
|
||||
action.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,108 +5,87 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.finatra
|
||||
|
||||
import com.twitter.finagle.http.{Request, Response}
|
||||
import com.twitter.finagle.http.Request
|
||||
import com.twitter.finatra.http.Controller
|
||||
import com.twitter.util.Future
|
||||
import groovy.lang.Closure
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest.controller
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
|
||||
class FinatraController extends Controller {
|
||||
any(SUCCESS.getPath) { request: Request =>
|
||||
controller(
|
||||
SUCCESS,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response.ok(SUCCESS.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.ok(SUCCESS.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(ERROR.getPath) { request: Request =>
|
||||
controller(
|
||||
ERROR,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response.internalServerError(ERROR.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.internalServerError(ERROR.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(QUERY_PARAM.getPath) { request: Request =>
|
||||
controller(
|
||||
QUERY_PARAM,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response.ok(QUERY_PARAM.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.ok(QUERY_PARAM.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(EXCEPTION.getPath) { request: Request =>
|
||||
controller(
|
||||
EXCEPTION,
|
||||
new Closure[Future[Response]](null) {
|
||||
override def call(): Future[Response] = {
|
||||
throw new Exception(EXCEPTION.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => throw new Exception(EXCEPTION.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(REDIRECT.getPath) { request: Request =>
|
||||
controller(
|
||||
REDIRECT,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response.found.location(REDIRECT.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => response.found.location(REDIRECT.getBody))
|
||||
)
|
||||
}
|
||||
|
||||
any(CAPTURE_HEADERS.getPath) { request: Request =>
|
||||
controller(
|
||||
CAPTURE_HEADERS,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response
|
||||
.ok(CAPTURE_HEADERS.getBody)
|
||||
.header(
|
||||
"X-Test-Response",
|
||||
request.headerMap.get("X-Test-Request").get
|
||||
)
|
||||
}
|
||||
}
|
||||
supplier(() =>
|
||||
response
|
||||
.ok(CAPTURE_HEADERS.getBody)
|
||||
.header(
|
||||
"X-Test-Response",
|
||||
request.headerMap.get("X-Test-Request").get
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
any(INDEXED_CHILD.getPath) { request: Request =>
|
||||
controller(
|
||||
INDEXED_CHILD,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
request.getParam(name)
|
||||
})
|
||||
response.ok(INDEXED_CHILD.getBody)
|
||||
}
|
||||
}
|
||||
supplier(() => {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
request.getParam(name)
|
||||
})
|
||||
response.ok(INDEXED_CHILD.getBody)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
any("/path/:id/param") { request: Request =>
|
||||
controller(
|
||||
PATH_PARAM,
|
||||
new Closure[Response](null) {
|
||||
override def call(): Response = {
|
||||
response.ok(request.params("id"))
|
||||
}
|
||||
}
|
||||
supplier(() => response.ok(request.params("id")))
|
||||
)
|
||||
}
|
||||
|
||||
def supplier[A](action: () => A): ThrowingSupplier[A, Exception] = {
|
||||
new ThrowingSupplier[A, Exception] {
|
||||
def get(): A = {
|
||||
action.apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ package test
|
|||
|
||||
import grails.artefact.Controller
|
||||
import grails.web.Action
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingRunnable
|
||||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.CAPTURE_HEADERS
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.ERROR
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION
|
||||
|
|
@ -82,4 +84,8 @@ class TestController implements Controller {
|
|||
render INDEXED_CHILD.body
|
||||
}
|
||||
}
|
||||
|
||||
private static void controller(ServerEndpoint endpoint, ThrowingRunnable action) {
|
||||
AbstractHttpServerTest.controller(endpoint, action)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,28 +31,26 @@ object PekkoHttpTestAsyncWebServer {
|
|||
val endpoint = ServerEndpoint.forPath(uri.path.toString())
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
new Supplier[HttpResponse] {
|
||||
def get(): HttpResponse = {
|
||||
val resp = HttpResponse(status =
|
||||
endpoint.getStatus
|
||||
) // .withHeaders(headers.Type)resp.contentType = "text/plain"
|
||||
endpoint match {
|
||||
case SUCCESS => resp.withEntity(endpoint.getBody)
|
||||
case INDEXED_CHILD =>
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
uri.query().get(name).orNull
|
||||
})
|
||||
resp.withEntity("")
|
||||
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
|
||||
case REDIRECT =>
|
||||
resp.withHeaders(headers.Location(endpoint.getBody))
|
||||
case ERROR => resp.withEntity(endpoint.getBody)
|
||||
case EXCEPTION => throw new Exception(endpoint.getBody)
|
||||
case _ =>
|
||||
HttpResponse(status = NOT_FOUND.getStatus)
|
||||
.withEntity(NOT_FOUND.getBody)
|
||||
}
|
||||
() => {
|
||||
val resp = HttpResponse(status =
|
||||
endpoint.getStatus
|
||||
) // .withHeaders(headers.Type)resp.contentType = "text/plain"
|
||||
endpoint match {
|
||||
case SUCCESS => resp.withEntity(endpoint.getBody)
|
||||
case INDEXED_CHILD =>
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
uri.query().get(name).orNull
|
||||
})
|
||||
resp.withEntity("")
|
||||
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
|
||||
case REDIRECT =>
|
||||
resp.withHeaders(headers.Location(endpoint.getBody))
|
||||
case ERROR => resp.withEntity(endpoint.getBody)
|
||||
case EXCEPTION => throw new Exception(endpoint.getBody)
|
||||
case _ =>
|
||||
HttpResponse(status = NOT_FOUND.getStatus)
|
||||
.withEntity(NOT_FOUND.getBody)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0
|
|||
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
import org.apache.pekko.actor.ActorSystem
|
||||
import org.apache.pekko.http.scaladsl.Http
|
||||
import org.apache.pekko.http.scaladsl.Http.ServerBinding
|
||||
|
|
@ -15,7 +16,6 @@ import org.apache.pekko.http.scaladsl.server.Directives._
|
|||
import org.apache.pekko.stream.ActorMaterializer
|
||||
import org.apache.pekko.stream.scaladsl.Sink
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.Await
|
||||
|
||||
object PekkoHttpTestServerSourceWebServer {
|
||||
|
|
@ -33,7 +33,7 @@ object PekkoHttpTestServerSourceWebServer {
|
|||
},
|
||||
path(INDEXED_CHILD.rawPath()) {
|
||||
parameterMap { map =>
|
||||
val supplier = new Supplier[String] {
|
||||
val supplier = new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
|
|
@ -114,11 +114,9 @@ object PekkoHttpTestServerSourceWebServer {
|
|||
}
|
||||
}
|
||||
|
||||
def supplier(string: String): Supplier[String] = {
|
||||
new Supplier[String] {
|
||||
def get(): String = {
|
||||
string
|
||||
}
|
||||
def supplier(string: String): ThrowingSupplier[String, Exception] = { () =>
|
||||
{
|
||||
string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,26 +30,24 @@ object PekkoHttpTestSyncWebServer {
|
|||
val endpoint = ServerEndpoint.forPath(uri.path.toString())
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
new Supplier[HttpResponse] {
|
||||
def get(): HttpResponse = {
|
||||
val resp = HttpResponse(status = endpoint.getStatus)
|
||||
endpoint match {
|
||||
case SUCCESS => resp.withEntity(endpoint.getBody)
|
||||
case INDEXED_CHILD =>
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
uri.query().get(name).orNull
|
||||
})
|
||||
resp.withEntity("")
|
||||
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
|
||||
case REDIRECT =>
|
||||
resp.withHeaders(headers.Location(endpoint.getBody))
|
||||
case ERROR => resp.withEntity(endpoint.getBody)
|
||||
case EXCEPTION => throw new Exception(endpoint.getBody)
|
||||
case _ =>
|
||||
HttpResponse(status = NOT_FOUND.getStatus)
|
||||
.withEntity(NOT_FOUND.getBody)
|
||||
}
|
||||
() => {
|
||||
val resp = HttpResponse(status = endpoint.getStatus)
|
||||
endpoint match {
|
||||
case SUCCESS => resp.withEntity(endpoint.getBody)
|
||||
case INDEXED_CHILD =>
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
uri.query().get(name).orNull
|
||||
})
|
||||
resp.withEntity("")
|
||||
case QUERY_PARAM => resp.withEntity(uri.queryString().orNull)
|
||||
case REDIRECT =>
|
||||
resp.withHeaders(headers.Location(endpoint.getBody))
|
||||
case ERROR => resp.withEntity(endpoint.getBody)
|
||||
case EXCEPTION => throw new Exception(endpoint.getBody)
|
||||
case _ =>
|
||||
HttpResponse(status = NOT_FOUND.getStatus)
|
||||
.withEntity(NOT_FOUND.getBody)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0
|
|||
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier
|
||||
import org.apache.pekko.actor.ActorSystem
|
||||
import org.apache.pekko.http.scaladsl.Http
|
||||
import org.apache.pekko.http.scaladsl.Http.ServerBinding
|
||||
|
|
@ -14,7 +15,6 @@ import org.apache.pekko.http.scaladsl.model.StatusCodes.Found
|
|||
import org.apache.pekko.http.scaladsl.server.Directives._
|
||||
import org.apache.pekko.stream.ActorMaterializer
|
||||
|
||||
import java.util.function.Supplier
|
||||
import scala.concurrent.Await
|
||||
|
||||
object PekkoHttpTestWebServer {
|
||||
|
|
@ -32,7 +32,7 @@ object PekkoHttpTestWebServer {
|
|||
},
|
||||
path(INDEXED_CHILD.rawPath()) {
|
||||
parameterMap { map =>
|
||||
val supplier = new Supplier[String] {
|
||||
val supplier = new ThrowingSupplier[String, Exception] {
|
||||
def get(): String = {
|
||||
INDEXED_CHILD.collectSpanAttributes(new UrlParameterProvider {
|
||||
override def getParameter(name: String): String =
|
||||
|
|
@ -107,11 +107,9 @@ object PekkoHttpTestWebServer {
|
|||
}
|
||||
}
|
||||
|
||||
def supplier(string: String): Supplier[String] = {
|
||||
new Supplier[String] {
|
||||
def get(): String = {
|
||||
string
|
||||
}
|
||||
def supplier(string: String): ThrowingSupplier[String, Exception] = { () =>
|
||||
{
|
||||
string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class JettyServlet2Test extends AbstractHttpServerTest<Server> {
|
|||
options.setTestCaptureHttpHeaders(false);
|
||||
options.setHasResponseSpan(e -> e.equals(REDIRECT) || e.equals(ERROR));
|
||||
options.setHasResponseCustomizer(e -> true);
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
|||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -24,10 +25,10 @@ public class TestServlet2 {
|
|||
|
||||
public static class Sync extends HttpServlet {
|
||||
@Override
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) {
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
req.getRequestDispatcher(null);
|
||||
ServerEndpoint endpoint = ServerEndpoint.forPath(req.getServletPath());
|
||||
HttpServerTest.controller(
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -42,7 +43,7 @@ public class TestServlet2 {
|
|||
} else if (ERROR.equals(endpoint)) {
|
||||
resp.sendError(endpoint.getStatus(), endpoint.getBody());
|
||||
} else if (EXCEPTION.equals(endpoint)) {
|
||||
throw new Exception(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (INDEXED_CHILD.equals(endpoint)) {
|
||||
INDEXED_CHILD.collectSpanAttributes(req::getParameter);
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public abstract class AbstractServlet3Test<SERVER, CONTEXT> extends AbstractHttp
|
|||
options.setTestCaptureRequestParameters(true);
|
||||
options.setHasResponseCustomizer(e -> true);
|
||||
options.setHasResponseSpan(this::hasResponseSpan);
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
}
|
||||
|
||||
protected boolean hasResponseSpan(ServerEndpoint endpoint) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
|||
import java.io.Writer;
|
||||
import java.net.InetSocketAddress;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||
|
|
@ -47,7 +46,7 @@ public abstract class JettyServlet3Test
|
|||
protected void configure(HttpServerTestOptions options) {
|
||||
super.configure(options);
|
||||
options.setTestNotFound(false);
|
||||
options.setExpectedException(new ServletException(EXCEPTION.getBody()));
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setContextPath("/jetty-context");
|
||||
options.setVerifyServerSpanEndTime(!isAsyncTest());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.io.Writer;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||
|
|
@ -42,7 +41,7 @@ public class JettyServletHandlerTest extends AbstractServlet3Test<Server, Servle
|
|||
super.configure(options);
|
||||
options.setContextPath("");
|
||||
options.setTestNotFound(false);
|
||||
options.setExpectedException(new ServletException(EXCEPTION.getBody()));
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setHttpAttributes(
|
||||
serverEndpoint -> {
|
||||
Set<AttributeKey<?>> attributes =
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.servlet.v3_0.tomcat;
|
||||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.CAPTURE_HEADERS;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.CAPTURE_PARAMETERS;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.ERROR;
|
||||
|
|
@ -16,7 +17,6 @@ import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
|||
import static io.opentelemetry.javaagent.instrumentation.servlet.v3_0.AbstractServlet3Test.HTML_PRINT_WRITER;
|
||||
import static io.opentelemetry.javaagent.instrumentation.servlet.v3_0.AbstractServlet3Test.HTML_SERVLET_OUTPUT_STREAM;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
|
@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -37,14 +36,14 @@ public class TestServlet3 {
|
|||
@WebServlet
|
||||
public static class Sync extends HttpServlet {
|
||||
@Override
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) {
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String servletPath = (String) req.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
||||
if (servletPath == null) {
|
||||
servletPath = req.getServletPath();
|
||||
}
|
||||
|
||||
ServerEndpoint endpoint = ServerEndpoint.forPath(servletPath);
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -67,7 +66,7 @@ public class TestServlet3 {
|
|||
req.setCharacterEncoding("UTF8");
|
||||
String value = req.getParameter("test-parameter");
|
||||
if (!value.equals("test value õäöü")) {
|
||||
throw new ServletException(
|
||||
throw new IllegalStateException(
|
||||
"request parameter does not have expected value " + value);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +75,7 @@ public class TestServlet3 {
|
|||
} else if (ERROR.equals(endpoint)) {
|
||||
resp.sendError(endpoint.getStatus(), endpoint.getBody());
|
||||
} else if (EXCEPTION.equals(endpoint)) {
|
||||
throw new ServletException(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (HTML_PRINT_WRITER.equals(endpoint)) {
|
||||
resp.setContentType("text/html");
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
|
|
@ -108,7 +107,7 @@ public class TestServlet3 {
|
|||
context.start(
|
||||
() -> {
|
||||
try {
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -136,7 +135,7 @@ public class TestServlet3 {
|
|||
req.setCharacterEncoding("UTF8");
|
||||
String value = req.getParameter("test-parameter");
|
||||
if (!value.equals("test value õäöü")) {
|
||||
throw new ServletException(
|
||||
throw new IllegalStateException(
|
||||
"request parameter does not have expected value " + value);
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +156,7 @@ public class TestServlet3 {
|
|||
// response is sent
|
||||
writer.close();
|
||||
}
|
||||
throw new ServletException(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (HTML_PRINT_WRITER.equals(endpoint)) {
|
||||
resp.setContentType("text/html");
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
|
|
@ -172,6 +171,11 @@ public class TestServlet3 {
|
|||
}
|
||||
return null;
|
||||
});
|
||||
} catch (Exception exception) {
|
||||
if (exception instanceof RuntimeException) {
|
||||
throw (RuntimeException) exception;
|
||||
}
|
||||
throw new IllegalStateException(exception);
|
||||
} finally {
|
||||
latch.countDown();
|
||||
}
|
||||
|
|
@ -187,12 +191,12 @@ public class TestServlet3 {
|
|||
@WebServlet(asyncSupported = true)
|
||||
public static class FakeAsync extends HttpServlet {
|
||||
@Override
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) {
|
||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
AsyncContext context = req.startAsync();
|
||||
try {
|
||||
ServerEndpoint endpoint = ServerEndpoint.forPath(req.getServletPath());
|
||||
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -215,7 +219,7 @@ public class TestServlet3 {
|
|||
req.setCharacterEncoding("UTF8");
|
||||
String value = req.getParameter("test-parameter");
|
||||
if (!value.equals("test value õäöü")) {
|
||||
throw new ServletException(
|
||||
throw new IllegalStateException(
|
||||
"request parameter does not have expected value " + value);
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +230,7 @@ public class TestServlet3 {
|
|||
} else if (EXCEPTION.equals(endpoint)) {
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
throw new ServletException(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (HTML_PRINT_WRITER.equals(endpoint)) {
|
||||
// intentionally testing setting status before contentType here to cover that case
|
||||
// somewhere
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import java.util.function.Consumer;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.LifecycleException;
|
||||
import org.apache.catalina.core.StandardHost;
|
||||
|
|
@ -63,7 +62,7 @@ public abstract class TomcatServlet3Test extends AbstractServlet3Test<Tomcat, Co
|
|||
@Override
|
||||
protected void configure(HttpServerTestOptions options) {
|
||||
super.configure(options);
|
||||
options.setExpectedException(new ServletException(EXCEPTION.getBody()));
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setContextPath("/tomcat-context");
|
||||
options.setTestError(testError());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DelayedControllerSpringWebFluxServerTest extends ControllerSpringWe
|
|||
protected <T> Mono<T> wrapControllerMethod(ServerEndpoint endpoint, Supplier<T> handler) {
|
||||
return Mono.just("")
|
||||
.delayElement(Duration.ofMillis(10))
|
||||
.map(unused -> controller(endpoint, handler));
|
||||
.map(unused -> controller(endpoint, handler::get));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ImmediateControllerSpringWebFluxServerTest extends ControllerSpring
|
|||
@Override
|
||||
protected <T> Mono<T> wrapControllerMethod(
|
||||
ServerEndpoint endpoint, Supplier<T> controllerMethod) {
|
||||
return Mono.just(controller(endpoint, controllerMethod));
|
||||
return Mono.just(controller(endpoint, controllerMethod::get));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.webmvc.v3_1.filter;
|
|||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.INDEXED_CHILD;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.Filter;
|
||||
|
|
@ -29,7 +29,7 @@ class ServletFilterConfig {
|
|||
return new Filter() {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
|
|
@ -37,45 +37,35 @@ class ServletFilterConfig {
|
|||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
ServerEndpoint endpoint = ServerEndpoint.forPath(req.getServletPath());
|
||||
HttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
switch (endpoint.name()) {
|
||||
case "SUCCESS":
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "QUERY_PARAM":
|
||||
if (endpoint != null && endpoint != ServerEndpoint.NOT_FOUND) {
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
if (endpoint == ServerEndpoint.QUERY_PARAM) {
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(req.getQueryString());
|
||||
break;
|
||||
case "PATH_PARAM":
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "REDIRECT":
|
||||
} else if (endpoint == ServerEndpoint.REDIRECT) {
|
||||
resp.sendRedirect(endpoint.getBody());
|
||||
break;
|
||||
case "CAPTURE_HEADERS":
|
||||
} else if (endpoint == ServerEndpoint.CAPTURE_HEADERS) {
|
||||
resp.setHeader("X-Test-Response", req.getHeader("X-Test-Request"));
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "ERROR":
|
||||
} else if (endpoint == ServerEndpoint.ERROR) {
|
||||
resp.sendError(endpoint.getStatus(), endpoint.getBody());
|
||||
break;
|
||||
case "EXCEPTION":
|
||||
throw new Exception(endpoint.getBody());
|
||||
case "INDEXED_CHILD":
|
||||
} else if (endpoint == ServerEndpoint.EXCEPTION) {
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (endpoint == ServerEndpoint.INDEXED_CHILD) {
|
||||
INDEXED_CHILD.collectSpanAttributes(req::getParameter);
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
default:
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.webmvc.v6_0.filter;
|
|||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.INDEXED_CHILD;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import jakarta.servlet.Filter;
|
||||
import jakarta.servlet.FilterChain;
|
||||
|
|
@ -29,7 +29,7 @@ class ServletFilterConfig {
|
|||
return new Filter() {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
|
|
@ -37,45 +37,35 @@ class ServletFilterConfig {
|
|||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
ServerEndpoint endpoint = ServerEndpoint.forPath(req.getServletPath());
|
||||
HttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
switch (endpoint.name()) {
|
||||
case "SUCCESS":
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "QUERY_PARAM":
|
||||
if (endpoint != null && endpoint != ServerEndpoint.NOT_FOUND) {
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
if (endpoint == ServerEndpoint.QUERY_PARAM) {
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(req.getQueryString());
|
||||
break;
|
||||
case "PATH_PARAM":
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "REDIRECT":
|
||||
} else if (endpoint == ServerEndpoint.REDIRECT) {
|
||||
resp.sendRedirect(endpoint.getBody());
|
||||
break;
|
||||
case "CAPTURE_HEADERS":
|
||||
} else if (endpoint == ServerEndpoint.CAPTURE_HEADERS) {
|
||||
resp.setHeader("X-Test-Response", req.getHeader("X-Test-Request"));
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
case "ERROR":
|
||||
} else if (endpoint == ServerEndpoint.ERROR) {
|
||||
resp.sendError(endpoint.getStatus(), endpoint.getBody());
|
||||
break;
|
||||
case "EXCEPTION":
|
||||
throw new Exception(endpoint.getBody());
|
||||
case "INDEXED_CHILD":
|
||||
} else if (endpoint == ServerEndpoint.EXCEPTION) {
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
} else if (endpoint == ServerEndpoint.INDEXED_CHILD) {
|
||||
INDEXED_CHILD.collectSpanAttributes(req::getParameter);
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
break;
|
||||
default:
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
resp.setStatus(endpoint.getStatus());
|
||||
resp.getWriter().print(endpoint.getBody());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public abstract class AbstractServletFilterTest
|
|||
options.setHasResponseSpan(
|
||||
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
|
||||
options.setTestPathParam(true);
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.struts2;
|
||||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -17,40 +18,37 @@ public class GreetingAction extends ActionSupport {
|
|||
String responseBody = "default";
|
||||
|
||||
public String success() {
|
||||
responseBody =
|
||||
HttpServerTest.controller(ServerEndpoint.SUCCESS, ServerEndpoint.SUCCESS::getBody);
|
||||
responseBody = controller(ServerEndpoint.SUCCESS, ServerEndpoint.SUCCESS::getBody);
|
||||
|
||||
return "greeting";
|
||||
}
|
||||
|
||||
public String redirect() {
|
||||
responseBody =
|
||||
HttpServerTest.controller(ServerEndpoint.REDIRECT, ServerEndpoint.REDIRECT::getBody);
|
||||
responseBody = controller(ServerEndpoint.REDIRECT, ServerEndpoint.REDIRECT::getBody);
|
||||
return "redirect";
|
||||
}
|
||||
|
||||
public String query_param() {
|
||||
responseBody =
|
||||
HttpServerTest.controller(ServerEndpoint.QUERY_PARAM, ServerEndpoint.QUERY_PARAM::getBody);
|
||||
responseBody = controller(ServerEndpoint.QUERY_PARAM, ServerEndpoint.QUERY_PARAM::getBody);
|
||||
return "greeting";
|
||||
}
|
||||
|
||||
public String error() {
|
||||
HttpServerTest.controller(ServerEndpoint.ERROR, ServerEndpoint.ERROR::getBody);
|
||||
controller(ServerEndpoint.ERROR, ServerEndpoint.ERROR::getBody);
|
||||
return "error";
|
||||
}
|
||||
|
||||
public String exception() {
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
ServerEndpoint.EXCEPTION,
|
||||
() -> {
|
||||
throw new Exception(ServerEndpoint.EXCEPTION.getBody());
|
||||
throw new IllegalStateException(ServerEndpoint.EXCEPTION.getBody());
|
||||
});
|
||||
throw new AssertionError(); // should not reach here
|
||||
}
|
||||
|
||||
public String path_param() {
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
ServerEndpoint.PATH_PARAM,
|
||||
() ->
|
||||
"this does nothing, as responseBody is set in setId, but we need this controller span nevertheless");
|
||||
|
|
@ -59,7 +57,7 @@ public class GreetingAction extends ActionSupport {
|
|||
|
||||
public String indexed_child() {
|
||||
responseBody =
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
ServerEndpoint.INDEXED_CHILD,
|
||||
() -> {
|
||||
ServerEndpoint.INDEXED_CHILD.collectSpanAttributes(
|
||||
|
|
@ -74,8 +72,7 @@ public class GreetingAction extends ActionSupport {
|
|||
HttpServletResponse response = ServletActionContext.getResponse();
|
||||
response.setHeader("X-Test-Response", request.getHeader("X-Test-Request"));
|
||||
responseBody =
|
||||
HttpServerTest.controller(
|
||||
ServerEndpoint.CAPTURE_HEADERS, ServerEndpoint.CAPTURE_HEADERS::getBody);
|
||||
controller(ServerEndpoint.CAPTURE_HEADERS, ServerEndpoint.CAPTURE_HEADERS::getBody);
|
||||
return "greeting";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
package io.opentelemetry.javaagent.instrumentation.struts2;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -14,8 +13,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class GreetingServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
resp.getWriter().write("greeting");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class Struts2ActionSpanTest extends AbstractHttpServerTest<Server> {
|
|||
options.setTestPathParam(true);
|
||||
options.setTestErrorBody(false);
|
||||
options.setHasHandlerSpan(endpoint -> !endpoint.equals(NOT_FOUND));
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setHasResponseSpan(
|
||||
endpoint ->
|
||||
endpoint == REDIRECT
|
||||
|
|
@ -139,7 +140,8 @@ class Struts2ActionSpanTest extends AbstractHttpServerTest<Server> {
|
|||
.hasKind(SpanKind.INTERNAL);
|
||||
|
||||
if (endpoint.equals(EXCEPTION)) {
|
||||
span.hasStatus(StatusData.error()).hasException(new Exception(EXCEPTION.getBody()));
|
||||
span.hasStatus(StatusData.error())
|
||||
.hasException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
}
|
||||
|
||||
span.hasAttributesSatisfyingExactly(
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
|||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import jakarta.servlet.AsyncContext;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class AsyncServlet extends HttpServlet {
|
|||
context.start(
|
||||
() -> {
|
||||
try {
|
||||
HttpServerTest.controller(
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -61,10 +61,11 @@ class AsyncServlet extends HttpServlet {
|
|||
PrintWriter writer = resp.getWriter();
|
||||
writer.print(endpoint.getBody());
|
||||
writer.close();
|
||||
throw new ServletException(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (IOException exception) {
|
||||
throw new IllegalStateException(exception);
|
||||
} finally {
|
||||
// complete at the end so the server span will end after the controller span
|
||||
if (endpoint != EXCEPTION) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v10_0;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
|
@ -21,11 +20,11 @@ class TestServlet extends HttpServlet {
|
|||
|
||||
ServerEndpoint serverEndpoint = ServerEndpoint.forPath(path);
|
||||
if (serverEndpoint != null) {
|
||||
HttpServerTest.controller(
|
||||
AbstractHttpServerTest.controller(
|
||||
serverEndpoint,
|
||||
() -> {
|
||||
if (serverEndpoint == ServerEndpoint.EXCEPTION) {
|
||||
throw new Exception(serverEndpoint.getBody());
|
||||
throw new IllegalStateException(serverEndpoint.getBody());
|
||||
}
|
||||
if (serverEndpoint == ServerEndpoint.CAPTURE_HEADERS) {
|
||||
resp.setHeader("X-Test-Response", req.getHeader("X-Test-Request"));
|
||||
|
|
@ -34,7 +33,7 @@ class TestServlet extends HttpServlet {
|
|||
req.setCharacterEncoding("UTF8");
|
||||
String value = req.getParameter("test-parameter");
|
||||
if (!"test value õäöü".equals(value)) {
|
||||
throw new ServletException(
|
||||
throw new IllegalStateException(
|
||||
"request parameter does not have expected value " + value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions
|
|||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import io.opentelemetry.sdk.testing.assertj.SpanDataAssert;
|
||||
import jakarta.servlet.Servlet;
|
||||
import jakarta.servlet.ServletException;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.UUID;
|
||||
|
|
@ -110,8 +109,7 @@ class TomcatAsyncTest extends AbstractHttpServerTest<Tomcat> {
|
|||
return super.expectedHttpRoute(endpoint, method);
|
||||
});
|
||||
|
||||
options.setExpectedException(new ServletException(EXCEPTION.getBody()));
|
||||
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setHasResponseSpan(endpoint -> endpoint == NOT_FOUND || endpoint == REDIRECT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ class TomcatHandlerTest extends AbstractHttpServerTest<Tomcat> {
|
|||
options.setHasResponseCustomizer(serverEndpoint -> true);
|
||||
options.setTestCaptureRequestParameters(true);
|
||||
options.setTestErrorBody(false);
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
|
||||
options.setHasResponseSpan(
|
||||
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
|||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -37,7 +36,7 @@ class AsyncServlet extends HttpServlet {
|
|||
context.start(
|
||||
() -> {
|
||||
try {
|
||||
HttpServerTest.controller(
|
||||
AbstractHttpServerTest.controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
resp.setContentType("text/plain");
|
||||
|
|
@ -61,10 +60,15 @@ class AsyncServlet extends HttpServlet {
|
|||
PrintWriter writer = resp.getWriter();
|
||||
writer.print(endpoint.getBody());
|
||||
writer.close();
|
||||
throw new ServletException(endpoint.getBody());
|
||||
throw new IllegalStateException(endpoint.getBody());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
} catch (Exception exception) {
|
||||
if (exception instanceof RuntimeException) {
|
||||
throw (RuntimeException) exception;
|
||||
}
|
||||
throw new IllegalStateException(exception);
|
||||
} finally {
|
||||
// complete at the end so the server span will end after the controller span
|
||||
if (endpoint != EXCEPTION) {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@
|
|||
|
||||
package io.opentelemetry.javaagent.instrumentation.tomcat.v7_0;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest;
|
||||
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -21,11 +20,11 @@ class TestServlet extends HttpServlet {
|
|||
|
||||
ServerEndpoint serverEndpoint = ServerEndpoint.forPath(path);
|
||||
if (serverEndpoint != null) {
|
||||
HttpServerTest.controller(
|
||||
AbstractHttpServerTest.controller(
|
||||
serverEndpoint,
|
||||
() -> {
|
||||
if (serverEndpoint == ServerEndpoint.EXCEPTION) {
|
||||
throw new Exception(serverEndpoint.getBody());
|
||||
throw new IllegalStateException(serverEndpoint.getBody());
|
||||
}
|
||||
if (serverEndpoint == ServerEndpoint.CAPTURE_HEADERS) {
|
||||
resp.setHeader("X-Test-Response", req.getHeader("X-Test-Request"));
|
||||
|
|
@ -34,7 +33,7 @@ class TestServlet extends HttpServlet {
|
|||
req.setCharacterEncoding("UTF8");
|
||||
String value = req.getParameter("test-parameter");
|
||||
if (!"test value õäöü".equals(value)) {
|
||||
throw new ServletException(
|
||||
throw new IllegalStateException(
|
||||
"request parameter does not have expected value " + value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import io.opentelemetry.sdk.testing.assertj.SpanDataAssert;
|
|||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.ServletException;
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.LifecycleException;
|
||||
import org.apache.catalina.startup.Tomcat;
|
||||
|
|
@ -105,8 +104,7 @@ class TomcatAsyncTest extends AbstractHttpServerTest<Tomcat> {
|
|||
return super.expectedHttpRoute(endpoint, method);
|
||||
});
|
||||
|
||||
options.setExpectedException(new ServletException(EXCEPTION.getBody()));
|
||||
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
options.setHasResponseSpan(endpoint -> endpoint == NOT_FOUND || endpoint == REDIRECT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ class TomcatHandlerTest extends AbstractHttpServerTest<Tomcat> {
|
|||
options.setHasResponseCustomizer(serverEndpoint -> true);
|
||||
options.setTestCaptureRequestParameters(true);
|
||||
options.setTestErrorBody(false);
|
||||
options.setExpectedException(new IllegalStateException(EXCEPTION.getBody()));
|
||||
|
||||
options.setHasResponseSpan(
|
||||
endpoint -> endpoint == REDIRECT || endpoint == ERROR || endpoint == NOT_FOUND);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import io.vertx.core.json.JsonObject
|
|||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION
|
||||
|
||||
abstract class AbstractVertxHttpServerTest extends HttpServerTest<Vertx> implements AgentTestTrait {
|
||||
@Override
|
||||
Vertx startServer(int port) {
|
||||
|
|
@ -63,6 +65,11 @@ abstract class AbstractVertxHttpServerTest extends HttpServerTest<Vertx> impleme
|
|||
"/vertx-app"
|
||||
}
|
||||
|
||||
@Override
|
||||
Throwable expectedException() {
|
||||
new IllegalStateException(EXCEPTION.body)
|
||||
}
|
||||
|
||||
@Override
|
||||
String expectedHttpRoute(ServerEndpoint endpoint, String method) {
|
||||
if (method == HttpConstants._OTHER) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
package server;
|
||||
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest.controller;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.CAPTURE_HEADERS;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.ERROR;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.EXCEPTION;
|
||||
|
|
@ -14,7 +15,6 @@ import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint
|
|||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.REDIRECT;
|
||||
import static io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint.SUCCESS;
|
||||
|
||||
import io.opentelemetry.instrumentation.test.base.HttpServerTest;
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.http.HttpServerResponse;
|
||||
|
|
@ -42,7 +42,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
new Handler<RoutingContext>() {
|
||||
@Override
|
||||
public void handle(RoutingContext ctx) {
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
SUCCESS,
|
||||
() -> {
|
||||
end(ctx.response().setStatusCode(SUCCESS.getStatus()), SUCCESS.getBody());
|
||||
|
|
@ -54,7 +54,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(INDEXED_CHILD.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
INDEXED_CHILD,
|
||||
() -> {
|
||||
INDEXED_CHILD.collectSpanAttributes(it -> ctx.request().getParam(it));
|
||||
|
|
@ -65,7 +65,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(QUERY_PARAM.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
QUERY_PARAM,
|
||||
() -> {
|
||||
end(
|
||||
|
|
@ -77,7 +77,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(REDIRECT.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
REDIRECT,
|
||||
() -> {
|
||||
end(
|
||||
|
|
@ -90,7 +90,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(ERROR.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
ERROR,
|
||||
() -> {
|
||||
end(ctx.response().setStatusCode(ERROR.getStatus()), ERROR.getBody());
|
||||
|
|
@ -100,16 +100,16 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(EXCEPTION.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
EXCEPTION,
|
||||
() -> {
|
||||
throw new Exception(EXCEPTION.getBody());
|
||||
throw new IllegalStateException(EXCEPTION.getBody());
|
||||
}));
|
||||
router
|
||||
.route("/path/:id/param")
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
PATH_PARAM,
|
||||
() -> {
|
||||
end(
|
||||
|
|
@ -121,7 +121,7 @@ public abstract class AbstractVertxWebServer extends AbstractVerticle {
|
|||
.route(CAPTURE_HEADERS.getPath())
|
||||
.handler(
|
||||
ctx ->
|
||||
HttpServerTest.controller(
|
||||
controller(
|
||||
CAPTURE_HEADERS,
|
||||
() -> {
|
||||
end(
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import io.opentelemetry.context.propagation.TextMapPropagator;
|
|||
import io.opentelemetry.context.propagation.TextMapSetter;
|
||||
import io.opentelemetry.instrumentation.api.internal.HttpConstants;
|
||||
import io.opentelemetry.instrumentation.testing.GlobalTraceUtil;
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingRunnable;
|
||||
import io.opentelemetry.instrumentation.testing.util.ThrowingSupplier;
|
||||
import io.opentelemetry.sdk.testing.assertj.SpanDataAssert;
|
||||
import io.opentelemetry.sdk.testing.assertj.TraceAssert;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -75,7 +77,6 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import org.assertj.core.api.AssertAccess;
|
||||
|
|
@ -115,15 +116,17 @@ public abstract class AbstractHttpServerTest<SERVER> extends AbstractHttpServerU
|
|||
|
||||
protected void configure(HttpServerTestOptions options) {}
|
||||
|
||||
public static <T> T controller(ServerEndpoint endpoint, Supplier<T> closure) {
|
||||
public static <T, E extends Throwable> T controller(
|
||||
ServerEndpoint endpoint, ThrowingSupplier<T, E> closure) throws E {
|
||||
assert Span.current().getSpanContext().isValid() : "Controller should have a parent span.";
|
||||
if (endpoint == NOT_FOUND) {
|
||||
return closure.get();
|
||||
}
|
||||
return GlobalTraceUtil.runWithSpan("controller", closure::get);
|
||||
return GlobalTraceUtil.runWithSpan("controller", closure);
|
||||
}
|
||||
|
||||
public static void controller(ServerEndpoint endpoint, Runnable closure) {
|
||||
public static <E extends Throwable> void controller(
|
||||
ServerEndpoint endpoint, ThrowingRunnable<E> closure) throws E {
|
||||
controller(
|
||||
endpoint,
|
||||
() -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue