Merge branch '2.1.x'
This commit is contained in:
@@ -36,21 +36,21 @@ public class LinkTests {
|
||||
|
||||
@Test
|
||||
public void getHrefShouldReturnHref() {
|
||||
String href = "http://example.com";
|
||||
String href = "https://example.com";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.getHref()).isEqualTo(href);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTemplatedWhenContainsPlaceholderShouldReturnTrue() {
|
||||
String href = "http://example.com/{path}";
|
||||
String href = "https://example.com/{path}";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.isTemplated()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTemplatedWhenContainsNoPlaceholderShouldReturnFalse() {
|
||||
String href = "http://example.com/path";
|
||||
String href = "https://example.com/path";
|
||||
Link link = new Link(href);
|
||||
assertThat(link.isTemplated()).isFalse();
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ public class WebFluxEndpointIntegrationTests extends
|
||||
load(TestEndpointConfiguration.class, (client) -> client.options().uri("/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
|
||||
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
|
||||
.expectHeader()
|
||||
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
|
||||
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
|
||||
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST"));
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class WebFluxEndpointIntegrationTests extends
|
||||
Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
|
||||
return new WebFluxEndpointHandlerMapping(
|
||||
new EndpointMapping(environment.getProperty("endpointPath")),
|
||||
|
||||
@@ -88,9 +88,9 @@ public class MvcWebEndpointIntegrationTests extends
|
||||
load(TestEndpointConfiguration.class, (client) -> client.options().uri("/test")
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
|
||||
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
|
||||
.expectHeader()
|
||||
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
|
||||
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
|
||||
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST"));
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class MvcWebEndpointIntegrationTests extends
|
||||
Environment environment, WebEndpointDiscoverer endpointDiscoverer,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
|
||||
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
|
||||
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
|
||||
return new WebMvcEndpointHandlerMapping(
|
||||
new EndpointMapping(environment.getProperty("endpointPath")),
|
||||
|
||||
@@ -54,9 +54,9 @@ public class DefaultWebClientExchangeTagsProviderTests {
|
||||
public void setup() {
|
||||
this.request = ClientRequest
|
||||
.create(HttpMethod.GET,
|
||||
URI.create("http://example.org/projects/spring-boot"))
|
||||
URI.create("https://example.org/projects/spring-boot"))
|
||||
.attribute(URI_TEMPLATE_ATTRIBUTE,
|
||||
"http://example.org/projects/{project}")
|
||||
"https://example.org/projects/{project}")
|
||||
.build();
|
||||
this.response = mock(ClientResponse.class);
|
||||
given(this.response.statusCode()).willReturn(HttpStatus.OK);
|
||||
@@ -73,7 +73,7 @@ public class DefaultWebClientExchangeTagsProviderTests {
|
||||
@Test
|
||||
public void tagsWhenNoUriTemplateShouldProvideUriPath() {
|
||||
ClientRequest request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.org/projects/spring-boot")).build();
|
||||
URI.create("https://example.org/projects/spring-boot")).build();
|
||||
Iterable<Tag> tags = this.tagsProvider.tags(request, this.response, null);
|
||||
assertThat(tags).containsExactlyInAnyOrder(Tag.of("method", "GET"),
|
||||
Tag.of("uri", "/projects/spring-boot"),
|
||||
|
||||
@@ -71,7 +71,7 @@ public class MetricsWebClientFilterFunctionTests {
|
||||
@Test
|
||||
public void filterShouldRecordTimer() {
|
||||
ClientRequest request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.com/projects/spring-boot")).build();
|
||||
URI.create("https://example.com/projects/spring-boot")).build();
|
||||
given(this.response.statusCode()).willReturn(HttpStatus.OK);
|
||||
this.filterFunction.filter(request, this.exchange).block(Duration.ofSeconds(30));
|
||||
assertThat(this.registry.get("http.client.requests")
|
||||
@@ -83,7 +83,7 @@ public class MetricsWebClientFilterFunctionTests {
|
||||
public void filterWhenUriTemplatePresentShouldRecordTimer() {
|
||||
ClientRequest request = ClientRequest
|
||||
.create(HttpMethod.GET,
|
||||
URI.create("http://example.com/projects/spring-boot"))
|
||||
URI.create("https://example.com/projects/spring-boot"))
|
||||
.attribute(URI_TEMPLATE_ATTRIBUTE, "/projects/{project}").build();
|
||||
given(this.response.statusCode()).willReturn(HttpStatus.OK);
|
||||
this.filterFunction.filter(request, this.exchange).block(Duration.ofSeconds(30));
|
||||
@@ -95,7 +95,7 @@ public class MetricsWebClientFilterFunctionTests {
|
||||
@Test
|
||||
public void filterWhenIoExceptionThrownShouldRecordTimer() {
|
||||
ClientRequest request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.com/projects/spring-boot")).build();
|
||||
URI.create("https://example.com/projects/spring-boot")).build();
|
||||
ExchangeFunction errorExchange = (r) -> Mono.error(new IOException());
|
||||
this.filterFunction.filter(request, errorExchange)
|
||||
.onErrorResume(IOException.class, (t) -> Mono.empty())
|
||||
@@ -110,7 +110,7 @@ public class MetricsWebClientFilterFunctionTests {
|
||||
@Test
|
||||
public void filterWhenExceptionThrownShouldRecordTimer() {
|
||||
ClientRequest request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.com/projects/spring-boot")).build();
|
||||
URI.create("https://example.com/projects/spring-boot")).build();
|
||||
ExchangeFunction exchange = (r) -> Mono.error(new IllegalArgumentException());
|
||||
this.filterFunction.filter(request, exchange)
|
||||
.onErrorResume(IllegalArgumentException.class, (t) -> Mono.empty())
|
||||
@@ -124,7 +124,7 @@ public class MetricsWebClientFilterFunctionTests {
|
||||
@Test
|
||||
public void filterWhenExceptionAndRetryShouldNotCumulateRecordTime() {
|
||||
ClientRequest request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.com/projects/spring-boot")).build();
|
||||
URI.create("https://example.com/projects/spring-boot")).build();
|
||||
ExchangeFunction exchange = (r) -> Mono.error(new IllegalArgumentException())
|
||||
.delaySubscription(Duration.ofMillis(300)).cast(ClientResponse.class);
|
||||
this.filterFunction.filter(request, exchange).retry(1)
|
||||
|
||||
@@ -52,9 +52,9 @@ public class WebClientExchangeTagsTests {
|
||||
public void setup() {
|
||||
this.request = ClientRequest
|
||||
.create(HttpMethod.GET,
|
||||
URI.create("http://example.org/projects/spring-boot"))
|
||||
URI.create("https://example.org/projects/spring-boot"))
|
||||
.attribute(URI_TEMPLATE_ATTRIBUTE,
|
||||
"http://example.org/projects/{project}")
|
||||
"https://example.org/projects/{project}")
|
||||
.build();
|
||||
this.response = mock(ClientResponse.class);
|
||||
given(this.response.statusCode()).willReturn(HttpStatus.OK);
|
||||
@@ -76,7 +76,7 @@ public class WebClientExchangeTagsTests {
|
||||
public void uriWhenRelativeTemplateIsAvailableShouldReturnTemplate() {
|
||||
this.request = ClientRequest
|
||||
.create(HttpMethod.GET,
|
||||
URI.create("http://example.org/projects/spring-boot"))
|
||||
URI.create("https://example.org/projects/spring-boot"))
|
||||
.attribute(URI_TEMPLATE_ATTRIBUTE, "/projects/{project}").build();
|
||||
assertThat(WebClientExchangeTags.uri(this.request))
|
||||
.isEqualTo(Tag.of("uri", "/projects/{project}"));
|
||||
@@ -85,7 +85,7 @@ public class WebClientExchangeTagsTests {
|
||||
@Test
|
||||
public void uriWhenTemplateIsMissingShouldReturnPath() {
|
||||
this.request = ClientRequest.create(HttpMethod.GET,
|
||||
URI.create("http://example.org/projects/spring-boot")).build();
|
||||
URI.create("https://example.org/projects/spring-boot")).build();
|
||||
assertThat(WebClientExchangeTags.uri(this.request))
|
||||
.isEqualTo(Tag.of("uri", "/projects/spring-boot"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user