Format code with spring-javaformat

This commit configures the build to use spring-javaformat and makes a
first pass to format the code of the project. As part of this, imports
have been optimized, and the license header has been harmonized.

Closes gh-1458
This commit is contained in:
Stéphane Nicoll
2025-02-19 13:32:37 +01:00
parent ac71c3017b
commit fdede99aa0
679 changed files with 10401 additions and 7621 deletions

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,11 +16,11 @@
package org.springframework.ws;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractWebServiceMessageFactoryTestCase {
protected WebServiceMessageFactory messageFactory;
@@ -39,4 +39,5 @@ public abstract class AbstractWebServiceMessageFactoryTestCase {
}
protected abstract WebServiceMessageFactory createMessageFactory() throws Exception;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws;
import static org.xmlunit.assertj.XmlAssert.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -46,6 +44,12 @@ import javax.xml.transform.stream.StreamSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.util.FileCopyUtils;
@@ -55,11 +59,8 @@ import org.springframework.xml.XMLInputFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
import static org.xmlunit.assertj.XmlAssert.assertThat;
public abstract class AbstractWebServiceMessageTestCase {
@@ -159,7 +160,9 @@ public abstract class AbstractWebServiceMessageTestCase {
ByteArrayOutputStream expectedStream = new ByteArrayOutputStream();
FileCopyUtils.copy(payload.getInputStream(), expectedStream);
assertThat(resultStream.toString(StandardCharsets.UTF_8)).and(expectedStream.toString(StandardCharsets.UTF_8)).ignoreWhitespace().areIdentical();
assertThat(resultStream.toString(StandardCharsets.UTF_8)).and(expectedStream.toString(StandardCharsets.UTF_8))
.ignoreWhitespace()
.areIdentical();
validateMessage();
}
@@ -194,4 +197,5 @@ public abstract class AbstractWebServiceMessageTestCase {
}
protected abstract WebServiceMessage createWebServiceMessage() throws Exception;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -57,7 +57,8 @@ public class MockWebServiceMessage implements FaultAwareWebServiceMessage {
private String faultReason;
public MockWebServiceMessage() {}
public MockWebServiceMessage() {
}
public MockWebServiceMessage(Source source) throws TransformerException {
@@ -192,21 +193,26 @@ public class MockWebServiceMessage implements FaultAwareWebServiceMessage {
}
@Override
public void close() {}
public void close() {
}
@Override
public void flush() {}
public void flush() {
}
@Override
public void write(char cbuf[], int off, int len) {
if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
}
else if (len == 0) {
return;
}
content.append(cbuf, off, len);
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -34,8 +34,10 @@ public class MockWebServiceMessageFactory implements WebServiceMessageFactory {
try {
return new MockWebServiceMessage(new StreamSource(inputStream));
} catch (TransformerException ex) {
}
catch (TransformerException ex) {
throw new IOException(ex.getMessage());
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,7 +16,17 @@
package org.springframework.ws.client.core;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.xml.namespace.QName;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import jakarta.activation.DataHandler;
import jakarta.mail.util.ByteArrayDataSource;
@@ -31,19 +41,6 @@ import jakarta.xml.soap.MimeHeaders;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPException;
import jakarta.xml.soap.SOAPMessage;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.xml.namespace.QName;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.jetty.server.Connector;
@@ -55,6 +52,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
@@ -68,7 +67,9 @@ import org.springframework.ws.transport.support.FreePortScanner;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
@@ -137,7 +138,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
logger.info(">>> Test case");
StringResult result = new StringResult();
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/echo", new StringSource(messagePayload), result);
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/echo", new StringSource(messagePayload),
result);
assertThat(b).isTrue();
XmlAssert.assertThat(result.toString()).and(messagePayload).ignoreWhitespace().areIdentical();
@@ -146,8 +148,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
@Test
public void sendSourceAndReceiveToResultNoResponse() {
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/noResponse", new StringSource(messagePayload),
new StringResult());
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/noResponse",
new StringSource(messagePayload), new StringResult());
assertThat(b).isFalse();
}
@@ -166,7 +168,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
assertThat(requestObject).isEqualTo(graph);
try {
transformer.transform(new StringSource(messagePayload), result);
} catch (TransformerException e) {
}
catch (TransformerException e) {
throw new RuntimeException(e);
}
}
@@ -217,7 +220,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
assertThat(requestObject).isEqualTo(graph);
try {
transformer.transform(new StringSource(messagePayload), result);
} catch (TransformerException e) {
}
catch (TransformerException e) {
throw new RuntimeException(e);
}
}
@@ -240,8 +244,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
public void notFound() {
assertThatExceptionOfType(WebServiceTransportException.class)
.isThrownBy(() -> template.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound",
new StringSource(messagePayload), new StringResult()));
.isThrownBy(() -> template.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound",
new StringSource(messagePayload), new StringResult()));
}
@Test
@@ -249,8 +253,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
Result result = new StringResult();
assertThatExceptionOfType(SoapFaultClientException.class).isThrownBy(
() -> template.sendSourceAndReceiveToResult(baseUrl + "/soap/fault", new StringSource(messagePayload), result));
assertThatExceptionOfType(SoapFaultClientException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/soap/fault", new StringSource(messagePayload), result));
}
@Test
@@ -261,19 +265,20 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
template.setCheckConnectionForError(false);
assertThatExceptionOfType(SoapFaultClientException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/soap/badRequestFault", new StringSource(messagePayload), result));
.sendSourceAndReceiveToResult(baseUrl + "/soap/badRequestFault", new StringSource(messagePayload), result));
}
@Test
public void attachment() {
template.sendSourceAndReceiveToResult(baseUrl + "/soap/attachment", new StringSource(messagePayload), message -> {
template.sendSourceAndReceiveToResult(baseUrl + "/soap/attachment", new StringSource(messagePayload),
message -> {
SoapMessage soapMessage = (SoapMessage) message;
final String attachmentContent = "content";
soapMessage.addAttachment("attachment-1",
new DataHandler(new ByteArrayDataSource(attachmentContent, "text/plain")));
}, new StringResult());
SoapMessage soapMessage = (SoapMessage) message;
final String attachmentContent = "content";
soapMessage.addAttachment("attachment-1",
new DataHandler(new ByteArrayDataSource(attachmentContent, "text/plain")));
}, new StringResult());
}
/** Servlet that returns and error message for a given status code. */
@@ -290,6 +295,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.sendError(sc);
}
}
/** Abstract SOAP Servlet */
@@ -311,7 +317,8 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
try {
messageFactory = MessageFactory.newInstance();
} catch (SOAPException ex) {
}
catch (SOAPException ex) {
throw new ServletException("Unable to create message factory" + ex.getMessage());
}
}
@@ -339,10 +346,12 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
putHeaders(reply.getMimeHeaders(), resp);
reply.writeTo(resp.getOutputStream());
} else if (sc == -1) {
}
else if (sc == -1) {
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
}
} catch (Exception ex) {
}
catch (Exception ex) {
throw new ServletException("SAAJ POST failed " + ex.getMessage(), ex);
}
}
@@ -378,6 +387,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
}
protected abstract SOAPMessage onMessage(SOAPMessage message) throws SOAPException;
}
@SuppressWarnings("serial")
@@ -387,6 +397,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
protected SOAPMessage onMessage(SOAPMessage message) {
return message;
}
}
@SuppressWarnings("serial")
@@ -396,6 +407,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
protected SOAPMessage onMessage(SOAPMessage message) {
return null;
}
}
@SuppressWarnings("serial")
@@ -409,6 +421,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
body.addFault(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"), "Server fault");
return response;
}
}
@SuppressWarnings("serial")
@@ -420,6 +433,7 @@ public abstract class AbstractSoap11WebServiceTemplateIntegrationTestCase {
assertThat(message.countAttachments()).isEqualTo(1);
return null;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,7 +16,16 @@
package org.springframework.ws.client.core;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import jakarta.activation.CommandMap;
import jakarta.activation.DataHandler;
@@ -34,18 +43,6 @@ import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPException;
import jakarta.xml.soap.SOAPMessage;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
@@ -55,6 +52,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
@@ -67,7 +66,9 @@ import org.springframework.ws.transport.support.FreePortScanner;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
@@ -117,8 +118,9 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
}
/**
* A workaround for the faulty XmlDataContentHandler in the SAAJ RI, which cannot handle mime types such as "text/xml;
* charset=UTF-8", causing issues with Axiom. We basically reset the command map
* A workaround for the faulty XmlDataContentHandler in the SAAJ RI, which cannot
* handle mime types such as "text/xml; charset=UTF-8", causing issues with Axiom. We
* basically reset the command map
*/
@BeforeEach
public void removeXmlDataContentHandler() throws SOAPException {
@@ -142,7 +144,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
public void sendSourceAndReceiveToResult() {
StringResult result = new StringResult();
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/echo", new StringSource(messagePayload), result);
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/echo", new StringSource(messagePayload),
result);
assertThat(b).isTrue();
XmlAssert.assertThat(result.toString()).and(messagePayload).ignoreWhitespace().areIdentical();
@@ -151,8 +154,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
@Test
public void sendSourceAndReceiveToResultNoResponse() {
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/noResponse", new StringSource(messagePayload),
new StringResult());
boolean b = template.sendSourceAndReceiveToResult(baseUrl + "/soap/noResponse",
new StringSource(messagePayload), new StringResult());
assertThat(b).isFalse();
}
@@ -170,7 +173,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
assertThat(requestObject).isEqualTo(graph);
try {
transformer.transform(new StringSource(messagePayload), result);
} catch (TransformerException e) {
}
catch (TransformerException e) {
throw new RuntimeException(e);
}
}
@@ -221,7 +225,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
try {
transformer.transform(new StringSource(messagePayload), result);
} catch (TransformerException e) {
}
catch (TransformerException e) {
throw new RuntimeException(e);
}
}
@@ -244,8 +249,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
public void notFound() {
assertThatExceptionOfType(WebServiceTransportException.class)
.isThrownBy(() -> template.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound",
new StringSource(messagePayload), new StringResult()));
.isThrownBy(() -> template.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound",
new StringSource(messagePayload), new StringResult()));
}
@Test
@@ -254,7 +259,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
Result result = new StringResult();
assertThatExceptionOfType(SoapFaultClientException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/soap/receiverFault", new StringSource(messagePayload), result));
.sendSourceAndReceiveToResult(baseUrl + "/soap/receiverFault", new StringSource(messagePayload), result));
}
@Test
@@ -263,19 +268,20 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
Result result = new StringResult();
assertThatExceptionOfType(SoapFaultClientException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/soap/senderFault", new StringSource(messagePayload), result));
.sendSourceAndReceiveToResult(baseUrl + "/soap/senderFault", new StringSource(messagePayload), result));
}
@Test
public void attachment() {
template.sendSourceAndReceiveToResult(baseUrl + "/soap/attachment", new StringSource(messagePayload), message -> {
template.sendSourceAndReceiveToResult(baseUrl + "/soap/attachment", new StringSource(messagePayload),
message -> {
SoapMessage soapMessage = (SoapMessage) message;
final String attachmentContent = "content";
soapMessage.addAttachment("attachment-1",
new DataHandler(new ByteArrayDataSource(attachmentContent, "text/plain")));
}, new StringResult());
SoapMessage soapMessage = (SoapMessage) message;
final String attachmentContent = "content";
soapMessage.addAttachment("attachment-1",
new DataHandler(new ByteArrayDataSource(attachmentContent, "text/plain")));
}, new StringResult());
}
/** Servlet that returns and error message for a given status code. */
@@ -292,6 +298,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.sendError(sc);
}
}
/** Abstract SOAP Servlet */
@@ -307,7 +314,8 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
try {
messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
} catch (SOAPException ex) {
}
catch (SOAPException ex) {
throw new ServletException("Unable to create message factory" + ex.getMessage());
}
}
@@ -325,20 +333,24 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
SOAPBody replyBody = reply.getSOAPBody();
if (!replyBody.hasFault()) {
resp.setStatus(HttpServletResponse.SC_OK);
} else {
}
else {
if (replyBody.getFault().getFaultCodeAsQName().equals(SOAPConstants.SOAP_SENDER_FAULT)) {
resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
} else {
}
else {
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
putHeaders(reply.getMimeHeaders(), resp);
reply.writeTo(resp.getOutputStream());
} else {
}
else {
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
}
} catch (Exception ex) {
}
catch (Exception ex) {
throw new ServletException("SAAJ POST failed " + ex.getMessage(), ex);
}
}
@@ -374,6 +386,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
}
protected abstract SOAPMessage onMessage(SOAPMessage message) throws SOAPException;
}
@SuppressWarnings("serial")
@@ -383,6 +396,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
protected SOAPMessage onMessage(SOAPMessage message) {
return message;
}
}
@SuppressWarnings("serial")
@@ -392,6 +406,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
protected SOAPMessage onMessage(SOAPMessage message) {
return null;
}
}
@SuppressWarnings("serial")
@@ -405,6 +420,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
body.addFault(SOAPConstants.SOAP_RECEIVER_FAULT, "Receiver Fault");
return response;
}
}
@SuppressWarnings("serial")
@@ -418,6 +434,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
body.addFault(SOAPConstants.SOAP_SENDER_FAULT, "Sender Fault");
return response;
}
}
@SuppressWarnings("serial")
@@ -429,5 +446,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTestCase {
assertThat(message.countAttachments()).isEqualTo(1);
return null;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,6 @@
package org.springframework.ws.client.core;
import static org.assertj.core.api.Assertions.*;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
@@ -33,6 +25,11 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
@@ -41,6 +38,9 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.ws.client.WebServiceTransportException;
import org.springframework.ws.pox.dom.DomPoxMessageFactory;
import org.springframework.ws.transport.http.HttpComponentsMessageSender;
@@ -49,8 +49,8 @@ import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.w3c.dom.Document;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class DomPoxWebServiceTemplateIntegrationTest {
@@ -102,9 +102,9 @@ public class DomPoxWebServiceTemplateIntegrationTest {
XmlAssert.assertThat(result.toString()).and(content).ignoreWhitespace().areIdentical();
assertThatExceptionOfType(WebServiceTransportException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound", new StringSource(content), new StringResult()));
assertThatExceptionOfType(WebServiceTransportException.class).isThrownBy(
() -> template.sendSourceAndReceiveToResult(baseUrl + "/errors/server", new StringSource(content), result));
.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound", new StringSource(content), new StringResult()));
assertThatExceptionOfType(WebServiceTransportException.class).isThrownBy(() -> template
.sendSourceAndReceiveToResult(baseUrl + "/errors/server", new StringSource(content), result));
}
/** Servlet that returns and error message for a given status code. */
@@ -121,6 +121,7 @@ public class DomPoxWebServiceTemplateIntegrationTest {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.sendError(sc);
}
}
/** Simple POX Servlet. */
@@ -148,10 +149,12 @@ public class DomPoxWebServiceTemplateIntegrationTest {
Document message = documentBuilder.parse(req.getInputStream());
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(new DOMSource(message), new StreamResult(resp.getOutputStream()));
} catch (Exception ex) {
}
catch (Exception ex) {
throw new ServletException("POX POST failed" + ex.getMessage());
}
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap11WebServiceTemplateIntegrationTest extends AbstractSoap11W
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
return new SaajSoapMessageFactory(messageFactory);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap12WebServiceTemplateIntegrationTest extends AbstractSoap12W
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
return new SaajSoapMessageFactory(messageFactory);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,18 @@
package org.springframework.ws.client.core;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.FaultAwareWebServiceMessage;
import org.springframework.ws.client.WebServiceFaultException;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class SimpleFaultMessageResolverTest {
private SimpleFaultMessageResolver resolver;
@@ -43,8 +47,9 @@ public class SimpleFaultMessageResolverTest {
replay(messageMock);
assertThatExceptionOfType(WebServiceFaultException.class).isThrownBy(() -> resolver.resolveFault(messageMock))
.withMessage(message);
.withMessage(message);
verify(messageMock);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,10 @@
package org.springframework.ws.client.core;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
@@ -27,10 +31,6 @@ import jakarta.xml.soap.MimeHeaders;
import jakarta.xml.soap.SOAPException;
import jakarta.xml.soap.SOAPMessage;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.StringTokenizer;
import org.springframework.util.StringUtils;
/**
@@ -51,7 +51,8 @@ public class SimpleSaajServlet extends HttpServlet {
try {
msgFactory = MessageFactory.newInstance();
} catch (SOAPException ex) {
}
catch (SOAPException ex) {
throw new ServletException("Unable to create message factory" + ex.getMessage());
}
}
@@ -97,14 +98,16 @@ public class SimpleSaajServlet extends HttpServlet {
if (reply.saveRequired()) {
reply.saveChanges();
}
resp.setStatus(
!reply.getSOAPBody().hasFault() ? HttpServletResponse.SC_OK : HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
resp.setStatus(!reply.getSOAPBody().hasFault() ? HttpServletResponse.SC_OK
: HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
putHeaders(reply.getMimeHeaders(), resp);
reply.writeTo(resp.getOutputStream());
} else {
}
else {
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
}
} catch (Exception ex) {
}
catch (Exception ex) {
throw new ServletException("SAAJ POST failed " + ex.getMessage());
}
}
@@ -112,4 +115,5 @@ public class SimpleSaajServlet extends HttpServlet {
protected SOAPMessage onMessage(SOAPMessage message) {
return message;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.client.core;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import java.io.IOException;
import java.net.URI;
@@ -27,6 +24,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.ws.MockWebServiceMessage;
@@ -43,6 +41,15 @@ import org.springframework.ws.transport.WebServiceMessageSender;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.when;
@SuppressWarnings("unchecked")
public class WebServiceTemplateTest {
@@ -171,7 +178,8 @@ public class WebServiceTemplateTest {
connectionMock.close();
assertThatExceptionOfType(WebServiceTransportException.class)
.isThrownBy(() -> template.sendAndReceive(null, extractorMock)).withMessage(errorMessage);
.isThrownBy(() -> template.sendAndReceive(null, extractorMock))
.withMessage(errorMessage);
}
@Test
@@ -446,4 +454,5 @@ public class WebServiceTemplateTest {
assertThat(result).isNull();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,17 @@
package org.springframework.ws.client.support.destination;
import static org.assertj.core.api.Assertions.*;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import static org.assertj.core.api.Assertions.assertThat;
public class Wsdl11DestinationProviderTest {
private Wsdl11DestinationProvider provider;
@@ -66,4 +67,5 @@ public class Wsdl11DestinationProviderTest {
assertThat(result).isEqualTo(new URI("http://example.com/soap12"));
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,15 +15,16 @@
*/
package org.springframework.ws.client.support.interceptor;
import static org.assertj.core.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.ws.client.WebServiceClientException;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Greg Turnquist
*/
@@ -32,7 +33,8 @@ public class ClientInterceptorAdapterTest {
@Test
public void handleEmptyInterceptor() {
ClientInterceptor interceptor = new ClientInterceptorAdapter() {};
ClientInterceptor interceptor = new ClientInterceptorAdapter() {
};
assertThat(interceptor.handleRequest(null)).isTrue();
assertThat(interceptor.handleResponse(null)).isTrue();
@@ -53,7 +55,8 @@ public class ClientInterceptorAdapterTest {
List<String> bits = interceptor.getBits();
assertThat(bits).containsExactly("handled request", "handled response", "handled fault", "handled afterCompletion");
assertThat(bits).containsExactly("handled request", "handled response", "handled fault",
"handled afterCompletion");
}
static class TestClientInterceptorAdapter extends ClientInterceptorAdapter {
@@ -93,5 +96,7 @@ public class ClientInterceptorAdapterTest {
public void afterCompletion(MessageContext messageContext, Exception ex) throws WebServiceClientException {
bits.add("handled afterCompletion");
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,20 +16,18 @@
package org.springframework.ws.client.support.interceptor;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import java.io.InputStream;
import javax.xml.XMLConstants;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
@@ -43,6 +41,10 @@ import org.springframework.ws.soap.saaj.support.SaajUtils;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.springframework.xml.xsd.SimpleXsdSchema;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
public class PayloadValidatingInterceptorTest {
private PayloadValidatingInterceptor interceptor;
@@ -90,7 +92,7 @@ public class PayloadValidatingInterceptorTest {
context = new DefaultMessageContext(invalidMessage, soap11Factory);
assertThatExceptionOfType(WebServiceClientException.class).isThrownBy(() -> interceptor.handleRequest(context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on response");
}
@Test
@@ -101,7 +103,7 @@ public class PayloadValidatingInterceptorTest {
context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
assertThatExceptionOfType(WebServiceClientException.class).isThrownBy(() -> interceptor.handleRequest(context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on response");
}
@Test
@@ -144,10 +146,11 @@ public class PayloadValidatingInterceptorTest {
@Test
public void testNamespacesInType() throws Exception {
// Make sure we use Xerces for this testcase: the JAXP implementation used internally by JDK 1.5 has a bug
// Make sure we use Xerces for this testcase: the JAXP implementation used
// internally by JDK 1.5 has a bug
// See http://opensource.atlassian.com/projects/spring/browse/SWS-35
String previousSchemaFactory = System
.getProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI, "");
.getProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI, "");
System.setProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI,
"org.apache.xerces.jaxp.validation.XMLSchemaFactory");
@@ -158,13 +161,15 @@ public class PayloadValidatingInterceptorTest {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage saajMessage = SaajUtils.loadMessage(new ClassPathResource(VALID_SOAP_MESSAGE, getClass()),
messageFactory);
context = new DefaultMessageContext(new SaajSoapMessage(saajMessage), new SaajSoapMessageFactory(messageFactory));
context = new DefaultMessageContext(new SaajSoapMessage(saajMessage),
new SaajSoapMessageFactory(messageFactory));
boolean result = interceptor.handleRequest(context);
assertThat(result).isTrue();
assertThat(context.hasResponse()).isFalse();
} finally {
}
finally {
// Reset the property
System.setProperty("javax.xml.validation.SchemaFactory:" + XMLConstants.W3C_XML_SCHEMA_NS_URI,
previousSchemaFactory);
@@ -191,7 +196,7 @@ public class PayloadValidatingInterceptorTest {
context = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
assertThatExceptionOfType(WebServiceClientException.class).isThrownBy(() -> interceptor.handleRequest(context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on response");
}
@Test
@@ -257,4 +262,5 @@ public class PayloadValidatingInterceptorTest {
assertThat(result).isTrue();
assertThat(context.hasResponse()).isFalse();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,12 @@
package org.springframework.ws.config;
import static org.assertj.core.api.Assertions.*;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.server.EndpointAdapter;
@@ -49,6 +48,8 @@ import org.springframework.ws.soap.server.endpoint.adapter.method.SoapHeaderElem
import org.springframework.ws.soap.server.endpoint.adapter.method.SoapMethodArgumentResolver;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@@ -58,7 +59,8 @@ public class AnnotationDrivenBeanDefinitionParserTest {
@BeforeEach
public void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("annotationDrivenBeanDefinitionParserTest.xml", getClass());
applicationContext = new ClassPathXmlApplicationContext("annotationDrivenBeanDefinitionParserTest.xml",
getClass());
}
@Test
@@ -89,7 +91,8 @@ public class AnnotationDrivenBeanDefinitionParserTest {
SoapHeaderElementMethodArgumentResolver.class, DomPayloadMethodProcessor.class,
SourcePayloadMethodProcessor.class, Dom4jPayloadMethodProcessor.class,
XmlRootElementPayloadMethodProcessor.class, JaxbElementPayloadMethodProcessor.class,
JDomPayloadMethodProcessor.class, StaxPayloadMethodArgumentResolver.class, XomPayloadMethodProcessor.class);
JDomPayloadMethodProcessor.class, StaxPayloadMethodArgumentResolver.class,
XomPayloadMethodProcessor.class);
List<MethodReturnValueHandler> returnValueHandlers = endpointAdapter.getMethodReturnValueHandlers();
@@ -103,10 +106,12 @@ public class AnnotationDrivenBeanDefinitionParserTest {
@Test
public void endpointExceptionResolver() {
Map<String, EndpointExceptionResolver> result = applicationContext.getBeansOfType(EndpointExceptionResolver.class);
Map<String, EndpointExceptionResolver> result = applicationContext
.getBeansOfType(EndpointExceptionResolver.class);
assertThat(result).hasSize(2);
assertThat(result.values()).hasAtLeastOneElementOfType(SoapFaultAnnotationExceptionResolver.class);
assertThat(result.values()).hasAtLeastOneElementOfType(SimpleSoapExceptionResolver.class);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,7 +22,8 @@ import org.springframework.ws.server.EndpointInterceptor;
public class DummyInterceptor implements EndpointInterceptor {
@Autowired private DummyInterceptorDependency autowiredDependency;
@Autowired
private DummyInterceptorDependency autowiredDependency;
private DummyInterceptorDependency propertyDependency;
@@ -54,5 +55,7 @@ public class DummyInterceptor implements EndpointInterceptor {
}
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception {}
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) throws Exception {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,4 +41,5 @@ public class DummyMarshaller implements Marshaller, Unmarshaller {
public Object unmarshal(Source source) throws XmlMappingException, IOException {
throw new UnsupportedOperationException();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -50,5 +50,7 @@ public class MyInterceptor implements EndpointInterceptor {
}
@Override
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {}
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,17 @@
package org.springframework.ws.config;
import static org.assertj.core.api.Assertions.*;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter;
import static org.assertj.core.api.Assertions.assertThat;
public class WebServiceNamespaceHandlerTest {
private ApplicationContext applicationContext;
@@ -39,8 +40,9 @@ public class WebServiceNamespaceHandlerTest {
public void testMarshallingMethods() throws Exception {
Map<String, MarshallingMethodEndpointAdapter> result = applicationContext
.getBeansOfType(MarshallingMethodEndpointAdapter.class);
.getBeansOfType(MarshallingMethodEndpointAdapter.class);
assertThat(result).isNotEmpty();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,31 +16,33 @@
package org.springframework.ws.config;
import static org.assertj.core.api.Assertions.*;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter;
import org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter;
import static org.assertj.core.api.Assertions.assertThat;
public class WebServicesNamespaceHandlerTigerTest {
private ApplicationContext applicationContext;
@BeforeEach
public void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("webServicesNamespaceHandlerTest-tiger.xml", getClass());
applicationContext = new ClassPathXmlApplicationContext("webServicesNamespaceHandlerTest-tiger.xml",
getClass());
}
@Test
public void testMarshallingEndpoints() {
Map<String, GenericMarshallingMethodEndpointAdapter> result = applicationContext
.getBeansOfType(GenericMarshallingMethodEndpointAdapter.class);
.getBeansOfType(GenericMarshallingMethodEndpointAdapter.class);
assertThat(result).isNotEmpty();
}
@@ -49,8 +51,9 @@ public class WebServicesNamespaceHandlerTigerTest {
public void testXpathEndpoints() {
Map<String, XPathParamAnnotationMethodEndpointAdapter> result = applicationContext
.getBeansOfType(XPathParamAnnotationMethodEndpointAdapter.class);
.getBeansOfType(XPathParamAnnotationMethodEndpointAdapter.class);
assertThat(result).isNotEmpty();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,19 @@
package org.springframework.ws.config;
import static org.assertj.core.api.Assertions.*;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
import org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@@ -63,4 +64,5 @@ public class WsdlBeanDefinitionParserTest {
assertThat(result).isNotEmpty();
}
}

View File

@@ -1,9 +1,24 @@
package org.springframework.ws.config.annotation;
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.assertj.core.api.Assertions.*;
package org.springframework.ws.config.annotation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -15,6 +30,8 @@ import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMap
import org.springframework.ws.soap.server.endpoint.annotation.SoapAction;
import org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@@ -36,7 +53,7 @@ public class DefaultWsConfigurationTest {
public void payloadRootAnnotationMethodEndpointMapping() {
PayloadRootAnnotationMethodEndpointMapping endpointMapping = this.applicationContext
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
assertThat(endpointMapping.getOrder()).isEqualTo(0);
}
@@ -45,7 +62,7 @@ public class DefaultWsConfigurationTest {
public void soapActionAnnotationMethodEndpointMapping() {
SoapActionAnnotationMethodEndpointMapping endpointMapping = this.applicationContext
.getBean(SoapActionAnnotationMethodEndpointMapping.class);
.getBean(SoapActionAnnotationMethodEndpointMapping.class);
assertThat(endpointMapping.getOrder()).isEqualTo(1);
}
@@ -54,7 +71,7 @@ public class DefaultWsConfigurationTest {
public void annotationActionEndpointMapping() {
AnnotationActionEndpointMapping endpointMapping = this.applicationContext
.getBean(AnnotationActionEndpointMapping.class);
.getBean(AnnotationActionEndpointMapping.class);
assertThat(endpointMapping.getOrder()).isEqualTo(2);
}
@@ -76,13 +93,15 @@ public class DefaultWsConfigurationTest {
public TestEndpoint testEndpoint() {
return new TestEndpoint();
}
}
@Endpoint
private static class TestEndpoint {
@SoapAction("handle")
public void handle() {}
public void handle() {
}
}

View File

@@ -1,11 +1,26 @@
package org.springframework.ws.config.annotation;
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.assertj.core.api.Assertions.*;
package org.springframework.ws.config.annotation;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -15,6 +30,8 @@ import org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapt
import org.springframework.ws.server.endpoint.interceptor.EndpointInterceptorAdapter;
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@@ -36,7 +53,7 @@ public class WsConfigurationSupportTest {
public void interceptors() {
PayloadRootAnnotationMethodEndpointMapping endpointMapping = this.applicationContext
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
assertThat(endpointMapping.getOrder()).isEqualTo(0);
@@ -49,7 +66,8 @@ public class WsConfigurationSupportTest {
@Test
public void defaultMethodEndpointAdapter() {
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext.getBean(DefaultMethodEndpointAdapter.class);
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext
.getBean(DefaultMethodEndpointAdapter.class);
assertThat(endpointAdapter).isNotNull();
assertThat(endpointAdapter).isInstanceOf(MyDefaultMethodEndpointAdapter.class);
@@ -68,6 +86,7 @@ public class WsConfigurationSupportTest {
public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
return new MyDefaultMethodEndpointAdapter();
}
}
public static class MyInterceptor extends EndpointInterceptorAdapter {

View File

@@ -1,11 +1,26 @@
package org.springframework.ws.config.annotation;
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.assertj.core.api.Assertions.*;
package org.springframework.ws.config.annotation;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
@@ -18,6 +33,8 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHa
import org.springframework.ws.server.endpoint.interceptor.EndpointInterceptorAdapter;
import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@@ -39,7 +56,7 @@ public class WsConfigurerAdapterTest {
public void interceptors() {
PayloadRootAnnotationMethodEndpointMapping endpointMapping = this.applicationContext
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
.getBean(PayloadRootAnnotationMethodEndpointMapping.class);
assertThat(endpointMapping.getOrder()).isEqualTo(0);
@@ -52,7 +69,8 @@ public class WsConfigurerAdapterTest {
@Test
public void argumentResolvers() {
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext.getBean(DefaultMethodEndpointAdapter.class);
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext
.getBean(DefaultMethodEndpointAdapter.class);
List<MethodArgumentResolver> argumentResolvers = endpointAdapter.getCustomMethodArgumentResolvers();
@@ -67,7 +85,8 @@ public class WsConfigurerAdapterTest {
@Test
public void returnValueHandlers() {
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext.getBean(DefaultMethodEndpointAdapter.class);
DefaultMethodEndpointAdapter endpointAdapter = this.applicationContext
.getBean(DefaultMethodEndpointAdapter.class);
List<MethodReturnValueHandler> returnValueHandlers = endpointAdapter.getCustomMethodReturnValueHandlers();
@@ -97,9 +116,12 @@ public class WsConfigurerAdapterTest {
public void addReturnValueHandlers(List<MethodReturnValueHandler> returnValueHandlers) {
returnValueHandlers.add(new MyReturnValueHandler());
}
}
public static class MyInterceptor extends EndpointInterceptorAdapter {}
public static class MyInterceptor extends EndpointInterceptorAdapter {
}
public static class MyMethodArgumentResolver implements MethodArgumentResolver {
@@ -112,6 +134,7 @@ public class WsConfigurerAdapterTest {
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
return null;
}
}
public static class MyReturnValueHandler implements MethodReturnValueHandler {
@@ -123,6 +146,9 @@ public class WsConfigurerAdapterTest {
@Override
public void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
throws Exception {}
throws Exception {
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,19 @@
package org.springframework.ws.context;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.WebServiceMessageFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class DefaultMessageContextTest {
private DefaultMessageContext context;
@@ -81,4 +85,5 @@ public class DefaultMessageContextTest {
assertThat(context.containsProperty(name)).isFalse();
assertThat(context.getPropertyNames()).isEmpty();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,4 +25,5 @@ public class DomPoxMessageFactoryTest extends AbstractWebServiceMessageFactoryTe
protected WebServiceMessageFactory createMessageFactory() throws Exception {
return new DomPoxMessageFactory();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.pox.dom;
import static org.xmlunit.assertj.XmlAssert.*;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
@@ -28,11 +26,14 @@ import javax.xml.transform.TransformerFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.w3c.dom.Document;
import static org.xmlunit.assertj.XmlAssert.assertThat;
public class DomPoxMessageTest {
@@ -86,4 +87,5 @@ public class DomPoxMessageTest {
assertThat(os.toString(StandardCharsets.UTF_8)).and(content).ignoreWhitespace().areIdentical();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,11 @@
package org.springframework.ws.server;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.util.Collections;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.NoEndpointFoundException;
@@ -33,6 +31,16 @@ import org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter;
import org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping;
import org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class MessageDispatcherTest {
private MessageDispatcher dispatcher;
@@ -150,7 +158,8 @@ public class MessageDispatcherTest {
try {
dispatcher.processEndpointException(messageContext, endpoint, ex);
} catch (Exception result) {
}
catch (Exception result) {
assertThat(result).isEqualTo(ex);
}
@@ -341,7 +350,8 @@ public class MessageDispatcherTest {
messageContext.getResponse();
try {
dispatcher.dispatch(messageContext);
} catch (RuntimeException ex) {
}
catch (RuntimeException ex) {
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,14 +33,15 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import org.junit.jupiter.api.Test;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.XMLInputFactoryUtils;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.XMLInputFactoryUtils;
@SuppressWarnings("Since15")
public abstract class AbstractEndpointTestCase {
@@ -103,4 +104,5 @@ public abstract class AbstractEndpointTestCase {
}
protected abstract void testSource(Source requestSource) throws Exception;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,19 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.xml.transform.StringSource;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractMessageEndpointTestCase extends AbstractEndpointTestCase {
@@ -71,8 +72,10 @@ public abstract class AbstractMessageEndpointTestCase extends AbstractEndpointTe
endpoint.invoke(context);
assertThat(context.hasResponse()).isTrue();
XmlAssert.assertThat(((MockWebServiceMessage) context.getResponse()).getPayloadAsString()).and(RESPONSE)
.ignoreWhitespace().areSimilar();
XmlAssert.assertThat(((MockWebServiceMessage) context.getResponse()).getPayloadAsString())
.and(RESPONSE)
.ignoreWhitespace()
.areSimilar();
}
protected abstract MessageEndpoint createNoResponseEndpoint();

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,17 +16,18 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractPayloadEndpointTestCase extends AbstractEndpointTestCase {
@@ -78,4 +79,5 @@ public abstract class AbstractPayloadEndpointTestCase extends AbstractEndpointTe
protected abstract PayloadEndpoint createResponseEndpoint() throws Exception;
protected abstract PayloadEndpoint createNoRequestEndpoint() throws Exception;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,11 +16,11 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import static org.assertj.core.api.Assertions.assertThat;
public class DomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
@Override
@@ -65,4 +65,5 @@ public class DomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
}
};
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,15 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import java.util.Collections;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test for AbstractEndpointExceptionResolver
*
@@ -59,5 +60,7 @@ public class EndpointExceptionResolverTest {
assertThat(matched).isTrue();
}
public void emptyMethod() {}
public void emptyMethod() {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,11 +16,11 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import org.jdom2.Element;
import org.jdom2.Namespace;
import static org.assertj.core.api.Assertions.assertThat;
public class JDomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
@Override
@@ -64,4 +64,5 @@ public class JDomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
}
};
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -32,6 +29,8 @@ import javax.xml.transform.stream.StreamSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
@@ -46,7 +45,15 @@ import org.springframework.ws.mime.MimeMessage;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class MarshallingPayloadEndpointTest {
@@ -80,7 +87,8 @@ public class MarshallingPayloadEndpointTest {
XmlAssert.assertThat(writer.toString()).and("<request/>").ignoreWhitespace().areIdentical();
return 42L;
} catch (Exception e) {
}
catch (Exception e) {
fail(e.getMessage());
return null;
@@ -97,7 +105,8 @@ public class MarshallingPayloadEndpointTest {
try {
transformer.transform(new StreamSource(new StringReader("<result/>")), result);
} catch (TransformerException e) {
}
catch (TransformerException e) {
fail(e.getMessage());
}
}
@@ -145,7 +154,8 @@ public class MarshallingPayloadEndpointTest {
XmlAssert.assertThat(writer.toString()).and("<request/>").ignoreWhitespace().areIdentical();
return (long) 42;
} catch (Exception e) {
}
catch (Exception e) {
fail(e.getMessage());
return null;
}
@@ -264,6 +274,7 @@ public class MarshallingPayloadEndpointTest {
public boolean supports(Class<?> clazz) {
return false;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,13 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Method;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class MethodEndpointTest {
private MethodEndpoint endpoint;
@@ -88,4 +88,5 @@ public class MethodEndpointTest {
myMethodInvoked = true;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,17 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import javax.xml.transform.Source;
import org.springframework.xml.transform.StringSource;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.DefaultHandler;
import org.springframework.xml.transform.StringSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class SaxPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
@Override
@@ -97,5 +99,7 @@ public class SaxPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
assertThat(qName).isEqualTo(localName);
assertThat(uri).isEqualTo(NAMESPACE_URI);
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import java.util.Collections;
import javax.xml.namespace.QName;
@@ -28,6 +26,8 @@ import javax.xml.stream.events.Namespace;
import javax.xml.stream.events.XMLEvent;
import javax.xml.stream.util.XMLEventConsumer;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test case for AbstractStaxEventPayloadEndpoint.
*
@@ -95,7 +95,8 @@ public class StaxEventPayloadEndpointTest extends AbstractMessageEndpointTestCas
Namespace namespace = eventFactory.createNamespace(NAMESPACE_URI);
QName name = new QName(NAMESPACE_URI, RESPONSE_ELEMENT);
eventWriter.add(eventFactory.createStartElement(name, null, Collections.singleton(namespace).iterator()));
eventWriter
.add(eventFactory.createStartElement(name, null, Collections.singleton(namespace).iterator()));
eventWriter.add(eventFactory.createEndElement(name, Collections.singleton(namespace).iterator()));
eventWriter.add(eventFactory.createEndDocument());
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,13 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
@@ -34,7 +32,19 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver;
import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler;
/** @author Arjen Poutsma */
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.isNull;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
/**
* @author Arjen Poutsma
*/
public class DefaultMethodEndpointAdapterTest {
private DefaultMethodEndpointAdapter adapter;
@@ -141,8 +151,7 @@ public class DefaultMethodEndpointAdapterTest {
// arg 1
expect(argumentResolver1.supportsParameter(isA(MethodParameter.class))).andReturn(false);
expect(argumentResolver2.supportsParameter(isA(MethodParameter.class))).andReturn(true);
expect(argumentResolver2.resolveArgument(eq(messageContext), isA(MethodParameter.class)))
.andReturn(42);
expect(argumentResolver2.resolveArgument(eq(messageContext), isA(MethodParameter.class))).andReturn(42);
expect(returnValueHandler.supportsReturnType(isA(MethodParameter.class))).andReturn(true);
returnValueHandler.handleReturnValue(eq(messageContext), isA(MethodParameter.class), eq(value));
@@ -195,7 +204,8 @@ public class DefaultMethodEndpointAdapterTest {
try {
adapter.invoke(messageContext, exceptionEndpoint);
fail("IOException expected");
} catch (IOException expected) {
}
catch (IOException expected) {
// expected
}
@@ -226,4 +236,5 @@ public class DefaultMethodEndpointAdapterTest {
supportedArgument = s;
throw new IOException(s);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.lang.reflect.Method;
import javax.xml.transform.Result;
@@ -26,6 +23,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.oxm.GenericMarshaller;
import org.springframework.oxm.GenericUnmarshaller;
import org.springframework.ws.WebServiceMessage;
@@ -36,6 +34,13 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class GenericMarshallingMethodEndpointAdapterTest {
private GenericMarshallingMethodEndpointAdapter adapter;
@@ -211,7 +216,8 @@ public class GenericMarshallingMethodEndpointAdapterTest {
return type;
}
public void unsupportedMultipleParams(String s1, String s2) {}
public void unsupportedMultipleParams(String s1, String s2) {
}
public String unsupportedWrongParam(String s) {
return s;

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.lang.reflect.Method;
import javax.xml.transform.Result;
@@ -26,6 +23,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.ws.MockWebServiceMessage;
@@ -34,6 +32,13 @@ import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.MethodEndpoint;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class MarshallingMethodEndpointAdapterTest {
private MarshallingMethodEndpointAdapter adapter;
@@ -148,7 +153,8 @@ public class MarshallingMethodEndpointAdapterTest {
@Test
public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException {
Method unsupported = getClass().getMethod("unsupportedMultipleParams", new Class[] { String.class, String.class });
Method unsupported = getClass().getMethod("unsupportedMultipleParams",
new Class[] { String.class, String.class });
replay(marshallerMock, unmarshallerMock);
@@ -195,7 +201,8 @@ public class MarshallingMethodEndpointAdapterTest {
return new MyType();
}
public void unsupportedMultipleParams(String s1, String s2) {}
public void unsupportedMultipleParams(String s1, String s2) {
}
public String unsupportedWrongParam(String s) {
return s;

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,16 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.MethodEndpoint;
import static org.assertj.core.api.Assertions.assertThat;
public class MessageMethodEndpointAdapterTest {
private MessageMethodEndpointAdapter adapter;
@@ -50,15 +51,16 @@ public class MessageMethodEndpointAdapterTest {
public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException {
assertThat(adapter.supportsInternal(new MethodEndpoint(this, "unsupportedMultipleParams",
new Class[] { MessageContext.class, MessageContext.class }))).isFalse();
new Class[] { MessageContext.class, MessageContext.class })))
.isFalse();
}
@Test
public void testUnsupportedMethodWrongParam() throws NoSuchMethodException {
assertThat(
adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongParam", new Class[] { String.class })))
.isFalse();
assertThat(adapter
.supportsInternal(new MethodEndpoint(this, "unsupportedWrongParam", new Class[] { String.class })))
.isFalse();
}
@Test
@@ -77,7 +79,10 @@ public class MessageMethodEndpointAdapterTest {
supportedInvoked = true;
}
public void unsupportedMultipleParams(MessageContext s1, MessageContext s2) {}
public void unsupportedMultipleParams(MessageContext s1, MessageContext s2) {
}
public void unsupportedWrongParam(String request) {
}
public void unsupportedWrongParam(String request) {}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,13 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.WebServiceMessage;
@@ -31,6 +30,8 @@ import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.MethodEndpoint;
import static org.assertj.core.api.Assertions.assertThat;
public class PayloadMethodEndpointAdapterTest {
private PayloadMethodEndpointAdapter adapter;
@@ -66,23 +67,24 @@ public class PayloadMethodEndpointAdapterTest {
public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException {
assertThat(adapter.supportsInternal(
new MethodEndpoint(this, "unsupportedMultipleParams", new Class[] { Source.class, Source.class }))).isFalse();
new MethodEndpoint(this, "unsupportedMultipleParams", new Class[] { Source.class, Source.class })))
.isFalse();
}
@Test
public void testUnsupportedMethodWrongReturnType() throws NoSuchMethodException {
assertThat(
adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongReturnType", new Class[] { Source.class })))
.isFalse();
assertThat(adapter
.supportsInternal(new MethodEndpoint(this, "unsupportedWrongReturnType", new Class[] { Source.class })))
.isFalse();
}
@Test
public void testUnsupportedMethodWrongParam() throws NoSuchMethodException {
assertThat(
adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongParam", new Class[] { String.class })))
.isFalse();
assertThat(adapter
.supportsInternal(new MethodEndpoint(this, "unsupportedWrongParam", new Class[] { String.class })))
.isFalse();
}
@Test
@@ -121,7 +123,8 @@ public class PayloadMethodEndpointAdapterTest {
return request;
}
public void unsupportedMultipleParams(Source s1, Source s2) {}
public void unsupportedMultipleParams(Source s1, Source s2) {
}
public Source unsupportedWrongParam(String request) {
return null;

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.server.endpoint.adapter;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.util.HashMap;
import java.util.Map;
@@ -29,6 +26,12 @@ import javax.xml.transform.dom.DOMSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
@@ -38,11 +41,12 @@ import org.springframework.ws.server.endpoint.annotation.XPathParam;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class XPathParamAnnotationMethodEndpointAdapterTest {
@@ -74,7 +78,8 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
@Test
public void testUnsupportedInvalidReturnType() throws NoSuchMethodException {
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidReturnType", new Class[] { String.class });
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidReturnType",
new Class[] { String.class });
assertThat(adapter.supports(endpoint)).isFalse();
}
@@ -191,7 +196,8 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
assertThat(namespacesInvoked).isTrue();
}
public void supportedVoid(@XPathParam("/") String param1) {}
public void supportedVoid(@XPathParam("/") String param1) {
}
public Source supportedSource(@XPathParam("/") String param1) {
@@ -203,9 +209,9 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
return null;
}
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) {
supportedTypesInvoked = true;
@@ -225,11 +231,13 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
return null;
}
public void unsupportedInvalidParamType(@XPathParam("/") int param1) {}
public void unsupportedInvalidParamType(@XPathParam("/") int param1) {
}
public void namespaces(@XPathParam(".") Node param) {
namespacesInvoked = true;
assertThat(param.getLocalName()).isEqualTo("child");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,12 +16,12 @@
package org.springframework.ws.server.endpoint.adapter.method;
import javax.xml.transform.TransformerException;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPException;
import jakarta.xml.soap.SOAPMessage;
import javax.xml.transform.TransformerException;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
@@ -75,4 +75,5 @@ public class AbstractMethodArgumentResolverTestCase extends TransformerObjectSup
return new DefaultMessageContext(request, soapMessageFactory);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,17 @@
package org.springframework.ws.server.endpoint.adapter.method;
import static org.assertj.core.api.Assertions.*;
import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.core.MethodParameter;
import org.springframework.ws.context.MessageContext;
import org.springframework.xml.transform.StringResult;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractPayloadMethodProcessorTestCase extends AbstractMethodArgumentResolverTestCase {
@@ -56,7 +57,8 @@ public abstract class AbstractPayloadMethodProcessorTestCase extends AbstractMet
assertThat(processor.supportsParameter(supportedParameter)).isTrue();
}
MethodParameter unsupportedParameter = new MethodParameter(getClass().getMethod("unsupported", String.class), 0);
MethodParameter unsupportedParameter = new MethodParameter(getClass().getMethod("unsupported", String.class),
0);
assertThat(processor.supportsParameter(unsupportedParameter)).isFalse();
}
@@ -68,7 +70,8 @@ public abstract class AbstractPayloadMethodProcessorTestCase extends AbstractMet
assertThat(processor.supportsReturnType(supportedReturnType)).isTrue();
}
MethodParameter unsupportedReturnType = new MethodParameter(getClass().getMethod("unsupported", String.class), -1);
MethodParameter unsupportedReturnType = new MethodParameter(getClass().getMethod("unsupported", String.class),
-1);
assertThat(processor.supportsReturnType(unsupportedReturnType)).isFalse();
}
@@ -104,7 +107,8 @@ public abstract class AbstractPayloadMethodProcessorTestCase extends AbstractMet
}
}
protected void testArgument(Object argument, MethodParameter parameter) {}
protected void testArgument(Object argument, MethodParameter parameter) {
}
@Test
public void saajReturnValue() throws Exception {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.server.endpoint.adapter.method;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.lang.reflect.Type;
import javax.xml.transform.Result;
@@ -26,6 +23,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.oxm.GenericMarshaller;
import org.springframework.oxm.GenericUnmarshaller;
@@ -33,6 +31,15 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class MarshallingPayloadMethodProcessorTest extends AbstractMethodArgumentResolverTestCase {
private MarshallingPayloadMethodProcessor processor;
@@ -203,4 +210,5 @@ public class MarshallingPayloadMethodProcessorTest extends AbstractMethodArgumen
public static class MyObject {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,16 @@
package org.springframework.ws.server.endpoint.adapter.method;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
public class MessageContextMethodArgumentResolverTest {
private MessageContextMethodArgumentResolver resolver;
@@ -53,6 +54,7 @@ public class MessageContextMethodArgumentResolverTest {
assertThat(result).isSameAs(messageContext);
}
public void supported(MessageContext messageContext) {}
public void supported(MessageContext messageContext) {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,7 +27,9 @@ import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.springframework.xml.transform.StringSource;
/** @author Arjen Poutsma */
/**
* @author Arjen Poutsma
*/
public class SourcePayloadMethodProcessorTest extends AbstractPayloadMethodProcessorTestCase {
@Override
@@ -86,4 +88,5 @@ public class SourcePayloadMethodProcessorTest extends AbstractPayloadMethodProce
public StAXSource stax(@RequestPayload StAXSource source) {
return source;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint.adapter.method;
import static org.assertj.core.api.Assertions.*;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -27,11 +25,16 @@ import javax.xml.stream.events.XMLEvent;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
/** @author Arjen Poutsma */
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
*/
@SuppressWarnings("Since15")
public class StaxPayloadMethodArgumentResolverTest extends AbstractMethodArgumentResolverTestCase {
@@ -170,9 +173,13 @@ public class StaxPayloadMethodArgumentResolverTest extends AbstractMethodArgumen
assertThat(startElement.getName().getLocalPart()).isEqualTo(LOCAL_NAME);
}
public void invalid(XMLStreamReader streamReader) {}
public void invalid(XMLStreamReader streamReader) {
}
public void streamReader(@RequestPayload XMLStreamReader streamReader) {}
public void streamReader(@RequestPayload XMLStreamReader streamReader) {
}
public void eventReader(@RequestPayload XMLEventReader streamReader) {
}
public void eventReader(@RequestPayload XMLEventReader streamReader) {}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,12 +16,13 @@
package org.springframework.ws.server.endpoint.adapter.method;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Method;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.core.MethodParameter;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
@@ -30,8 +31,8 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.annotation.Namespace;
import org.springframework.ws.server.endpoint.annotation.Namespaces;
import org.springframework.ws.server.endpoint.annotation.XPathParam;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import static org.assertj.core.api.Assertions.assertThat;
@Namespaces(@Namespace(prefix = "tns", uri = "http://springframework.org/spring-ws"))
public class XPathParamMethodArgumentResolverTest {
@@ -201,20 +202,25 @@ public class XPathParamMethodArgumentResolverTest {
assertThat(result).isEqualTo("text");
}
public void unsupported(String s) {}
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) {}
@XPathParam("/root/child/text") String param5) {
}
public void convertedType(@XPathParam("/root/child/number") int param) {}
public void convertedType(@XPathParam("/root/child/number") int param) {
}
@Namespaces(@Namespace(prefix = "tns", uri = "http://springframework.org/spring-ws"))
public void namespacesMethod(@XPathParam("/tns:root") String s) {}
public void namespacesMethod(@XPathParam("/tns:root") String s) {
}
public void namespacesClass(@XPathParam("/tns:root") String s) {}
public void namespacesClass(@XPathParam("/tns:root") String s) {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,16 @@
package org.springframework.ws.server.endpoint.adapter.method.dom;
import static org.assertj.core.api.Assertions.*;
import org.jdom2.Element;
import org.springframework.core.MethodParameter;
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadMethodProcessorTestCase;
import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSourceMethodProcessor;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import static org.assertj.core.api.Assertions.assertThat;
public class JDomPayloadMethodProcessorTest extends AbstractPayloadMethodProcessorTestCase {
@Override
@@ -62,4 +63,5 @@ public class JDomPayloadMethodProcessorTest extends AbstractPayloadMethodProcess
public Element element(@RequestPayload Element element) {
return element;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint.adapter.method.dom;
import static org.assertj.core.api.Assertions.*;
import nu.xom.Element;
import org.springframework.core.MethodParameter;
@@ -26,6 +24,8 @@ import org.springframework.ws.server.endpoint.adapter.method.AbstractPayloadSour
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import static org.assertj.core.api.Assertions.assertThat;
public class XomPayloadMethodProcessorTest extends AbstractPayloadMethodProcessorTestCase {
@Override
@@ -63,4 +63,5 @@ public class XomPayloadMethodProcessorTest extends AbstractPayloadMethodProcesso
public Element element(@RequestPayload Element element) {
return element;
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,17 +16,16 @@
package org.springframework.ws.server.endpoint.adapter.method.jaxb;
import static org.assertj.core.api.Assertions.*;
import javax.xml.namespace.QName;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.core.MethodParameter;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
@@ -35,7 +34,8 @@ import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public class JaxbElementPayloadMethodProcessorTest {
@@ -98,7 +98,9 @@ public class JaxbElementPayloadMethodProcessorTest {
MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
XmlAssert.assertThat(response.getPayloadAsString())
.and("<type xmlns='http://springframework.org'><string>Foo</string></type>").ignoreWhitespace().areIdentical();
.and("<type xmlns='http://springframework.org'><string>Foo</string></type>")
.ignoreWhitespace()
.areIdentical();
}
@Test
@@ -107,15 +109,18 @@ public class JaxbElementPayloadMethodProcessorTest {
MessageContext messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());
String s = "Foo";
JAXBElement<String> element = new JAXBElement<>(new QName("http://springframework.org", "string"), String.class, s);
JAXBElement<String> element = new JAXBElement<>(new QName("http://springframework.org", "string"), String.class,
s);
processor.handleReturnValue(messageContext, stringReturnType, element);
assertThat(messageContext.hasResponse()).isTrue();
MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
XmlAssert.assertThat(response.getPayloadAsString()).and("<string xmlns='http://springframework.org'>Foo</string>")
.ignoreWhitespace().areIdentical();
XmlAssert.assertThat(response.getPayloadAsString())
.and("<string xmlns='http://springframework.org'>Foo</string>")
.ignoreWhitespace()
.areIdentical();
}
@Test
@@ -151,6 +156,7 @@ public class JaxbElementPayloadMethodProcessorTest {
public void setString(String string) {
this.string = string;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,21 +16,25 @@
package org.springframework.ws.server.endpoint.adapter.method.jaxb;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import java.io.OutputStream;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.core.MethodParameter;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
@@ -40,12 +44,8 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.springframework.xml.sax.AbstractXmlReader;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public class XmlRootElementPayloadMethodProcessorTest {
@@ -164,7 +164,8 @@ public class XmlRootElementPayloadMethodProcessorTest {
}
};
// Create a message context with that request. Note that the message factory doesn't matter here:
// Create a message context with that request. Note that the message factory
// doesn't matter here:
// it is required but not used.
MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
@@ -191,7 +192,9 @@ public class XmlRootElementPayloadMethodProcessorTest {
MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
XmlAssert.assertThat(response.getPayloadAsString())
.and("<root xmlns='http://springframework.org'><string>Foo</string></root>").ignoreWhitespace().areIdentical();
.and("<root xmlns='http://springframework.org'><string>Foo</string></root>")
.ignoreWhitespace()
.areIdentical();
}
@Test
@@ -210,7 +213,8 @@ public class XmlRootElementPayloadMethodProcessorTest {
return rootElement;
}
public void type(@RequestPayload MyType type) {}
public void type(@RequestPayload MyType type) {
}
@XmlRootElement(name = "root", namespace = "http://springframework.org")
public static class MyRootElement {
@@ -225,6 +229,7 @@ public class XmlRootElementPayloadMethodProcessorTest {
public void setString(String string) {
this.string = string;
}
}
@XmlType(name = "root", namespace = "http://springframework.org")
@@ -240,6 +245,7 @@ public class XmlRootElementPayloadMethodProcessorTest {
public void setString(String string) {
this.string = string;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,17 +16,16 @@
package org.springframework.ws.server.endpoint.interceptor;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPMessage;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.ws.MockWebServiceMessage;
@@ -41,7 +40,9 @@ import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.ResourceSource;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
public class PayloadTransformingInterceptorTest {
@@ -187,4 +188,5 @@ public class PayloadTransformingInterceptorTest {
public void testNoStylesheetsSet() {
assertThatIllegalArgumentException().isThrownBy(() -> interceptor.afterPropertiesSet());
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,13 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Method;
import javax.xml.namespace.QName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
@@ -32,18 +31,23 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(SpringExtension.class)
@ContextConfiguration("bridged-method-registration.xml")
public class BridgedMethodRegistrationTest {
@Autowired private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired
private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired private ApplicationContext applicationContext;
@Autowired
private ApplicationContext applicationContext;
@Test
public void registration() throws NoSuchMethodException {
MethodEndpoint bridgedMethod = mapping.lookupEndpoint(new QName("http://springframework.org/spring-ws", "Request"));
MethodEndpoint bridgedMethod = mapping
.lookupEndpoint(new QName("http://springframework.org/spring-ws", "Request"));
assertThat(bridgedMethod).isNotNull();
@@ -60,6 +64,7 @@ public class BridgedMethodRegistrationTest {
public A doIt() {
return this;
}
}
public static class B extends A {
@@ -68,6 +73,7 @@ public class BridgedMethodRegistrationTest {
public B doIt() {
return this;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Method;
import javax.xml.namespace.QName;
@@ -25,6 +23,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
@@ -34,18 +33,23 @@ import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(SpringExtension.class)
@ContextConfiguration("cglib-proxy-registration.xml")
public class CgLibProxyRegistrationTest {
@Autowired private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired
private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired private ApplicationContext applicationContext;
@Autowired
private ApplicationContext applicationContext;
@Test
public void registration() throws NoSuchMethodException {
MethodEndpoint cglibProxy = mapping.lookupEndpoint(new QName("http://springframework.org/spring-ws", "Request"));
MethodEndpoint cglibProxy = mapping
.lookupEndpoint(new QName("http://springframework.org/spring-ws", "Request"));
assertThat(cglibProxy).isNotNull();
@@ -60,7 +64,8 @@ public class CgLibProxyRegistrationTest {
@PayloadRoot(localPart = "Request", namespace = "http://springframework.org/spring-ws")
@Log
public void doIt(@RequestPayload Source payload) {}
public void doIt(@RequestPayload Source payload) {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,10 +16,9 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
@@ -29,6 +28,8 @@ import org.springframework.ws.server.EndpointInvocationChain;
import org.springframework.ws.server.endpoint.interceptor.DelegatingSmartEndpointInterceptor;
import org.springframework.ws.server.endpoint.interceptor.EndpointInterceptorAdapter;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test case for {@link AbstractEndpointMapping}.
*/
@@ -198,6 +199,7 @@ public class EndpointMappingTest {
private MyEndpoint() {
constructorCount++;
}
}
private static class MySmartEndpointInterceptor extends DelegatingSmartEndpointInterceptor {
@@ -205,6 +207,7 @@ public class EndpointMappingTest {
private MySmartEndpointInterceptor() {
super(new EndpointInterceptorAdapter());
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Method;
import javax.xml.namespace.QName;
@@ -25,6 +23,7 @@ import javax.xml.transform.Source;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
@@ -34,13 +33,17 @@ import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(SpringExtension.class)
@ContextConfiguration("jdk-proxy-registration.xml")
public class JdkProxyRegistrationTest {
@Autowired private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired
private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired private ApplicationContext applicationContext;
@Autowired
private ApplicationContext applicationContext;
@Test
public void registration() throws NoSuchMethodException {
@@ -61,12 +64,14 @@ public class JdkProxyRegistrationTest {
@PayloadRoot(localPart = "Request", namespace = "http://springframework.org/spring-ws")
@Log
void doIt(Source payload);
}
public static class MyEndpointImpl implements MyEndpoint {
@Override
public void doIt(@RequestPayload Source payload) {}
public void doIt(@RequestPayload Source payload) {
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -47,7 +47,8 @@ public class LogAspect {
try {
return joinPoint.proceed();
} finally {
}
finally {
logger.info("After: " + joinPoint.getSignature());
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,17 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test case for AbstractMapBasedEndpointMapping.
*/
@@ -126,6 +127,7 @@ public class MapBasedSoapEndpointMappingTest {
protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
return key;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,20 +16,18 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPMessage;
import java.lang.reflect.Method;
import java.util.Collections;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPMessage;
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
@@ -49,13 +47,17 @@ import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.server.SoapMessageDispatcher;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(SpringExtension.class)
@ContextConfiguration("payloadRootAnnotationMethodEndpointMapping.xml")
public class PayloadRootAnnotationMethodEndpointMappingTest {
@Autowired private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired
private PayloadRootAnnotationMethodEndpointMapping mapping;
@Autowired private ApplicationContext applicationContext;
@Autowired
private ApplicationContext applicationContext;
@Test
public void registrationSingle() throws NoSuchMethodException {
@@ -122,8 +124,8 @@ public class PayloadRootAnnotationMethodEndpointMappingTest {
MessageDispatcher messageDispatcher = new SoapMessageDispatcher();
messageDispatcher.setApplicationContext(applicationContext);
messageDispatcher.setEndpointMappings(Collections.<EndpointMapping> singletonList(mapping));
messageDispatcher.setEndpointAdapters(Collections.<EndpointAdapter> singletonList(adapter));
messageDispatcher.setEndpointMappings(Collections.<EndpointMapping>singletonList(mapping));
messageDispatcher.setEndpointAdapters(Collections.<EndpointAdapter>singletonList(adapter));
messageDispatcher.receive(messageContext);
@@ -156,7 +158,8 @@ public class PayloadRootAnnotationMethodEndpointMappingTest {
@PayloadRoots({ //
@PayloadRoot(localPart = "Request1", namespace = "http://springframework.org/spring-ws"),
@PayloadRoot(localPart = "Request2", namespace = "http://springframework.org/spring-ws") })
public void doItMultiple() {}
public void doItMultiple() {
}
@PayloadRoot(localPart = "Request3", namespace = "http://springframework.org/spring-ws")
@PayloadRoot(localPart = "Request4", namespace = "http://springframework.org/spring-ws")
@@ -174,4 +177,5 @@ public class PayloadRootAnnotationMethodEndpointMappingTest {
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,17 +16,18 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import javax.xml.namespace.QName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
public class PayloadRootQNameEndpointMappingTest {
private PayloadRootQNameEndpointMapping mapping;
@@ -59,4 +60,5 @@ public class PayloadRootQNameEndpointMappingTest {
assertThat(qName).isNotNull();
assertThat(qName).isEqualTo(new QName("namespace", "localname", "prefix"));
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,16 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
public class SimpleMethodEndpointMappingTest {
private SimpleMethodEndpointMapping mapping;
@@ -77,5 +78,7 @@ public class SimpleMethodEndpointMappingTest {
public void request() {
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,12 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.net.URI;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
@@ -31,6 +29,12 @@ import org.springframework.ws.transport.WebServiceConnection;
import org.springframework.ws.transport.context.DefaultTransportContext;
import org.springframework.ws.transport.context.TransportContextHolder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class UriEndpointMappingTest {
private UriEndpointMapping mapping;
@@ -89,4 +93,5 @@ public class UriEndpointMappingTest {
assertThat(mapping.validateLookupKey("http://example.com/services")).isTrue();
assertThat(mapping.validateLookupKey("some string")).isFalse();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,16 @@
package org.springframework.ws.server.endpoint.mapping;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import static org.assertj.core.api.Assertions.assertThat;
public class XPathPayloadEndpointMappingTest {
private XPathPayloadEndpointMapping mapping;
@@ -48,4 +49,5 @@ public class XPathPayloadEndpointMappingTest {
assertThat(result).isNotNull();
assertThat(result).isEqualTo("value");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,17 +16,16 @@
package org.springframework.ws.server.endpoint.mapping.jaxb;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.lang.reflect.Method;
import javax.xml.namespace.QName;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class XmlRootElementEndpointMappingTest {
private XmlRootElementEndpointMapping mapping;
@@ -45,7 +44,8 @@ public class XmlRootElementEndpointMappingTest {
assertThat(name).isEqualTo(new QName("myNamespace", "myRoot"));
}
public void rootElement(MyRootElement rootElement) {}
public void rootElement(MyRootElement rootElement) {
}
@XmlRootElement(name = "myRoot", namespace = "myNamespace")
public static class MyRootElement {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.server.endpoint.support;
import static org.assertj.core.api.Assertions.*;
import java.io.StringReader;
import javax.xml.namespace.QName;
@@ -32,13 +30,16 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.springframework.util.xml.StaxUtils;
import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.XMLInputFactoryUtils;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import static org.assertj.core.api.Assertions.assertThat;
public class PayloadRootUtilsTest {
@@ -120,4 +121,5 @@ public class PayloadRootUtilsTest {
assertThat(qName).isNull();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.soap;
import static org.assertj.core.api.Assertions.*;
import java.util.Iterator;
import javax.xml.namespace.QName;
@@ -26,8 +24,11 @@ import javax.xml.transform.TransformerFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.xml.transform.TransformerFactoryUtils;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractSoapElementTestCase {
private SoapElement soapElement;
@@ -73,4 +74,5 @@ public abstract class AbstractSoapElementTestCase {
String namespace = "http://springframework.org/spring-ws";
soapElement.addNamespaceDeclaration(prefix, namespace);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,10 +16,10 @@
package org.springframework.ws.soap;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractSoapEnvelopeTestCase extends AbstractSoapElementTestCase {
protected SoapEnvelope soapEnvelope;
@@ -48,4 +48,5 @@ public abstract class AbstractSoapEnvelopeTestCase extends AbstractSoapElementTe
assertThat(body).isNotNull();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,16 +16,17 @@
package org.springframework.ws.soap;
import static org.assertj.core.api.Assertions.*;
import java.util.Iterator;
import javax.xml.namespace.QName;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractSoapHeaderTestCase extends AbstractSoapElementTestCase {
@@ -100,8 +101,9 @@ public abstract class AbstractSoapHeaderTestCase extends AbstractSoapElementTest
transformer.transform(headerElement.getSource(), result);
XmlAssert.assertThat(result.toString())
.and("<spring:localName xmlns:spring='http://www.springframework.org'><spring:content/></spring:localName>")
.ignoreWhitespace().areSimilar();
.and("<spring:localName xmlns:spring='http://www.springframework.org'><spring:content/></spring:localName>")
.ignoreWhitespace()
.areSimilar();
assertThat(iterator.hasNext()).isFalse();
}
@@ -169,4 +171,5 @@ public abstract class AbstractSoapHeaderTestCase extends AbstractSoapElementTest
XmlAssert.assertThat(result.toString()).and(expected).ignoreWhitespace().areSimilar();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,15 @@
package org.springframework.ws.soap;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.springframework.ws.AbstractWebServiceMessageFactoryTestCase;
import org.springframework.ws.InvalidXmlException;
import org.springframework.ws.WebServiceMessage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public abstract class AbstractSoapMessageFactoryTestCase extends AbstractWebServiceMessageFactoryTestCase {
@Test
@@ -51,4 +53,5 @@ public abstract class AbstractSoapMessageFactoryTestCase extends AbstractWebServ
@Test
public abstract void testCreateSoapMessageMissingContentType() throws Exception;
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.soap;
import static org.assertj.core.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.util.Map;
import java.util.regex.Matcher;
@@ -28,6 +26,9 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXParseException;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.core.io.Resource;
import org.springframework.util.StringUtils;
import org.springframework.ws.mime.AbstractMimeMessageTestCase;
@@ -39,8 +40,9 @@ import org.springframework.ws.transport.TransportConstants;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.validation.XmlValidatorFactory;
import org.xml.sax.SAXParseException;
import org.xmlunit.assertj.XmlAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public abstract class AbstractSoapMessageTestCase extends AbstractMimeMessageTestCase {
@@ -64,7 +66,8 @@ public abstract class AbstractSoapMessageTestCase extends AbstractMimeMessageTes
@Test
public void testValidate() throws Exception {
XmlValidator validator = XmlValidatorFactory.createValidator(getSoapSchemas(), XmlValidatorFactory.SCHEMA_W3C_XML);
XmlValidator validator = XmlValidatorFactory.createValidator(getSoapSchemas(),
XmlValidatorFactory.SCHEMA_W3C_XML);
SAXParseException[] errors = validator.validate(soapMessage.getEnvelope().getSource());
if (errors.length > 0) {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,21 +16,21 @@
package org.springframework.ws.soap.addressing;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.MimeHeaders;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPException;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.w3c.dom.Document;
import org.xmlunit.assertj.XmlAssert;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractWsAddressingTestCase {
protected MessageFactory messageFactory;
@@ -50,7 +50,8 @@ public abstract class AbstractWsAddressingTestCase {
try {
return new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, is));
} finally {
}
finally {
is.close();
}
}
@@ -60,10 +61,11 @@ public abstract class AbstractWsAddressingTestCase {
Document expectedDocument = expected.getSaajMessage().getSOAPPart();
Document resultDocument = result.getSaajMessage().getSOAPPart();
XmlAssert.assertThat(resultDocument).and(expectedDocument) //
.ignoreWhitespace() //
.ignoreChildNodesOrder() //
.areSimilar();
XmlAssert.assertThat(resultDocument)
.and(expectedDocument) //
.ignoreWhitespace() //
.ignoreChildNodesOrder() //
.areSimilar();
}
protected void assertXMLNotSimilar(SaajSoapMessage expected, SaajSoapMessage result) {
@@ -71,8 +73,10 @@ public abstract class AbstractWsAddressingTestCase {
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

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,4 +30,5 @@ public class ActionCallback10Test extends AbstractActionCallbackTestCase {
protected String getTestPath() {
return "10";
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,4 +30,5 @@ public class ActionCallback200408Test extends AbstractActionCallbackTestCase {
protected String getTestPath() {
return "200408";
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,13 @@
package org.springframework.ws.soap.addressing.messageid;
import static org.assertj.core.api.Assertions.*;
import java.net.URI;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class UuidMessageIdStrategyTest {
private MessageIdStrategy strategy;
@@ -44,4 +44,5 @@ public class UuidMessageIdStrategyTest {
assertThat(messageId2).isNotNull();
assertThat(messageId2).isNotEqualTo(messageId1);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,9 +16,6 @@
package org.springframework.ws.soap.addressing.server;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.net.URI;
import org.springframework.ws.context.DefaultMessageContext;
@@ -29,6 +26,11 @@ import org.springframework.ws.soap.addressing.version.AddressingVersion;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class AddressingInterceptor10Test extends AbstractAddressingInterceptorTestCase {
@Override
@@ -55,8 +57,7 @@ public class AddressingInterceptor10Test extends AbstractAddressingInterceptorTe
SaajSoapMessage expectedResponse = loadSaajMessage(getTestPath() + "/response-anonymous.xml");
assertXMLSimilar(expectedResponse,
(SaajSoapMessage) context.getResponse());
assertXMLSimilar(expectedResponse, (SaajSoapMessage) context.getResponse());
verify(strategyMock);
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -35,4 +35,5 @@ public class AddressingInterceptor200408Test extends AbstractAddressingIntercept
public void testNoneReplyTo() throws Exception {
// This version of the spec does not have none addresses
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,16 @@
package org.springframework.ws.soap.addressing.server;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.MimeHeaders;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPException;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
@@ -41,6 +39,8 @@ import org.springframework.ws.soap.addressing.server.annotation.Address;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Arjen Poutsma
* @author Nate Stoddard
@@ -96,7 +96,8 @@ public class AnnotationActionMethodEndpointMappingTest {
try {
SaajSoapMessage message = new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, is));
return new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));
} finally {
}
finally {
is.close();
}
}
@@ -109,6 +110,7 @@ public class AnnotationActionMethodEndpointMappingTest {
public void doIt() {
}
}
private static class MyInterceptor extends DelegatingSmartEndpointInterceptor {
@@ -116,6 +118,7 @@ public class AnnotationActionMethodEndpointMappingTest {
public MyInterceptor() {
super(new PayloadLoggingInterceptor());
}
}
private static class MySmartInterceptor extends DelegatingSmartEndpointInterceptor {
@@ -127,5 +130,7 @@ public class AnnotationActionMethodEndpointMappingTest {
public boolean shouldIntercept(MessageContext messageContext, Object endpoint) {
return false;
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,13 @@
package org.springframework.ws.soap.addressing.server;
import static org.assertj.core.api.Assertions.*;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.EndpointInterceptor;
@@ -34,6 +33,8 @@ import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor;
import static org.assertj.core.api.Assertions.assertThat;
public class SimpleActionEndpointMappingTest extends AbstractWsAddressingTestCase {
private SimpleActionEndpointMapping mapping;
@@ -96,4 +97,5 @@ public class SimpleActionEndpointMappingTest extends AbstractWsAddressingTestCas
private static class Endpoint2 {
}
}

View File

@@ -1,21 +1,37 @@
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ws.soap.client.core;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPException;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.support.SoapUtils;
import org.springframework.ws.transport.TransportConstants;
import static org.assertj.core.api.Assertions.assertThat;
public class SaajSoapActionCallbackTest {
private SaajSoapMessageFactory saaj11Factory = new SaajSoapMessageFactory();
@@ -41,8 +57,9 @@ public class SaajSoapActionCallbackTest {
public void noSoapAction11ShouldProduceEmptySoapActionHeader() {
SaajSoapMessage message = saaj11Factory.createWebServiceMessage();
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
assertThat(soapActionHeaders).containsExactly("\"\"");
}
@@ -53,8 +70,9 @@ public class SaajSoapActionCallbackTest {
SaajSoapMessage message = saaj11Factory.createWebServiceMessage();
SoapActionCallback callback = new SoapActionCallback("testAction");
callback.doWithMessage(message);
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
assertThat(soapActionHeaders).containsExactly("\"testAction\"");
}
@@ -65,8 +83,9 @@ public class SaajSoapActionCallbackTest {
SaajSoapMessage message = saaj11Factory.createWebServiceMessage();
SoapActionCallback callback = new SoapActionCallback(null);
callback.doWithMessage(message);
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
assertThat(soapActionHeaders).containsExactly("\"\"");
}
@@ -75,8 +94,9 @@ public class SaajSoapActionCallbackTest {
public void noSoapAction12() {
SaajSoapMessage message = saaj12Factory.createWebServiceMessage();
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
assertThat(soapActionHeaders).isNull();
}
@@ -87,9 +107,12 @@ public class SaajSoapActionCallbackTest {
SaajSoapMessage message = saaj12Factory.createWebServiceMessage();
SoapActionCallback callback = new SoapActionCallback("testAction");
callback.doWithMessage(message);
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] contentTypes = message.getSaajMessage().getMimeHeaders().getHeader(TransportConstants.HEADER_CONTENT_TYPE);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] contentTypes = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_CONTENT_TYPE);
assertThat(soapActionHeaders).isNull();
assertThat(SoapUtils.extractActionFromContentType(contentTypes[0])).isEqualTo("\"testAction\"");
@@ -101,11 +124,15 @@ public class SaajSoapActionCallbackTest {
SaajSoapMessage message = saaj12Factory.createWebServiceMessage();
SoapActionCallback callback = new SoapActionCallback(null);
callback.doWithMessage(message);
String[] soapActionHeaders = message.getSaajMessage().getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] contentTypes = message.getSaajMessage().getMimeHeaders().getHeader(TransportConstants.HEADER_CONTENT_TYPE);
String[] soapActionHeaders = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_SOAP_ACTION);
String[] contentTypes = message.getSaajMessage()
.getMimeHeaders()
.getHeader(TransportConstants.HEADER_CONTENT_TYPE);
assertThat(soapActionHeaders).isNull();
assertThat(SoapUtils.extractActionFromContentType(contentTypes[0])).isEqualTo("\"\"");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,19 +16,19 @@
package org.springframework.ws.soap.saaj;
import static org.assertj.core.api.Assertions.*;
import java.util.Locale;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import java.util.Locale;
import org.junit.jupiter.api.Test;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.soap11.AbstractSoap11BodyTestCase;
import static org.assertj.core.api.Assertions.assertThat;
public class SaajSoap11BodyTest extends AbstractSoap11BodyTestCase {
@Override
@@ -60,4 +60,5 @@ public class SaajSoap11BodyTest extends AbstractSoap11BodyTestCase {
assertThat(saajSoapBody.getFault().getFaultStringLocale()).isNull();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap11EnvelopeTest extends AbstractSoap11EnvelopeTestCase {
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope(), true);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap11HeaderTest extends AbstractSoap11HeaderTestCase {
return new SaajSoap11Header(saajMessage.getSOAPPart().getEnvelope().getHeader());
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,23 +16,23 @@
package org.springframework.ws.soap.saaj;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Map;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.Test;
import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.soap11.AbstractSoap11MessageFactoryTestCase;
import static org.assertj.core.api.Assertions.assertThat;
public class SaajSoap11MessageFactoryTest extends AbstractSoap11MessageFactoryTestCase {
@Override
@@ -54,4 +54,5 @@ public class SaajSoap11MessageFactoryTest extends AbstractSoap11MessageFactoryTe
assertThat(result).startsWith("<?xml version=\"1.0\"");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap12BodyTest extends AbstractSoap12BodyTestCase {
return new SaajSoap12Body(saajMessage.getSOAPBody());
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap12EnvelopeTest extends AbstractSoap12EnvelopeTestCase {
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope(), true);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,4 +33,5 @@ public class SaajSoap12HeaderTest extends AbstractSoap12HeaderTestCase {
return new SaajSoap12Header(saajMessage.getSOAPHeader());
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,4 +30,5 @@ public class SaajSoap12MessageFactoryTest extends AbstractSoap12MessageFactoryTe
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
return new SaajSoapMessageFactory(messageFactory);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,15 +16,6 @@
package org.springframework.ws.soap.saaj.support;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.Name;
import jakarta.xml.soap.SOAPBodyElement;
import jakarta.xml.soap.SOAPElement;
import jakarta.xml.soap.SOAPEnvelope;
import jakarta.xml.soap.SOAPMessage;
import java.util.Iterator;
import javax.xml.transform.Result;
@@ -32,11 +23,20 @@ import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.sax.SAXResult;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.Name;
import jakarta.xml.soap.SOAPBodyElement;
import jakarta.xml.soap.SOAPElement;
import jakarta.xml.soap.SOAPEnvelope;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import static org.assertj.core.api.Assertions.assertThat;
public class SaajContentHandlerTest {
private SaajContentHandler handler;
@@ -83,4 +83,5 @@ public class SaajContentHandlerTest {
assertThat(childElement.getAttributeValue(attributeName)).isEqualTo("value");
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,23 +16,23 @@
package org.springframework.ws.soap.saaj.support;
import static org.xmlunit.assertj.XmlAssert.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPEnvelope;
import jakarta.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPEnvelope;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.xml.sax.InputSource;
import org.springframework.xml.transform.TransformerFactoryUtils;
import static org.xmlunit.assertj.XmlAssert.assertThat;
public class SaajXmlReaderTest {
private SaajXmlReader saajReader;
@@ -78,4 +78,5 @@ public class SaajXmlReaderTest {
assertThat(result.getNode()).and(expected.getNode()).ignoreWhitespace().areIdentical();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,21 +16,18 @@
package org.springframework.ws.soap.server;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPHeaderElement;
import jakarta.xml.soap.SOAPMessage;
import java.util.Iterator;
import java.util.Locale;
import javax.xml.namespace.QName;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPHeaderElement;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapBody;
@@ -43,6 +40,13 @@ import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.ws.soap.soap12.Soap12Fault;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class SoapMessageDispatcherTest {
private SoapMessageDispatcher dispatcher;
@@ -62,7 +66,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
header.setActor(SOAPConstants.URI_SOAP_ACTOR_NEXT);
header.setMustUnderstand(true);
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
@@ -87,7 +91,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
header.setMustUnderstand(true);
header.setRole(SOAPConstants.URI_SOAP_1_2_ROLE_NEXT);
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
@@ -112,7 +116,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
header.setActor(SOAPConstants.URI_SOAP_ACTOR_NEXT);
header.setMustUnderstand(true);
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
@@ -136,7 +140,8 @@ public class SoapMessageDispatcherTest {
Soap11Fault fault = (Soap11Fault) responseBody.getFault();
assertThat(fault.getFaultCode()).isEqualTo(new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "MustUnderstand"));
assertThat(fault.getFaultStringOrReason()).isEqualTo(SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING);
assertThat(fault.getFaultStringOrReason())
.isEqualTo(SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING);
assertThat(fault.getFaultStringLocale()).isEqualTo(Locale.ENGLISH);
verify(interceptorMock);
@@ -148,7 +153,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
header.setMustUnderstand(true);
header.setRole(SOAPConstants.URI_SOAP_1_2_ROLE_NEXT);
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
@@ -174,7 +179,7 @@ public class SoapMessageDispatcherTest {
assertThat(fault.getFaultCode()).isEqualTo(new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand"));
assertThat(fault.getFaultReasonText(Locale.ENGLISH))
.isEqualTo(SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING);
.isEqualTo(SoapMessageDispatcher.DEFAULT_MUST_UNDERSTAND_FAULT_STRING);
SoapHeader responseHeader = response.getSoapHeader();
Iterator<SoapHeaderElement> iterator = responseHeader.examineAllHeaderElements();
@@ -183,7 +188,8 @@ public class SoapMessageDispatcherTest {
SoapHeaderElement headerElement = iterator.next();
assertThat(headerElement.getName()).isEqualTo(new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "NotUnderstood"));
assertThat(headerElement.getName())
.isEqualTo(new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "NotUnderstood"));
verify(interceptorMock);
}
@@ -194,7 +200,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
String headerActor = "http://www/springframework.org/role";
header.setActor(headerActor);
header.setMustUnderstand(true);
@@ -220,7 +226,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
.addHeaderElement(new QName("http://www.springframework.org", "Header", "spring-ws"));
String headerRole = "http://www/springframework.org/role";
header.setRole(headerRole);
header.setMustUnderstand(true);
@@ -266,7 +272,7 @@ public class SoapMessageDispatcherTest {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage request = messageFactory.createMessage();
SOAPHeaderElement header = request.getSOAPHeader()
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
.addHeaderElement(new QName("http://www.springframework.org", "Header"));
header.setActor(SOAPConstants.URI_SOAP_ACTOR_NEXT);
header.setMustUnderstand(true);
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,14 +16,6 @@
package org.springframework.ws.soap.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.Detail;
import jakarta.xml.soap.DetailEntry;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPFault;
import jakarta.xml.soap.SOAPMessage;
import java.io.IOException;
import java.util.Iterator;
@@ -31,8 +23,14 @@ import javax.xml.namespace.QName;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import jakarta.xml.soap.Detail;
import jakarta.xml.soap.DetailEntry;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPFault;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
@@ -45,6 +43,9 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
private MessageContext messageContext;
@@ -91,7 +92,8 @@ public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
SOAPFault fault = response.getSOAPBody().getFault();
assertThat(fault.getFaultCodeAsQName()).isEqualTo(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Client"));
assertThat(fault.getFaultCodeAsQName())
.isEqualTo(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Client"));
assertThat(fault.getFaultString()).isEqualTo(endpoint.getFaultStringOrReason());
Detail detail = fault.getDetail();
@@ -105,14 +107,14 @@ public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
DetailEntry detailEntry = (DetailEntry) iterator.next();
assertThat(detailEntry.getElementQName())
.isEqualTo(new QName("http://springframework.org/spring-ws", "ValidationError"));
.isEqualTo(new QName("http://springframework.org/spring-ws", "ValidationError"));
assertThat(detailEntry.getTextContent()).isEqualTo("Name is required");
assertThat(iterator.hasNext()).isTrue();
detailEntry = (DetailEntry) iterator.next();
assertThat(detailEntry.getElementQName())
.isEqualTo(new QName("http://springframework.org/spring-ws", "ValidationError"));
.isEqualTo(new QName("http://springframework.org/spring-ws", "ValidationError"));
assertThat(detailEntry.getTextContent()).isEqualTo("Age Cannot be negative");
assertThat(iterator.hasNext()).isFalse();
}
@@ -156,10 +158,12 @@ public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
if (p.getAge() < 0) {
e.rejectValue("age", "age.negativevalue");
} else if (p.getAge() > 110) {
}
else if (p.getAge() > 110) {
e.rejectValue("age", "too.darn.old");
}
}
}
private static class Person {
@@ -193,6 +197,7 @@ public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
public String toString() {
return "Person{" + name + "," + age + "}";
}
}
private static class PersonMarshaller implements Unmarshaller, Marshaller {
@@ -214,7 +219,9 @@ public class FaultCreatingValidatingMarshallingPayloadEndpointTest {
}
@Override
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {}
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
}
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,11 @@
package org.springframework.ws.soap.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import static org.easymock.EasyMock.*;
import java.util.Locale;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.MockWebServiceMessage;
import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.context.DefaultMessageContext;
@@ -30,6 +28,12 @@ import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.soap11.Soap11Body;
import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
public class SimpleSoapExceptionResolverTest {
private SimpleSoapExceptionResolver exceptionResolver;
@@ -68,4 +72,5 @@ public class SimpleSoapExceptionResolverTest {
verify(factoryMock, messageMock, bodyMock);
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,16 @@
package org.springframework.ws.soap.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import java.util.Locale;
import javax.xml.namespace.QName;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapMessage;
@@ -40,6 +38,8 @@ import org.springframework.ws.soap.server.endpoint.annotation.SoapFault;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.ws.soap.soap12.Soap12Fault;
import static org.assertj.core.api.Assertions.assertThat;
public class SoapFaultAnnotationExceptionResolverTest {
private SoapFaultAnnotationExceptionResolver resolver;
@@ -256,6 +256,7 @@ public class SoapFaultAnnotationExceptionResolverTest {
public NoStringOrReasonException(String message) {
super(message);
}
}
@SoapFault(faultCode = FaultCode.SENDER, faultStringOrReason = "Sender error")

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +16,6 @@
package org.springframework.ws.soap.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import java.util.Locale;
import javax.xml.namespace.QName;
@@ -25,6 +23,8 @@ import javax.xml.namespace.QName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class SoapFaultDefinitionEditorTest {
private SoapFaultDefinitionEditor editor;
@@ -92,4 +92,5 @@ public class SoapFaultDefinitionEditorTest {
assertThat(editor.getValue()).isNull();
}
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2005-2022 the original author or authors.
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,16 @@
package org.springframework.ws.soap.server.endpoint;
import static org.assertj.core.api.Assertions.*;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPMessage;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapMessage;
@@ -39,6 +37,8 @@ import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.ws.soap.soap12.Soap12Fault;
import static org.assertj.core.api.Assertions.assertThat;
public class SoapFaultMappingExceptionResolverTest {
private SoapFaultMappingExceptionResolver resolver;
@@ -245,4 +245,5 @@ public class SoapFaultMappingExceptionResolverTest {
assertThat(fault.getFaultStringOrReason()).isEqualTo("java.io.IOException");
assertThat(fault.getFaultDetail()).isNull();
}
}

Some files were not shown because too many files have changed in this diff Show More