use of org.springframework.ws.transport.http.ClientHttpRequestMessageSender in project spring-boot by spring-projects.
the class WebServiceTemplateBuilderTests method additionalMessageSendersShouldAddToExisting.
@Test
void additionalMessageSendersShouldAddToExisting() {
ClientHttpRequestMessageSender httpMessageSender = new ClientHttpRequestMessageSender();
WebServiceTemplate template = this.builder.messageSenders(httpMessageSender).additionalMessageSenders(this.messageSender).build();
assertThat(template.getMessageSenders()).containsOnly(httpMessageSender, this.messageSender);
}
use of org.springframework.ws.transport.http.ClientHttpRequestMessageSender in project spring-boot by spring-projects.
the class HttpWebServiceMessageSenderBuilderOkHttp3IntegrationTests method assertOkHttp3RequestFactory.
private OkHttp3ClientHttpRequestFactory assertOkHttp3RequestFactory(WebServiceMessageSender messageSender) {
assertThat(messageSender).isInstanceOf(ClientHttpRequestMessageSender.class);
ClientHttpRequestMessageSender sender = (ClientHttpRequestMessageSender) messageSender;
ClientHttpRequestFactory requestFactory = sender.getRequestFactory();
assertThat(requestFactory).isInstanceOf(OkHttp3ClientHttpRequestFactory.class);
return (OkHttp3ClientHttpRequestFactory) requestFactory;
}
use of org.springframework.ws.transport.http.ClientHttpRequestMessageSender in project spring-boot by spring-projects.
the class HttpWebServiceMessageSenderBuilderTests method buildUsesHttpComponentsByDefault.
@Test
void buildUsesHttpComponentsByDefault() {
ClientHttpRequestMessageSender messageSender = build(new HttpWebServiceMessageSenderBuilder().setConnectTimeout(Duration.ofSeconds(5)).setReadTimeout(Duration.ofSeconds(2)));
ClientHttpRequestFactory requestFactory = messageSender.getRequestFactory();
assertThat(requestFactory).isInstanceOf(HttpComponentsClientHttpRequestFactory.class);
RequestConfig requestConfig = (RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig");
assertThat(requestConfig).isNotNull();
assertThat(requestConfig.getConnectTimeout()).isEqualTo(5000);
assertThat(requestConfig.getSocketTimeout()).isEqualTo(2000);
}
use of org.springframework.ws.transport.http.ClientHttpRequestMessageSender in project spring-boot by spring-projects.
the class HttpWebServiceMessageSenderBuilderTests method buildWithReadAndConnectTimeout.
@Test
void buildWithReadAndConnectTimeout() {
ClientHttpRequestMessageSender messageSender = build(new HttpWebServiceMessageSenderBuilder().requestFactory(SimpleClientHttpRequestFactory::new).setConnectTimeout(Duration.ofSeconds(5)).setReadTimeout(Duration.ofSeconds(2)));
SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) messageSender.getRequestFactory();
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 5000);
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 2000);
}
use of org.springframework.ws.transport.http.ClientHttpRequestMessageSender in project spring-boot by spring-projects.
the class HttpWebServiceMessageSenderBuilderTests method buildWithRequestFactorySupplier.
@Test
void buildWithRequestFactorySupplier() {
ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class);
ClientHttpRequestMessageSender messageSender = build(new HttpWebServiceMessageSenderBuilder().requestFactory(() -> requestFactory));
assertThat(messageSender.getRequestFactory()).isSameAs(requestFactory);
}
Aggregations