Skip to content

Commit 42ab7ea

Browse files
committed
refactor: essystem default url
dump
1 parent 63d9cfd commit 42ab7ea

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

lib/stove-testing-e2e-elasticsearch/src/main/kotlin/com/trendyol/stove/testing/e2e/elasticsearch/ElasticsearchSystem.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,19 +320,11 @@ class ElasticsearchSystem internal constructor(
320320
return "$scheme://${cfg.host}:${cfg.port}"
321321
}
322322

323-
private fun createHttpClient(cfg: ElasticSearchExposedConfiguration): HttpClient {
324-
val client = context.options.httpClientConfigurer
323+
private fun createHttpClient(cfg: ElasticSearchExposedConfiguration): HttpClient =
324+
context.options.httpClientConfigurer
325325
.getOrElse { { defaultHttpClient(cfg) } }
326326
.invoke(cfg)
327327

328-
// Apply base URL configuration to whatever client was created
329-
return client.config {
330-
defaultRequest {
331-
url(baseUrl)
332-
}
333-
}
334-
}
335-
336328
private fun defaultHttpClient(cfg: ElasticSearchExposedConfiguration): HttpClient =
337329
HttpClient(OkHttp) {
338330
engine {
@@ -355,6 +347,7 @@ class ElasticsearchSystem internal constructor(
355347
}
356348

357349
defaultRequest {
350+
url(buildBaseUrl(cfg))
358351
if (cfg.isSecure && cfg.password.isNotBlank()) {
359352
header(HttpHeaders.Authorization, cfg.basicAuthHeader())
360353
}

lib/stove-testing-e2e-http/api/stove-testing-e2e-http.api

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
public final class com/trendyol/stove/testing/e2e/http/HttpClientSystemOptions : com/trendyol/stove/testing/e2e/system/abstractions/SystemOptions {
2-
public synthetic fun <init> (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
3-
public synthetic fun <init> (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
2+
public static final field Companion Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions$Companion;
3+
public synthetic fun <init> (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function0;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
4+
public synthetic fun <init> (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function0;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
45
public final fun component1 ()Ljava/lang/String;
56
public final fun component2 ()Lio/ktor/serialization/ContentConverter;
67
public final fun component3-UwyO8pc ()J
7-
public final fun component4 ()Lkotlin/jvm/functions/Function1;
8-
public final fun copy-exY8QGI (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function1;)Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;
9-
public static synthetic fun copy-exY8QGI$default (Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;
8+
public final fun component4 ()Lkotlin/jvm/functions/Function0;
9+
public final fun copy-exY8QGI (Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function0;)Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;
10+
public static synthetic fun copy-exY8QGI$default (Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;Ljava/lang/String;Lio/ktor/serialization/ContentConverter;JLkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;
1011
public fun equals (Ljava/lang/Object;)Z
1112
public final fun getBaseUrl ()Ljava/lang/String;
1213
public final fun getContentConverter ()Lio/ktor/serialization/ContentConverter;
13-
public final fun getCreateClient ()Lkotlin/jvm/functions/Function1;
14+
public final fun getCreateClient ()Lkotlin/jvm/functions/Function0;
1415
public final fun getTimeout-UwyO8pc ()J
1516
public fun hashCode ()I
1617
public fun toString ()Ljava/lang/String;
1718
}
1819

20+
public final class com/trendyol/stove/testing/e2e/http/HttpClientSystemOptions$Companion {
21+
}
22+
1923
public abstract interface annotation class com/trendyol/stove/testing/e2e/http/HttpDsl : java/lang/annotation/Annotation {
2024
}
2125

2226
public final class com/trendyol/stove/testing/e2e/http/HttpSystem : com/trendyol/stove/testing/e2e/system/abstractions/PluggedSystem {
2327
public static final field Companion Lcom/trendyol/stove/testing/e2e/http/HttpSystem$Companion;
2428
public fun <init> (Lcom/trendyol/stove/testing/e2e/system/TestSystem;Lcom/trendyol/stove/testing/e2e/http/HttpClientSystemOptions;)V
2529
public fun close ()V
26-
public final fun configureRequest (Lio/ktor/client/request/HttpRequestBuilder;Ljava/lang/String;Ljava/util/Map;Larrow/core/Option;)V
2730
public final fun deleteAndExpectBodilessResponse (Ljava/lang/String;Larrow/core/Option;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
2831
public static synthetic fun deleteAndExpectBodilessResponse$default (Lcom/trendyol/stove/testing/e2e/http/HttpSystem;Ljava/lang/String;Larrow/core/Option;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
29-
public final fun executeWithBody (Lio/ktor/http/HttpMethod;Ljava/lang/String;Larrow/core/Option;Ljava/util/Map;Larrow/core/Option;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3032
public fun executeWithReuseCheck (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3133
public final fun get (Ljava/lang/String;Ljava/util/Map;Ljava/util/Map;Larrow/core/Option;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
3234
public final fun getKtorHttpClient ()Lio/ktor/client/HttpClient;
@@ -40,8 +42,8 @@ public final class com/trendyol/stove/testing/e2e/http/HttpSystem : com/trendyol
4042
public static synthetic fun postAndExpectBodilessResponse$default (Lcom/trendyol/stove/testing/e2e/http/HttpSystem;Ljava/lang/String;Larrow/core/Option;Larrow/core/Option;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
4143
public final fun putAndExpectBodilessResponse (Ljava/lang/String;Larrow/core/Option;Larrow/core/Option;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
4244
public static synthetic fun putAndExpectBodilessResponse$default (Lcom/trendyol/stove/testing/e2e/http/HttpSystem;Ljava/lang/String;Larrow/core/Option;Larrow/core/Option;Ljava/util/Map;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
45+
public final fun relative (Ljava/lang/String;)Lio/ktor/http/Url;
4346
public fun then ()Lcom/trendyol/stove/testing/e2e/system/TestSystem;
44-
public final fun toBodilessResponse (Lio/ktor/client/statement/HttpResponse;)Lcom/trendyol/stove/testing/e2e/http/StoveHttpResponse$Bodiless;
4547
public final fun toFormData (Ljava/util/List;)Ljava/util/List;
4648
}
4749

0 commit comments

Comments
 (0)