From c1492564a3d178f43cd0689ad56f772843c75ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Kozak?= Date: Mon, 23 Dec 2024 15:45:02 +0100 Subject: [PATCH] Add detailed comments for custom HttpClient setups Clarify the purpose of HttpClient configurations in `SttpRestCallTest` and `JettyRestCallTest`. The added comments explain the use of a connection timeout significantly exceeding the CallTimeout value, improving code readability and maintainability. --- .../.jvm/src/test/scala/io/udash/rest/SttpRestCallTest.scala | 5 ++++- .../test/scala/io/udash/rest/jetty/JettyRestCallTest.scala | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/rest/.jvm/src/test/scala/io/udash/rest/SttpRestCallTest.scala b/rest/.jvm/src/test/scala/io/udash/rest/SttpRestCallTest.scala index f77fa0ded..38fdee737 100644 --- a/rest/.jvm/src/test/scala/io/udash/rest/SttpRestCallTest.scala +++ b/rest/.jvm/src/test/scala/io/udash/rest/SttpRestCallTest.scala @@ -11,8 +11,11 @@ import scala.concurrent.duration.* import scala.concurrent.{Await, Future} trait SttpClientRestTest extends ServletBasedRestApiTest { + /** + * Similar to the defaultHttpClient, but with a connection timeout + * significantly exceeding the value of the CallTimeout + */ implicit val backend: SttpBackend[Future, Any] = HttpClientFutureBackend.usingClient( - //like defaultHttpClient but with connection timeout >> CallTimeout HttpClient .newBuilder() .connectTimeout(JDuration.ofMillis(IdleTimout.toMillis)) diff --git a/rest/jetty/src/test/scala/io/udash/rest/jetty/JettyRestCallTest.scala b/rest/jetty/src/test/scala/io/udash/rest/jetty/JettyRestCallTest.scala index 71164072b..22fb5ce69 100644 --- a/rest/jetty/src/test/scala/io/udash/rest/jetty/JettyRestCallTest.scala +++ b/rest/jetty/src/test/scala/io/udash/rest/jetty/JettyRestCallTest.scala @@ -6,6 +6,10 @@ import io.udash.rest.{RestApiTestScenarios, ServletBasedRestApiTest} import org.eclipse.jetty.client.HttpClient final class JettyRestCallTest extends ServletBasedRestApiTest with RestApiTestScenarios { + /** + * Similar to the default HttpClient, but with a connection timeout + * significantly exceeding the value of the CallTimeout + */ val client: HttpClient = new HttpClient() { setMaxConnectionsPerDestination(MaxConnections) setIdleTimeout(IdleTimout.toMillis)