use of org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner in project spring-cloud-gateway by spring-cloud.
the class GatewayAutoConfigurationTests method nettyHttpClientDefaults.
@Test
public void nettyHttpClientDefaults() {
new ReactiveWebApplicationContextRunner().withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, GatewayAutoConfiguration.class)).withPropertyValues("debug=true").run(context -> {
assertThat(context).hasSingleBean(HttpClient.class);
HttpClient httpClient = context.getBean(HttpClient.class);
HttpClientOptions options = httpClient.options();
PoolResources poolResources = options.getPoolResources();
assertThat(poolResources).isNotNull();
// TODO: howto test PoolResources
ClientProxyOptions proxyOptions = options.getProxyOptions();
assertThat(proxyOptions).isNull();
SslContext sslContext = options.sslContext();
assertThat(sslContext).isNull();
});
}
use of org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner in project spring-cloud-gateway by spring-cloud.
the class GatewayAutoConfigurationTests method nettyHttpClientConfigured.
@Test
public void nettyHttpClientConfigured() {
new ReactiveWebApplicationContextRunner().withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.class, GatewayAutoConfiguration.class)).withPropertyValues("spring.cloud.gateway.httpclient.ssl.use-insecure-trust-manager=true", "spring.cloud.gateway.httpclient.pool.type=fixed", "spring.cloud.gateway.httpclient.proxy.host=myhost").run(context -> {
assertThat(context).hasSingleBean(HttpClient.class);
HttpClient httpClient = context.getBean(HttpClient.class);
HttpClientOptions options = httpClient.options();
PoolResources poolResources = options.getPoolResources();
assertThat(poolResources).isNotNull();
// TODO: howto test PoolResources
ClientProxyOptions proxyOptions = options.getProxyOptions();
assertThat(proxyOptions).isNotNull();
assertThat(proxyOptions.getAddress().get().getHostName()).isEqualTo("myhost");
SslContext sslContext = options.sslContext();
assertThat(sslContext).isNotNull();
// TODO: howto test SslContext
});
}
Aggregations