Skip to content

Commit be153f0

Browse files
authored
make pekko test code more scala 3 friendly (#12384)
1 parent 060c6c1 commit be153f0

File tree

6 files changed

+10
-21
lines changed

6 files changed

+10
-21
lines changed

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpClientInstrumentationTest.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class PekkoHttpClientInstrumentationTest
4343
HttpClientInstrumentationExtension.forAgent()
4444

4545
val system: ActorSystem = ActorSystem.create()
46-
implicit val materializer: ActorMaterializer =
47-
ActorMaterializer.create(system)
46+
val materializer: ActorMaterializer = ActorMaterializer.create(system)
4847

4948
override def buildRequest(
5049
method: String,

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpServerRouteTest.scala

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import org.apache.pekko.http.scaladsl.server.Directives.{
2525
pathPrefix,
2626
pathSingleSlash
2727
}
28-
import org.apache.pekko.stream.ActorMaterializer
2928
import org.assertj.core.api.Assertions.assertThat
3029
import org.junit.jupiter.api.extension.RegisterExtension
3130
import org.junit.jupiter.api.{AfterAll, Test, TestInstance}
@@ -42,7 +41,6 @@ class PekkoHttpServerRouteTest {
4241
private val client: WebClient = WebClient.of()
4342

4443
implicit val system: ActorSystem = ActorSystem("my-system")
45-
implicit val materializer: ActorMaterializer = ActorMaterializer()
4644

4745
private def buildAddress(port: Int): URI = try
4846
new URI("http://localhost:" + port + "/")

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpTestAsyncWebServer.scala

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import org.apache.pekko.http.scaladsl.Http
1010
import org.apache.pekko.http.scaladsl.Http.ServerBinding
1111
import org.apache.pekko.http.scaladsl.model.HttpMethods.GET
1212
import org.apache.pekko.http.scaladsl.model._
13-
import org.apache.pekko.stream.ActorMaterializer
1413
import io.opentelemetry.instrumentation.testing.junit.http.{
1514
AbstractHttpServerTest,
1615
ServerEndpoint
@@ -22,7 +21,6 @@ import scala.concurrent.{Await, ExecutionContextExecutor, Future}
2221

2322
object PekkoHttpTestAsyncWebServer {
2423
implicit val system: ActorSystem = ActorSystem("my-system")
25-
implicit val materializer: ActorMaterializer = ActorMaterializer()
2624
// needed for the future flatMap/onComplete in the end
2725
implicit val executionContext: ExecutionContextExecutor = system.dispatcher
2826
val asyncHandler: HttpRequest => Future[HttpResponse] = {

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpTestServerSourceWebServer.scala

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ import org.apache.pekko.http.scaladsl.Http
1313
import org.apache.pekko.http.scaladsl.Http.ServerBinding
1414
import org.apache.pekko.http.scaladsl.model.StatusCodes.Found
1515
import org.apache.pekko.http.scaladsl.server.Directives._
16-
import org.apache.pekko.stream.ActorMaterializer
1716
import org.apache.pekko.stream.scaladsl.Sink
1817

19-
import scala.concurrent.Await
18+
import scala.concurrent.{Await, ExecutionContext}
2019

2120
object PekkoHttpTestServerSourceWebServer {
22-
implicit val system = ActorSystem("my-system")
23-
implicit val materializer = ActorMaterializer()
21+
implicit val system: ActorSystem = ActorSystem("my-system")
2422
// needed for the future flatMap/onComplete in the end
25-
implicit val executionContext = system.dispatcher
23+
implicit val executionContext: ExecutionContext = system.dispatcher
2624

2725
var route = get {
2826
concat(

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpTestSyncWebServer.scala

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ import org.apache.pekko.http.scaladsl.Http
1010
import org.apache.pekko.http.scaladsl.Http.ServerBinding
1111
import org.apache.pekko.http.scaladsl.model.HttpMethods.GET
1212
import org.apache.pekko.http.scaladsl.model._
13-
import org.apache.pekko.stream.ActorMaterializer
1413
import io.opentelemetry.instrumentation.testing.junit.http.{
1514
AbstractHttpServerTest,
1615
ServerEndpoint
1716
}
1817
import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint._
1918

2019
import java.util.function.Supplier
21-
import scala.concurrent.Await
20+
import scala.concurrent.{Await, ExecutionContext}
2221

2322
object PekkoHttpTestSyncWebServer {
24-
implicit val system = ActorSystem("my-system")
25-
implicit val materializer = ActorMaterializer()
23+
implicit val system: ActorSystem = ActorSystem("my-system")
2624
// needed for the future flatMap/onComplete in the end
27-
implicit val executionContext = system.dispatcher
25+
implicit val executionContext: ExecutionContext = system.dispatcher
2826
val syncHandler: HttpRequest => HttpResponse = {
2927
case HttpRequest(GET, uri: Uri, _, _, _) => {
3028
val endpoint = ServerEndpoint.forPath(uri.path.toString())

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpTestWebServer.scala

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import org.apache.pekko.http.scaladsl.Http
1313
import org.apache.pekko.http.scaladsl.Http.ServerBinding
1414
import org.apache.pekko.http.scaladsl.model.StatusCodes.Found
1515
import org.apache.pekko.http.scaladsl.server.Directives._
16-
import org.apache.pekko.stream.ActorMaterializer
1716

18-
import scala.concurrent.Await
17+
import scala.concurrent.{Await, ExecutionContext}
1918

2019
object PekkoHttpTestWebServer {
21-
implicit val system = ActorSystem("my-system")
22-
implicit val materializer = ActorMaterializer()
20+
implicit val system: ActorSystem = ActorSystem("my-system")
2321
// needed for the future flatMap/onComplete in the end
24-
implicit val executionContext = system.dispatcher
22+
implicit val executionContext: ExecutionContext = system.dispatcher
2523

2624
var route = get {
2725
concat(

0 commit comments

Comments
 (0)