|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +package io.opentelemetry.instrumentation.ratpack.v1_7.server; |
| 7 | + |
| 8 | +import static java.util.Collections.singletonList; |
| 9 | + |
| 10 | +import io.opentelemetry.instrumentation.ratpack.server.AbstractRatpackHttpServerTest; |
| 11 | +import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackTelemetry; |
| 12 | +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; |
| 13 | +import io.opentelemetry.instrumentation.testing.junit.http.AbstractHttpServerTest; |
| 14 | +import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension; |
| 15 | +import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions; |
| 16 | +import org.junit.jupiter.api.extension.RegisterExtension; |
| 17 | +import ratpack.server.RatpackServerSpec; |
| 18 | + |
| 19 | +@SuppressWarnings("deprecation") |
| 20 | +class RatpackHttpServerOldTest extends AbstractRatpackHttpServerTest { |
| 21 | + |
| 22 | + @RegisterExtension |
| 23 | + public static final InstrumentationExtension testing = |
| 24 | + HttpServerInstrumentationExtension.forLibrary(); |
| 25 | + |
| 26 | + @Override |
| 27 | + protected void configure(RatpackServerSpec serverSpec) throws Exception { |
| 28 | + RatpackTelemetry telemetry = |
| 29 | + RatpackTelemetry.builder(testing.getOpenTelemetry()) |
| 30 | + .setCapturedServerRequestHeaders( |
| 31 | + singletonList(AbstractHttpServerTest.TEST_REQUEST_HEADER)) |
| 32 | + .setCapturedServerResponseHeaders( |
| 33 | + singletonList(AbstractHttpServerTest.TEST_RESPONSE_HEADER)) |
| 34 | + .build(); |
| 35 | + serverSpec.registryOf(telemetry::configureServerRegistry); |
| 36 | + } |
| 37 | + |
| 38 | + @Override |
| 39 | + protected void configure(HttpServerTestOptions options) { |
| 40 | + super.configure(options); |
| 41 | + |
| 42 | + options.setHasHandlerSpan(endpoint -> false); |
| 43 | + } |
| 44 | +} |
0 commit comments