|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2012-2020 the original author or authors. |
|
|
|
* Copyright 2012-2022 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -61,7 +61,7 @@ class DefaultWebClientExchangeTagsProviderTests { |
|
|
|
void tagsShouldBePopulated() { |
|
|
|
void tagsShouldBePopulated() { |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, this.response, null); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, this.response, null); |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
Tag.of("clientName", "example.org"), Tag.of("status", "200"), Tag.of("outcome", "SUCCESS")); |
|
|
|
Tag.of("client.name", "example.org"), Tag.of("status", "200"), Tag.of("outcome", "SUCCESS")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -70,28 +70,28 @@ class DefaultWebClientExchangeTagsProviderTests { |
|
|
|
.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot")).build(); |
|
|
|
.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot")).build(); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(request, this.response, null); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(request, this.response, null); |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/spring-boot"), |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/spring-boot"), |
|
|
|
Tag.of("clientName", "example.org"), Tag.of("status", "200"), Tag.of("outcome", "SUCCESS")); |
|
|
|
Tag.of("client.name", "example.org"), Tag.of("status", "200"), Tag.of("outcome", "SUCCESS")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void tagsWhenIoExceptionShouldReturnIoErrorStatus() { |
|
|
|
void tagsWhenIoExceptionShouldReturnIoErrorStatus() { |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, new IOException()); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, new IOException()); |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
Tag.of("clientName", "example.org"), Tag.of("status", "IO_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
Tag.of("client.name", "example.org"), Tag.of("status", "IO_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void tagsWhenExceptionShouldReturnClientErrorStatus() { |
|
|
|
void tagsWhenExceptionShouldReturnClientErrorStatus() { |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, new IllegalArgumentException()); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, new IllegalArgumentException()); |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
Tag.of("clientName", "example.org"), Tag.of("status", "CLIENT_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
Tag.of("client.name", "example.org"), Tag.of("status", "CLIENT_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void tagsWhenCancelledRequestShouldReturnClientErrorStatus() { |
|
|
|
void tagsWhenCancelledRequestShouldReturnClientErrorStatus() { |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, null); |
|
|
|
Iterable<Tag> tags = this.tagsProvider.tags(this.request, null, null); |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"), Tag.of("uri", "/projects/{project}"), |
|
|
|
Tag.of("clientName", "example.org"), Tag.of("status", "CLIENT_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
Tag.of("client.name", "example.org"), Tag.of("status", "CLIENT_ERROR"), Tag.of("outcome", "UNKNOWN")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|