Merge branch '2.1.x'
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.autoconfigure.freemarker;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.time.Duration;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -60,7 +61,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
|
||||
public void defaultViewResolution() {
|
||||
this.contextRunner.run((context) -> {
|
||||
MockServerWebExchange exchange = render(context, "home");
|
||||
String result = exchange.getResponse().getBodyAsString().block();
|
||||
String result = exchange.getResponse().getBodyAsString()
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertThat(result).contains("home");
|
||||
assertThat(exchange.getResponse().getHeaders().getContentType())
|
||||
.isEqualTo(MediaType.TEXT_HTML);
|
||||
@@ -72,7 +74,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
|
||||
this.contextRunner.withPropertyValues("spring.freemarker.prefix:prefix/")
|
||||
.run((context) -> {
|
||||
MockServerWebExchange exchange = render(context, "prefixed");
|
||||
String result = exchange.getResponse().getBodyAsString().block();
|
||||
String result = exchange.getResponse().getBodyAsString()
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertThat(result).contains("prefixed");
|
||||
});
|
||||
}
|
||||
@@ -82,7 +85,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
|
||||
this.contextRunner.withPropertyValues("spring.freemarker.suffix:.freemarker")
|
||||
.run((context) -> {
|
||||
MockServerWebExchange exchange = render(context, "suffixed");
|
||||
String result = exchange.getResponse().getBodyAsString().block();
|
||||
String result = exchange.getResponse().getBodyAsString()
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertThat(result).contains("suffixed");
|
||||
});
|
||||
}
|
||||
@@ -93,7 +97,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
|
||||
"spring.freemarker.templateLoaderPath:classpath:/custom-templates/")
|
||||
.run((context) -> {
|
||||
MockServerWebExchange exchange = render(context, "custom");
|
||||
String result = exchange.getResponse().getBodyAsString().block();
|
||||
String result = exchange.getResponse().getBodyAsString()
|
||||
.block(Duration.ofSeconds(30));
|
||||
assertThat(result).contains("custom");
|
||||
});
|
||||
}
|
||||
@@ -128,7 +133,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
|
||||
Mono<View> view = resolver.resolveViewName(viewName, Locale.UK);
|
||||
MockServerWebExchange exchange = MockServerWebExchange
|
||||
.from(MockServerHttpRequest.get("/path"));
|
||||
view.flatMap((v) -> v.render(null, MediaType.TEXT_HTML, exchange)).block();
|
||||
view.flatMap((v) -> v.render(null, MediaType.TEXT_HTML, exchange))
|
||||
.block(Duration.ofSeconds(30));
|
||||
return exchange;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.security.oauth2.client.reactive;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -77,7 +78,7 @@ public class ReactiveOAuth2ClientAutoConfigurationTests {
|
||||
ReactiveClientRegistrationRepository repository = context
|
||||
.getBean(ReactiveClientRegistrationRepository.class);
|
||||
ClientRegistration registration = repository
|
||||
.findByRegistrationId("foo").block();
|
||||
.findByRegistrationId("foo").block(Duration.ofSeconds(30));
|
||||
assertThat(registration).isNotNull();
|
||||
assertThat(registration.getClientSecret()).isEqualTo("secret");
|
||||
});
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.security.reactive;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -55,8 +57,8 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
|
||||
.run((context) -> {
|
||||
ReactiveUserDetailsService userDetailsService = context
|
||||
.getBean(ReactiveUserDetailsService.class);
|
||||
assertThat(userDetailsService.findByUsername("user").block())
|
||||
.isNotNull();
|
||||
assertThat(userDetailsService.findByUsername("user")
|
||||
.block(Duration.ofSeconds(30))).isNotNull();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,12 +69,12 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
|
||||
.run((context) -> {
|
||||
ReactiveUserDetailsService userDetailsService = context
|
||||
.getBean(ReactiveUserDetailsService.class);
|
||||
assertThat(userDetailsService.findByUsername("user").block())
|
||||
.isNull();
|
||||
assertThat(userDetailsService.findByUsername("foo").block())
|
||||
.isNotNull();
|
||||
assertThat(userDetailsService.findByUsername("admin").block())
|
||||
.isNotNull();
|
||||
assertThat(userDetailsService.findByUsername("user")
|
||||
.block(Duration.ofSeconds(30))).isNull();
|
||||
assertThat(userDetailsService.findByUsername("foo")
|
||||
.block(Duration.ofSeconds(30))).isNotNull();
|
||||
assertThat(userDetailsService.findByUsername("admin")
|
||||
.block(Duration.ofSeconds(30))).isNotNull();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -93,8 +95,8 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
|
||||
.run(((context) -> {
|
||||
MapReactiveUserDetailsService userDetailsService = context
|
||||
.getBean(MapReactiveUserDetailsService.class);
|
||||
String password = userDetailsService.findByUsername("user").block()
|
||||
.getPassword();
|
||||
String password = userDetailsService.findByUsername("user")
|
||||
.block(Duration.ofSeconds(30)).getPassword();
|
||||
assertThat(password).startsWith("{noop}");
|
||||
}));
|
||||
}
|
||||
@@ -122,8 +124,8 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
|
||||
.run(((context) -> {
|
||||
MapReactiveUserDetailsService userDetailsService = context
|
||||
.getBean(MapReactiveUserDetailsService.class);
|
||||
String password = userDetailsService.findByUsername("user").block()
|
||||
.getPassword();
|
||||
String password = userDetailsService.findByUsername("user")
|
||||
.block(Duration.ofSeconds(30)).getPassword();
|
||||
assertThat(password).isEqualTo(expectedPassword);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.security.reactive;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.assertj.core.api.AssertDelegateTarget;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -113,8 +115,8 @@ public class StaticResourceRequestTests {
|
||||
}
|
||||
|
||||
private void matches(ServerWebExchange exchange) {
|
||||
assertThat(this.matcher.matches(exchange).block().isMatch())
|
||||
.as("Matches " + getRequestPath(exchange)).isTrue();
|
||||
assertThat(this.matcher.matches(exchange).block(Duration.ofSeconds(30))
|
||||
.isMatch()).as("Matches " + getRequestPath(exchange)).isTrue();
|
||||
}
|
||||
|
||||
void doesNotMatch(String path) {
|
||||
@@ -125,8 +127,9 @@ public class StaticResourceRequestTests {
|
||||
}
|
||||
|
||||
private void doesNotMatch(ServerWebExchange exchange) {
|
||||
assertThat(this.matcher.matches(exchange).block().isMatch())
|
||||
.as("Does not match " + getRequestPath(exchange)).isFalse();
|
||||
assertThat(this.matcher.matches(exchange).block(Duration.ofSeconds(30))
|
||||
.isMatch()).as("Does not match " + getRequestPath(exchange))
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
private TestHttpWebHandlerAdapter webHandler() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.autoconfigure.web.reactive.function.client;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -109,8 +110,10 @@ public class WebClientAutoConfigurationTests {
|
||||
secondBuilder.clientConnector(secondConnector)
|
||||
.baseUrl("http://second.example.org");
|
||||
assertThat(firstBuilder).isNotEqualTo(secondBuilder);
|
||||
firstBuilder.build().get().uri("/foo").exchange().block();
|
||||
secondBuilder.build().get().uri("/foo").exchange().block();
|
||||
firstBuilder.build().get().uri("/foo").exchange()
|
||||
.block(Duration.ofSeconds(30));
|
||||
secondBuilder.build().get().uri("/foo").exchange()
|
||||
.block(Duration.ofSeconds(30));
|
||||
verify(firstConnector).connect(eq(HttpMethod.GET),
|
||||
eq(URI.create("http://first.example.org/foo")), any());
|
||||
verify(secondConnector).connect(eq(HttpMethod.GET),
|
||||
|
||||
Reference in New Issue
Block a user