Search in sources :

Example 26 with WebServiceTemplate

use of org.springframework.ws.client.core.WebServiceTemplate in project spring-boot by spring-projects.

the class WebServiceTemplateBuilderTests method additionalMessageSendersShouldKeepDetectedHttpMessageSender.

@Test
void additionalMessageSendersShouldKeepDetectedHttpMessageSender() {
    WebServiceTemplate template = this.builder.additionalMessageSenders(this.messageSender).build();
    assertThat(template.getMessageSenders()).contains(this.messageSender);
    assertThat(template.getMessageSenders()).hasSize(2);
}
Also used : WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) Test(org.junit.jupiter.api.Test)

Example 27 with WebServiceTemplate

use of org.springframework.ws.client.core.WebServiceTemplate in project spring-boot by spring-projects.

the class WebServiceTemplateBuilderTests method buildShouldDetectHttpMessageSender.

@Test
void buildShouldDetectHttpMessageSender() {
    WebServiceTemplate webServiceTemplate = this.builder.build();
    assertThat(webServiceTemplate.getMessageSenders()).hasSize(1);
    WebServiceMessageSender messageSender = webServiceTemplate.getMessageSenders()[0];
    assertHttpComponentsRequestFactory(messageSender);
}
Also used : WebServiceMessageSender(org.springframework.ws.transport.WebServiceMessageSender) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) Test(org.junit.jupiter.api.Test)

Example 28 with WebServiceTemplate

use of org.springframework.ws.client.core.WebServiceTemplate in project spring-boot by spring-projects.

the class WebServiceTemplateBuilderTests method setWebServiceMessageFactory.

@Test
void setWebServiceMessageFactory() {
    WebServiceMessageFactory messageFactory = mock(WebServiceMessageFactory.class);
    WebServiceTemplate template = this.builder.setWebServiceMessageFactory(messageFactory).build();
    assertThat(template.getMessageFactory()).isEqualTo(messageFactory);
}
Also used : WebServiceMessageFactory(org.springframework.ws.WebServiceMessageFactory) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) Test(org.junit.jupiter.api.Test)

Example 29 with WebServiceTemplate

use of org.springframework.ws.client.core.WebServiceTemplate in project spring-boot by spring-projects.

the class WebServiceTemplateBuilderTests method additionalInterceptorsShouldAddToExisting.

@Test
void additionalInterceptorsShouldAddToExisting() {
    ClientInterceptor interceptor = mock(ClientInterceptor.class);
    WebServiceTemplate template = this.builder.interceptors(interceptor).additionalInterceptors(this.interceptor).build();
    assertThat(template.getInterceptors()).containsOnly(interceptor, this.interceptor);
}
Also used : ClientInterceptor(org.springframework.ws.client.support.interceptor.ClientInterceptor) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) Test(org.junit.jupiter.api.Test)

Example 30 with WebServiceTemplate

use of org.springframework.ws.client.core.WebServiceTemplate in project spring-boot by spring-projects.

the class WebServiceTemplateBuilderTests method setDefaultUri.

@Test
void setDefaultUri() {
    URI uri = URI.create("http://localhost:8080");
    WebServiceTemplate webServiceTemplate = this.builder.setDefaultUri(uri.toString()).build();
    assertThat(webServiceTemplate.getDestinationProvider().getDestination()).isEqualTo(uri);
}
Also used : WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) URI(java.net.URI) Test(org.junit.jupiter.api.Test)

Aggregations

WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)30 Test (org.junit.jupiter.api.Test)24 URI (java.net.URI)4 ClientInterceptor (org.springframework.ws.client.support.interceptor.ClientInterceptor)4 WebServiceMessageSender (org.springframework.ws.transport.WebServiceMessageSender)4 WebServiceMessageFactory (org.springframework.ws.WebServiceMessageFactory)3 ClientHttpRequestMessageSender (org.springframework.ws.transport.http.ClientHttpRequestMessageSender)3 SAXTransformerFactory (javax.xml.transform.sax.SAXTransformerFactory)2 Test (org.junit.Test)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 Marshaller (org.springframework.oxm.Marshaller)2 Unmarshaller (org.springframework.oxm.Unmarshaller)2 FaultMessageResolver (org.springframework.ws.client.core.FaultMessageResolver)2 WebServiceMessageCallback (org.springframework.ws.client.core.WebServiceMessageCallback)2 DestinationProvider (org.springframework.ws.client.support.destination.DestinationProvider)2 HttpUrlConnectionMessageSender (org.springframework.ws.transport.http.HttpUrlConnectionMessageSender)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Collection (java.util.Collection)1