Class TestServerWebServices

java.lang.Object
org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices

@Path("testServices") public class TestServerWebServices extends Object
Test JAXRS web services.
  • Field Details

    • REST_TEST_SERVICE_PATH

      public static final String REST_TEST_SERVICE_PATH
      The path to this set of web services.
      See Also:
    • REST_SIMPLE_TEST

      public static final String REST_SIMPLE_TEST
      Web service endpoint for the simpleTest call.
      See Also:
    • REST_LOCAL_SPAN

      public static final String REST_LOCAL_SPAN
      Web service endpoint that creates local span.
      See Also:
    • REST_SKIP_SIMPLE

      public static final String REST_SKIP_SIMPLE
      Web service endpoint which should not be traced
      See Also:
    • REST_ASYNC_LOCAL_SPAN

      public static final String REST_ASYNC_LOCAL_SPAN
      Async web service endpoint that creates local span.
      See Also:
    • REST_ERROR

      public static final String REST_ERROR
      Web service endpoint that will return HTTP 500.
      See Also:
    • REST_EXCEPTION

      public static final String REST_EXCEPTION
      Web service that throws an unhandled exception and return HTTP 500.
      See Also:
    • REST_ANNOTATIONS

      public static final String REST_ANNOTATIONS
      Web service endpoint to test Traced annotations.
      See Also:
    • REST_ANNOTATION_EXCEPTION

      public static final String REST_ANNOTATION_EXCEPTION
      Web service endpoint to test a Traced annotation with an exception.
      See Also:
    • PARAM_UNIQUE_ID

      public static final String PARAM_UNIQUE_ID
      Query parameter that's a unique ID propagated down nested calls.
      See Also:
    • PARAM_FAIL_NEST

      public static final String PARAM_FAIL_NEST
      Query parameter whether to fail the nested call.
      See Also:
    • PARAM_ASYNC

      public static final String PARAM_ASYNC
      Query parameter whether to use async requests.
      See Also:
    • REST_NESTED

      public static final String REST_NESTED
      Web service endpoint that will call itself some number of times.
      See Also:
    • PARAM_NEST_DEPTH

      public static final String PARAM_NEST_DEPTH
      Query parameter for the number of nested calls.
      See Also:
    • PARAM_NEST_BREADTH

      public static final String PARAM_NEST_BREADTH
      Query parameter for the breadth of nesting.
      See Also:
    • LOCAL_SPAN_TAG_KEY

      public static final String LOCAL_SPAN_TAG_KEY
      The key of a simulated span tag.
      See Also:
    • LOCAL_SPAN_TAG_VALUE

      public static final String LOCAL_SPAN_TAG_VALUE
      The value of a simulated span tag.
      See Also:
    • REST_NOT_TRACED

      public static final String REST_NOT_TRACED
      Web service endpoint that's not traced.
      See Also:
    • REST_OPERATION_NAME

      public static final String REST_OPERATION_NAME
      Web service endpoint with an explicit operation name.
      See Also:
  • Constructor Details

    • TestServerWebServices

      public TestServerWebServices()
  • Method Details

    • simpleTest

      @GET @Path("simpleTest") @Produces("text/plain") public jakarta.ws.rs.core.Response simpleTest()
      Simple JAXRS endpoint.
      Returns:
      OK response
    • localSpan

      @GET @Path("localSpan") @Produces("text/plain") public jakarta.ws.rs.core.Response localSpan()
      Endpoint which creates local span.
      Returns:
      OK response
    • asyncLocalSpan

      @GET @Path("asyncLocalSpan") @Produces("text/plain") public void asyncLocalSpan(@Suspended jakarta.ws.rs.container.AsyncResponse asyncResponse)
      Async endpoint which creates local span.
      Parameters:
      asyncResponse - holds state of the asynchronous processing
    • error

      @GET @Path("error") @Produces("text/plain") public jakarta.ws.rs.core.Response error()
      Returns HTTP 500 error.
      Returns:
      error response
    • exception

      @GET @Path("exception") @Produces("text/plain") public jakarta.ws.rs.core.Response exception()
      Returns HTTP 500 error.
      Returns:
      Response Never returned because an exception is thrown.
    • annotations

      @GET @Path("annotations") @Produces("text/plain") public jakarta.ws.rs.core.Response annotations()
      Web service endpoint to test Traced annotations.
      Returns:
      HTTP 200 OK.
    • annotationException

      @GET @Path("annotationException") @Produces("text/plain") public jakarta.ws.rs.core.Response annotationException()
      Web service endpoint to test a Traced annotation with an exception.
      Returns:
      HTTP 200 OK.
    • notTraced

      @Traced(false) @GET @Path("notTraced") @Produces("text/plain") public jakarta.ws.rs.core.Response notTraced()
      Shouldn't create a span.
      Returns:
      OK response
    • operationName

      @Traced(operationName="operationName") @GET @Path("operationName") @Produces("text/plain") public jakarta.ws.rs.core.Response operationName()
      Traced with an explicit operation name.
      Returns:
      OK response
    • nested

      @GET @Path("nested") @Produces("text/plain") public jakarta.ws.rs.core.Response nested(@QueryParam("nestDepth") int nestDepth, @QueryParam("nestBreadth") int nestBreadth, @QueryParam("data") String uniqueID, @QueryParam("failNest") boolean failNest, @QueryParam("async") boolean async) throws InterruptedException, ExecutionException
      Web service call that calls itself nestDepth - 1 times. A nesting depth of zero (0) causes an immediate return. A nesting depth greater than zero causes a call to the nesting service with the depth reduced by one (1). The nestBreadth controls how many concurrent, nested calls are made on the first level of nesting.
      Parameters:
      nestDepth - The depth of nesting to use when implementing the request.
      nestBreadth - The breadth of nested calls.
      uniqueID - Unique ID propagated down nested calls.
      failNest - True if nested response should be an error
      async - Whether the nested request is executed asynchronously.
      Returns:
      OK response
      Throws:
      ExecutionException - Error executing nested web service.
      InterruptedException - Error executing nested web service.
    • skipSimple

      @GET @Path("skipSimple") @Produces("text/plain") public jakarta.ws.rs.core.Response skipSimple()
      Endpoint which creates local span.
      Returns:
      OK response
    • getRequestPath

      public String getRequestPath(String servicePath, String endpointPath, Map<String,Object> requestParameters)
      Create the full URL for the web service request.
      Parameters:
      servicePath - Service path component.
      endpointPath - The final component of the path.
      requestParameters - Query parameters.
      Returns:
      Full URL for the web service request.