Merge branch '4.0.x'

Closes gh-1498
This commit is contained in:
Stéphane Nicoll
2025-03-11 14:34:27 +01:00
10 changed files with 26 additions and 47 deletions

View File

@@ -218,12 +218,12 @@ public class HttpComponents5ClientFactory implements FactoryBean<CloseableHttpCl
applyMaxConnectionsPerHost(this.connectionManager);
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() //
.setConnectTimeout(Timeout.of(this.connectionTimeout)) //
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
.setConnectTimeout(Timeout.of(this.connectionTimeout))
.setResponseTimeout(Timeout.of(this.readTimeout));
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create() //
.setDefaultRequestConfig(requestConfigBuilder.build()) //
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfigBuilder.build())
.setConnectionManager(this.connectionManager);
if (this.credentials != null && this.authScope != null) {

View File

@@ -183,17 +183,13 @@ public class HttpComponents5Connection extends AbstractHttpSenderConnection {
@Override
public Iterator<String> getResponseHeaderNames() throws IOException {
return Arrays.stream(this.httpResponse.getHeaders()) //
.map(NameValuePair::getName) //
.iterator();
return Arrays.stream(this.httpResponse.getHeaders()).map(NameValuePair::getName).iterator();
}
@Override
public Iterator<String> getResponseHeaders(String name) throws IOException {
return Arrays.stream(this.httpResponse.getHeaders(name)) //
.map(NameValuePair::getValue) //
.iterator();
return Arrays.stream(this.httpResponse.getHeaders(name)).map(NameValuePair::getValue).iterator();
}
}

View File

@@ -126,9 +126,7 @@ public class JdkHttpClientConnection extends AbstractHttpSenderConnection {
if (this.response != null) {
return this.response.headers() //
.firstValueAsLong(HttpTransportConstants.HEADER_CONTENT_LENGTH) //
.orElse(-1);
return this.response.headers().firstValueAsLong(HttpTransportConstants.HEADER_CONTENT_LENGTH).orElse(-1);
}
return 0;

View File

@@ -40,8 +40,7 @@ public class SourcePayloadMethodProcessorTest extends AbstractPayloadMethodProce
@Override
protected MethodParameter[] createSupportedParameters() throws NoSuchMethodException {
return new MethodParameter[] { //
new MethodParameter(getClass().getMethod("source", Source.class), 0),
return new MethodParameter[] { new MethodParameter(getClass().getMethod("source", Source.class), 0),
new MethodParameter(getClass().getMethod("dom", DOMSource.class), 0),
new MethodParameter(getClass().getMethod("sax", SAXSource.class), 0),
new MethodParameter(getClass().getMethod("stream", StreamSource.class), 0),
@@ -51,8 +50,7 @@ public class SourcePayloadMethodProcessorTest extends AbstractPayloadMethodProce
@Override
protected MethodParameter[] createSupportedReturnTypes() throws NoSuchMethodException {
return new MethodParameter[] { //
new MethodParameter(getClass().getMethod("source", Source.class), -1),
return new MethodParameter[] { new MethodParameter(getClass().getMethod("source", Source.class), -1),
new MethodParameter(getClass().getMethod("dom", DOMSource.class), -1),
new MethodParameter(getClass().getMethod("sax", SAXSource.class), -1),
new MethodParameter(getClass().getMethod("stream", StreamSource.class), -1),

View File

@@ -205,12 +205,9 @@ public class XPathParamMethodArgumentResolverTest {
public void unsupported(String s) {
}
public void supportedTypes( //
@XPathParam("/root/child") boolean param1, //
@XPathParam("/root/child/number") double param2, //
@XPathParam("/root/child") Node param3, //
@XPathParam("/root/*") NodeList param4, //
@XPathParam("/root/child/text") String param5) {
public void supportedTypes(@XPathParam("/root/child") boolean param1,
@XPathParam("/root/child/number") double param2, @XPathParam("/root/child") Node param3,
@XPathParam("/root/*") NodeList param4, @XPathParam("/root/child/text") String param5) {
}
public void convertedType(@XPathParam("/root/child/number") int param) {

View File

@@ -156,8 +156,7 @@ public class PayloadRootAnnotationMethodEndpointMappingTest {
logger.info("In doIt()");
}
@PayloadRoots({ //
@PayloadRoot(localPart = "Request1", namespace = "http://springframework.org/spring-ws"),
@PayloadRoots({ @PayloadRoot(localPart = "Request1", namespace = "http://springframework.org/spring-ws"),
@PayloadRoot(localPart = "Request2", namespace = "http://springframework.org/spring-ws") })
public void doItMultiple() {
}

View File

@@ -58,9 +58,9 @@ public abstract class AbstractWsAddressingTest {
Document resultDocument = result.getSaajMessage().getSOAPPart();
XmlAssert.assertThat(resultDocument)
.and(expectedDocument) //
.ignoreWhitespace() //
.ignoreChildNodesOrder() //
.and(expectedDocument)
.ignoreWhitespace()
.ignoreChildNodesOrder()
.areSimilar();
}
@@ -69,10 +69,7 @@ public abstract class AbstractWsAddressingTest {
Document expectedDocument = expected.getSaajMessage().getSOAPPart();
Document resultDocument = result.getSaajMessage().getSOAPPart();
XmlAssert.assertThat(resultDocument)
.and(expectedDocument) //
.ignoreWhitespace() //
.areNotSimilar();
XmlAssert.assertThat(resultDocument).and(expectedDocument).ignoreWhitespace().areNotSimilar();
}
}

View File

@@ -33,9 +33,9 @@ class HttpComponents5ContentTypeIntegrationTest
return chain.proceed(request, scope);
};
HttpClient client = HttpClientBuilder.create() //
.addRequestInterceptorFirst(new HttpComponents5MessageSender.RemoveSoapHeadersInterceptor()) //
.addExecInterceptorFirst("handler with assertion", testHandler) //
HttpClient client = HttpClientBuilder.create()
.addRequestInterceptorFirst(new HttpComponents5MessageSender.RemoveSoapHeadersInterceptor())
.addExecInterceptorFirst("handler with assertion", testHandler)
.build();
return new HttpComponents5MessageSender(client);

View File

@@ -67,12 +67,12 @@ public class PayloadDiffMatcher extends DiffMatcher {
Document expectedDocument = createDocumentFromSource(this.expected);
Document actualDocument = createDocumentFromSource(payload);
return DiffBuilder.compare(expectedDocument) //
.withTest(actualDocument) //
.ignoreWhitespace() //
return DiffBuilder.compare(expectedDocument)
.withTest(actualDocument)
.ignoreWhitespace()
.withDifferenceEvaluator(
DifferenceEvaluators.chain(new PlaceholderDifferenceEvaluator(), DifferenceEvaluators.Default))
.checkForSimilar() //
.checkForSimilar()
.build();
}

View File

@@ -85,10 +85,7 @@ public class CommonsXsdSchemaCollectionTest {
DOMResult domResult = new DOMResult();
this.transformer.transform(schemas[0].getSource(), domResult);
XmlAssert.assertThat(domResult.getNode())
.and(expected) //
.ignoreWhitespace() //
.areIdentical();
XmlAssert.assertThat(domResult.getNode()).and(expected).ignoreWhitespace().areIdentical();
assertThat(schemas[1].getTargetNamespace()).isEqualTo("urn:2");
Resource cd = new ClassPathResource("CD.xsd", AbstractXsdSchemaTest.class);
@@ -96,10 +93,7 @@ public class CommonsXsdSchemaCollectionTest {
domResult = new DOMResult();
this.transformer.transform(schemas[1].getSource(), domResult);
XmlAssert.assertThat(domResult.getNode())
.and(expected) //
.ignoreWhitespace() //
.areIdentical();
XmlAssert.assertThat(domResult.getNode()).and(expected).ignoreWhitespace().areIdentical();
}
@Test