Polish
This commit is contained in:
@@ -389,7 +389,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
|
||||
private void initMessageSenders(DefaultStrategiesHelper helper) {
|
||||
List<WebServiceMessageSender> messageSenders = helper.getDefaultStrategies(WebServiceMessageSender.class);
|
||||
setMessageSenders(messageSenders.toArray(new WebServiceMessageSender[messageSenders.size()]));
|
||||
setMessageSenders(messageSenders.toArray(new WebServiceMessageSender[0]));
|
||||
}
|
||||
|
||||
private void initFaultMessageResolver(DefaultStrategiesHelper helper) throws BeanInitializationException {
|
||||
@@ -434,7 +434,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new WebServiceMessageExtractor<Object>() {
|
||||
}, new WebServiceMessageExtractor<>() {
|
||||
|
||||
public Object extractData(WebServiceMessage response) throws IOException {
|
||||
Unmarshaller unmarshaller = getUnmarshaller();
|
||||
@@ -473,7 +473,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
try {
|
||||
final Transformer transformer = createTransformer();
|
||||
Boolean retVal = doSendAndReceive(uri, transformer, requestPayload, requestCallback,
|
||||
new SourceExtractor<Boolean>() {
|
||||
new SourceExtractor<>() {
|
||||
|
||||
public Boolean extractData(Source source) throws IOException, TransformerException {
|
||||
if (source != null) {
|
||||
@@ -532,7 +532,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
requestCallback.doWithMessage(message);
|
||||
}
|
||||
}
|
||||
}, new SourceExtractorMessageExtractor<T>(responseExtractor));
|
||||
}, new SourceExtractorMessageExtractor<>(responseExtractor));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -689,8 +689,7 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
protected boolean hasError(WebServiceConnection connection, WebServiceMessage request) throws IOException {
|
||||
if (checkConnectionForError && connection.hasError()) {
|
||||
// could be a fault
|
||||
if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection) {
|
||||
FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
|
||||
if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection faultConnection) {
|
||||
return !(faultConnection.hasFault() && request instanceof FaultAwareWebServiceMessage);
|
||||
}
|
||||
else {
|
||||
@@ -755,17 +754,15 @@ public class WebServiceTemplate extends WebServiceAccessor implements WebService
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
protected boolean hasFault(WebServiceConnection connection, WebServiceMessage response) throws IOException {
|
||||
if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection) {
|
||||
if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection faultConnection) {
|
||||
// check whether the connection has a fault (i.e. status code 500 in HTTP)
|
||||
FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
|
||||
if (!faultConnection.hasFault()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (response instanceof FaultAwareWebServiceMessage) {
|
||||
if (response instanceof FaultAwareWebServiceMessage faultMessage) {
|
||||
// either the connection has a fault, or checkConnectionForFault is false:
|
||||
// let's verify the fault
|
||||
FaultAwareWebServiceMessage faultMessage = (FaultAwareWebServiceMessage) response;
|
||||
return faultMessage.hasFault();
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Wsdl11DestinationProvider extends AbstractCachingDestinationProvide
|
||||
|
||||
private static TransformerFactory transformerFactory = TransformerFactoryUtils.newInstance();
|
||||
|
||||
private Map<String, String> expressionNamespaces = new HashMap<String, String>();
|
||||
private Map<String, String> expressionNamespaces = new HashMap<>();
|
||||
|
||||
private XPathExpression locationXPathExpression;
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
private void registerEndpointAdapters(Element element, Object source, ParserContext parserContext) {
|
||||
RootBeanDefinition adapterDef = createBeanDefinition(DefaultMethodEndpointAdapter.class, source);
|
||||
|
||||
ManagedList<BeanMetadataElement> argumentResolvers = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> argumentResolvers = new ManagedList<>();
|
||||
argumentResolvers.setSource(source);
|
||||
|
||||
ManagedList<BeanMetadataElement> returnValueHandlers = new ManagedList<BeanMetadataElement>();
|
||||
ManagedList<BeanMetadataElement> returnValueHandlers = new ManagedList<>();
|
||||
returnValueHandlers.setSource(source);
|
||||
|
||||
argumentResolvers.add(createBeanDefinition(MessageContextMethodArgumentResolver.class, source));
|
||||
|
||||
@@ -68,7 +68,7 @@ class DynamicWsdlBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
||||
if (commonsSchemaPresent) {
|
||||
RootBeanDefinition collectionDef = createBeanDefinition(CommonsXsdSchemaCollection.class, source);
|
||||
collectionDef.getPropertyValues().addPropertyValue("inline", "true");
|
||||
ManagedList<String> xsds = new ManagedList<String>();
|
||||
ManagedList<String> xsds = new ManagedList<>();
|
||||
xsds.setSource(source);
|
||||
for (Element schema : schemas) {
|
||||
xsds.add(schema.getAttribute("location"));
|
||||
|
||||
@@ -124,10 +124,10 @@ public class WsConfigurationSupport {
|
||||
*/
|
||||
protected final EndpointInterceptor[] getInterceptors() {
|
||||
if (interceptors == null) {
|
||||
interceptors = new ArrayList<EndpointInterceptor>();
|
||||
interceptors = new ArrayList<>();
|
||||
addInterceptors(interceptors);
|
||||
}
|
||||
return interceptors.toArray(new EndpointInterceptor[interceptors.size()]);
|
||||
return interceptors.toArray(new EndpointInterceptor[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,10 +148,10 @@ public class WsConfigurationSupport {
|
||||
*/
|
||||
@Bean
|
||||
public DefaultMethodEndpointAdapter defaultMethodEndpointAdapter() {
|
||||
List<MethodArgumentResolver> argumentResolvers = new ArrayList<MethodArgumentResolver>();
|
||||
List<MethodArgumentResolver> argumentResolvers = new ArrayList<>();
|
||||
addArgumentResolvers(argumentResolvers);
|
||||
|
||||
List<MethodReturnValueHandler> returnValueHandlers = new ArrayList<MethodReturnValueHandler>();
|
||||
List<MethodReturnValueHandler> returnValueHandlers = new ArrayList<>();
|
||||
addReturnValueHandlers(returnValueHandlers);
|
||||
|
||||
DefaultMethodEndpointAdapter adapter = new DefaultMethodEndpointAdapter();
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHa
|
||||
*/
|
||||
public class WsConfigurerComposite implements WsConfigurer {
|
||||
|
||||
private List<WsConfigurer> delegates = new ArrayList<WsConfigurer>();
|
||||
private List<WsConfigurer> delegates = new ArrayList<>();
|
||||
|
||||
public void addWsConfigurers(List<WsConfigurer> configurers) {
|
||||
if (configurers != null) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractMessageContext implements MessageContext {
|
||||
|
||||
private Map<String, Object> getProperties() {
|
||||
if (properties == null) {
|
||||
properties = new HashMap<String, Object>();
|
||||
properties = new HashMap<>();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -93,8 +93,7 @@ public abstract class AbstractMimeMessage implements MimeMessage {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (inputStreamSource instanceof Resource) {
|
||||
Resource resource = (Resource) inputStreamSource;
|
||||
if (inputStreamSource instanceof Resource resource) {
|
||||
return resource.getFilename();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -105,8 +105,7 @@ public class DomPoxMessage implements PoxMessage {
|
||||
@Override
|
||||
public void writeTo(OutputStream outputStream) throws IOException {
|
||||
try {
|
||||
if (outputStream instanceof TransportOutputStream) {
|
||||
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream;
|
||||
if (outputStream instanceof TransportOutputStream transportOutputStream) {
|
||||
transportOutputStream.addHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType);
|
||||
}
|
||||
transformer.transform(getPayloadSource(), new StreamResult(outputStream));
|
||||
|
||||
@@ -149,7 +149,7 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor
|
||||
Transformer transformer = createNonIndentingTransformer();
|
||||
StringWriter writer = new StringWriter();
|
||||
transformer.transform(source, new StreamResult(writer));
|
||||
String message = logMessage + writer.toString();
|
||||
String message = logMessage + writer;
|
||||
logMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,39 +297,19 @@ public abstract class AbstractXomPayloadEndpoint extends TransformerObjectSuppor
|
||||
|
||||
private static Attribute.Type convertAttributeType(String type) {
|
||||
type = type.toUpperCase(Locale.ENGLISH);
|
||||
if ("CDATA".equals(type)) {
|
||||
return Attribute.Type.CDATA;
|
||||
}
|
||||
else if ("ENTITIES".equals(type)) {
|
||||
return Attribute.Type.ENTITIES;
|
||||
}
|
||||
else if ("ENTITY".equals(type)) {
|
||||
return Attribute.Type.ENTITY;
|
||||
}
|
||||
else if ("ENUMERATION".equals(type)) {
|
||||
return Attribute.Type.ENUMERATION;
|
||||
}
|
||||
else if ("ID".equals(type)) {
|
||||
return Attribute.Type.ID;
|
||||
}
|
||||
else if ("IDREF".equals(type)) {
|
||||
return Attribute.Type.IDREF;
|
||||
}
|
||||
else if ("IDREFS".equals(type)) {
|
||||
return Attribute.Type.IDREFS;
|
||||
}
|
||||
else if ("NMTOKEN".equals(type)) {
|
||||
return Attribute.Type.NMTOKEN;
|
||||
}
|
||||
else if ("NMTOKENS".equals(type)) {
|
||||
return Attribute.Type.NMTOKENS;
|
||||
}
|
||||
else if ("NOTATION".equals(type)) {
|
||||
return Attribute.Type.NOTATION;
|
||||
}
|
||||
else {
|
||||
return Attribute.Type.UNDECLARED;
|
||||
}
|
||||
return switch (type) {
|
||||
case "CDATA" -> Attribute.Type.CDATA;
|
||||
case "ENTITIES" -> Attribute.Type.ENTITIES;
|
||||
case "ENTITY" -> Attribute.Type.ENTITY;
|
||||
case "ENUMERATION" -> Attribute.Type.ENUMERATION;
|
||||
case "ID" -> Attribute.Type.ID;
|
||||
case "IDREF" -> Attribute.Type.IDREF;
|
||||
case "IDREFS" -> Attribute.Type.IDREFS;
|
||||
case "NMTOKEN" -> Attribute.Type.NMTOKEN;
|
||||
case "NMTOKENS" -> Attribute.Type.NMTOKENS;
|
||||
case "NOTATION" -> Attribute.Type.NOTATION;
|
||||
default -> Attribute.Type.UNDECLARED;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,8 +89,7 @@ public final class MethodEndpoint {
|
||||
|
||||
/** Returns the object bean for this method endpoint. */
|
||||
public Object getBean() {
|
||||
if (beanFactory != null && bean instanceof String) {
|
||||
String beanName = (String) bean;
|
||||
if (beanFactory != null && bean instanceof String beanName) {
|
||||
return beanFactory.getBean(beanName);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
private void initMethodArgumentResolvers() {
|
||||
if (CollectionUtils.isEmpty(methodArgumentResolvers)) {
|
||||
List<MethodArgumentResolver> methodArgumentResolvers = new ArrayList<MethodArgumentResolver>();
|
||||
List<MethodArgumentResolver> methodArgumentResolvers = new ArrayList<>();
|
||||
methodArgumentResolvers.add(new DomPayloadMethodProcessor());
|
||||
methodArgumentResolvers.add(new MessageContextMethodArgumentResolver());
|
||||
methodArgumentResolvers.add(new SourcePayloadMethodProcessor());
|
||||
@@ -209,7 +209,7 @@ public class DefaultMethodEndpointAdapter extends AbstractMethodEndpointAdapter
|
||||
|
||||
private void initMethodReturnValueHandlers() {
|
||||
if (CollectionUtils.isEmpty(methodReturnValueHandlers)) {
|
||||
List<MethodReturnValueHandler> methodReturnValueHandlers = new ArrayList<MethodReturnValueHandler>();
|
||||
List<MethodReturnValueHandler> methodReturnValueHandlers = new ArrayList<>();
|
||||
methodReturnValueHandlers.add(new DomPayloadMethodProcessor());
|
||||
methodReturnValueHandlers.add(new SourcePayloadMethodProcessor());
|
||||
if (isPresent(DOM4J_CLASS_NAME)) {
|
||||
|
||||
@@ -104,8 +104,7 @@ public class GenericMarshallingMethodEndpointAdapter extends MarshallingMethodEn
|
||||
if (method.getParameterTypes().length != 1) {
|
||||
return false;
|
||||
}
|
||||
else if (getUnmarshaller() instanceof GenericUnmarshaller) {
|
||||
GenericUnmarshaller genericUnmarshaller = (GenericUnmarshaller) getUnmarshaller();
|
||||
else if (getUnmarshaller() instanceof GenericUnmarshaller genericUnmarshaller) {
|
||||
return genericUnmarshaller.supports(method.getGenericParameterTypes()[0]);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -139,7 +139,7 @@ public class MarshallingMethodEndpointAdapter extends AbstractMethodEndpointAdap
|
||||
protected void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
|
||||
WebServiceMessage request = messageContext.getRequest();
|
||||
Object requestObject = unmarshalRequest(request);
|
||||
Object responseObject = methodEndpoint.invoke(new Object[] { requestObject });
|
||||
Object responseObject = methodEndpoint.invoke(requestObject);
|
||||
if (responseObject != null) {
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
marshalResponse(responseObject, response);
|
||||
|
||||
@@ -141,8 +141,7 @@ public class MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProc
|
||||
if (marshaller == null) {
|
||||
return false;
|
||||
}
|
||||
else if (marshaller instanceof GenericMarshaller) {
|
||||
GenericMarshaller genericMarshaller = (GenericMarshaller) marshaller;
|
||||
else if (marshaller instanceof GenericMarshaller genericMarshaller) {
|
||||
return genericMarshaller.supports(returnType.getGenericParameterType());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -65,8 +65,7 @@ public class DomPayloadMethodProcessor extends AbstractPayloadSourceMethodProces
|
||||
if (parameterType.isAssignableFrom(requestNode.getClass())) {
|
||||
return requestNode;
|
||||
}
|
||||
else if (Element.class.equals(parameterType) && requestNode instanceof Document) {
|
||||
Document document = (Document) requestNode;
|
||||
else if (Element.class.equals(parameterType) && requestNode instanceof Document document) {
|
||||
return document.getDocumentElement();
|
||||
}
|
||||
// should not happen
|
||||
|
||||
@@ -76,7 +76,7 @@ import org.springframework.xml.transform.TraxUtils;
|
||||
*/
|
||||
public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloadMethodProcessor {
|
||||
|
||||
private final ConcurrentMap<Class<?>, JAXBContext> jaxbContexts = new ConcurrentHashMap<Class<?>, JAXBContext>();
|
||||
private final ConcurrentMap<Class<?>, JAXBContext> jaxbContexts = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public final void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
@@ -106,8 +106,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
logger.debug("Marshalling [" + jaxbElement + "] to response payload");
|
||||
}
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
if (response instanceof StreamingWebServiceMessage) {
|
||||
StreamingWebServiceMessage streamingResponse = (StreamingWebServiceMessage) response;
|
||||
if (response instanceof StreamingWebServiceMessage streamingResponse) {
|
||||
|
||||
StreamingPayload payload = new JaxbStreamingPayload(clazz, jaxbElement);
|
||||
streamingResponse.setStreamingPayload(payload);
|
||||
@@ -164,7 +163,7 @@ public abstract class AbstractJaxb2PayloadMethodProcessor extends AbstractPayloa
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<T>(clazz);
|
||||
JaxbElementSourceCallback<T> callback = new JaxbElementSourceCallback<>(clazz);
|
||||
TraxUtils.doWithSource(requestPayload, callback);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Unmarshalled payload request to [" + callback.result + "]");
|
||||
|
||||
@@ -100,8 +100,7 @@ public abstract class AbstractEndpointMapping extends ApplicationObjectSupport i
|
||||
Map<String, SmartEndpointInterceptor> smartInterceptors = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(getApplicationContext(), SmartEndpointInterceptor.class, true, false);
|
||||
if (!smartInterceptors.isEmpty()) {
|
||||
this.smartInterceptors = smartInterceptors.values()
|
||||
.toArray(new SmartEndpointInterceptor[smartInterceptors.size()]);
|
||||
this.smartInterceptors = smartInterceptors.values().toArray(new SmartEndpointInterceptor[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,15 +119,14 @@ public abstract class AbstractEndpointMapping extends ApplicationObjectSupport i
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
}
|
||||
if (endpoint instanceof String) {
|
||||
String endpointName = (String) endpoint;
|
||||
if (endpoint instanceof String endpointName) {
|
||||
endpoint = resolveStringEndpoint(endpointName);
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<EndpointInterceptor> interceptors = new ArrayList<EndpointInterceptor>();
|
||||
List<EndpointInterceptor> interceptors = new ArrayList<>();
|
||||
if (this.interceptors != null) {
|
||||
interceptors.addAll(Arrays.asList(this.interceptors));
|
||||
}
|
||||
@@ -142,7 +140,7 @@ public abstract class AbstractEndpointMapping extends ApplicationObjectSupport i
|
||||
}
|
||||
|
||||
return createEndpointInvocationChain(messageContext, endpoint,
|
||||
interceptors.toArray(new EndpointInterceptor[interceptors.size()]));
|
||||
interceptors.toArray(new EndpointInterceptor[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,10 +42,10 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
|
||||
private boolean registerBeanNames = false;
|
||||
|
||||
private final Map<String, Object> endpointMap = new HashMap<String, Object>();
|
||||
private final Map<String, Object> endpointMap = new HashMap<>();
|
||||
|
||||
// holds mappings set via setEndpointMap and setMappings
|
||||
private Map<String, Object> temporaryEndpointMap = new HashMap<String, Object>();
|
||||
private Map<String, Object> temporaryEndpointMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Set whether to lazily initialize endpoints. Only applicable to singleton endpoints,
|
||||
@@ -144,8 +144,7 @@ public abstract class AbstractMapBasedEndpointMapping extends AbstractEndpointMa
|
||||
throw new ApplicationContextException("Cannot map endpoint [" + endpoint + "] on registration key [" + key
|
||||
+ "]: there's already endpoint [" + mappedEndpoint + "] mapped");
|
||||
}
|
||||
if (!lazyInitEndpoints && endpoint instanceof String) {
|
||||
String endpointName = (String) endpoint;
|
||||
if (!lazyInitEndpoints && endpoint instanceof String endpointName) {
|
||||
endpoint = resolveStringEndpoint(endpointName);
|
||||
}
|
||||
if (endpoint == null) {
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.ws.server.endpoint.MethodEndpoint;
|
||||
*/
|
||||
public abstract class AbstractMethodEndpointMapping<T> extends AbstractEndpointMapping {
|
||||
|
||||
private final Map<T, MethodEndpoint> endpointMap = new HashMap<T, MethodEndpoint>();
|
||||
private final Map<T, MethodEndpoint> endpointMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Lookup an endpoint for the given message. The extraction of the endpoint key is
|
||||
@@ -156,8 +156,8 @@ public abstract class AbstractMethodEndpointMapping<T> extends AbstractEndpointM
|
||||
|
||||
private Set<Method> findEndpointMethods(Class<?> endpointType,
|
||||
final ReflectionUtils.MethodFilter endpointMethodFilter) {
|
||||
final Set<Method> endpointMethods = new LinkedHashSet<Method>();
|
||||
Set<Class<?>> endpointTypes = new LinkedHashSet<Class<?>>();
|
||||
final Set<Method> endpointMethods = new LinkedHashSet<>();
|
||||
Set<Class<?>> endpointTypes = new LinkedHashSet<>();
|
||||
Class<?> specificEndpointType = null;
|
||||
if (!Proxy.isProxyClass(endpointType)) {
|
||||
endpointTypes.add(endpointType);
|
||||
@@ -201,7 +201,7 @@ public abstract class AbstractMethodEndpointMapping<T> extends AbstractEndpointM
|
||||
*/
|
||||
protected List<T> getLookupKeysForMethod(Method method) {
|
||||
T key = getLookupKeyForMethod(method);
|
||||
return key != null ? Collections.singletonList(key) : Collections.<T>emptyList();
|
||||
return key != null ? Collections.singletonList(key) : Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ public class PayloadRootAnnotationMethodEndpointMapping extends AbstractAnnotati
|
||||
|
||||
@Override
|
||||
protected List<QName> getLookupKeysForMethod(Method method) {
|
||||
List<QName> result = new ArrayList<QName>();
|
||||
List<QName> result = new ArrayList<>();
|
||||
|
||||
PayloadRoots payloadRoots = AnnotationUtils.findAnnotation(method, PayloadRoots.class);
|
||||
if (payloadRoots != null) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.ws.soap.addressing.core;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
@@ -34,6 +35,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class EndpointReference implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8999416009328865260L;
|
||||
|
||||
private final URI address;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.ws.soap.addressing.core;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
@@ -37,6 +38,7 @@ import org.w3c.dom.Node;
|
||||
*/
|
||||
public final class MessageAddressingProperties implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6980663311446506672L;
|
||||
|
||||
private final URI to;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UuidMessageIdStrategy implements MessageIdStrategy {
|
||||
|
||||
@Override
|
||||
public URI newMessageId(SoapMessage message) {
|
||||
return URI.create(PREFIX + UUID.randomUUID().toString());
|
||||
return URI.create(PREFIX + UUID.randomUUID());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
public static final String DEFAULT_FAULT_ACTION_SUFFIX = "Fault";
|
||||
|
||||
// keys are action URIs, values are endpoints
|
||||
private final Map<URI, Object> endpointMap = new HashMap<URI, Object>();
|
||||
private final Map<URI, Object> endpointMap = new HashMap<>();
|
||||
|
||||
private String outputActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
|
||||
|
||||
@@ -128,8 +128,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
Assert.notNull(endpoint, "Endpoint object must not be null");
|
||||
Object resolvedEndpoint = endpoint;
|
||||
|
||||
if (endpoint instanceof String) {
|
||||
String endpointName = (String) endpoint;
|
||||
if (endpoint instanceof String endpointName) {
|
||||
if (getApplicationContext().isSingleton(endpointName)) {
|
||||
resolvedEndpoint = getApplicationContext().getBean(endpointName);
|
||||
}
|
||||
@@ -153,7 +152,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
protected URI getResponseAction(Object endpoint, MessageAddressingProperties requestMap) {
|
||||
URI requestAction = requestMap.getAction();
|
||||
if (requestAction != null) {
|
||||
return URI.create(requestAction.toString() + getOutputActionSuffix());
|
||||
return URI.create(requestAction + getOutputActionSuffix());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -164,7 +163,7 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
protected URI getFaultAction(Object endpoint, MessageAddressingProperties requestMap) {
|
||||
URI requestAction = requestMap.getAction();
|
||||
if (requestAction != null) {
|
||||
return URI.create(requestAction.toString() + getFaultActionSuffix());
|
||||
return URI.create(requestAction + getFaultActionSuffix());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
@@ -247,8 +247,7 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
Map<String, SmartEndpointInterceptor> smartInterceptors = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(getApplicationContext(), SmartEndpointInterceptor.class, true, false);
|
||||
if (!smartInterceptors.isEmpty()) {
|
||||
this.smartInterceptors = smartInterceptors.values()
|
||||
.toArray(new SmartEndpointInterceptor[smartInterceptors.size()]);
|
||||
this.smartInterceptors = smartInterceptors.values().toArray(new SmartEndpointInterceptor[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,8 +287,7 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
WebServiceMessageSender[] messageSenders = getMessageSenders(endpoint);
|
||||
MessageIdStrategy messageIdStrategy = getMessageIdStrategy(endpoint);
|
||||
|
||||
List<EndpointInterceptor> interceptors = new ArrayList<EndpointInterceptor>();
|
||||
interceptors.addAll(Arrays.asList(preInterceptors));
|
||||
List<EndpointInterceptor> interceptors = new ArrayList<>(Arrays.asList(preInterceptors));
|
||||
|
||||
AddressingEndpointInterceptor addressingInterceptor = new AddressingEndpointInterceptor(version,
|
||||
messageIdStrategy, messageSenders, responseAction, faultAction);
|
||||
@@ -304,8 +302,8 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
}
|
||||
}
|
||||
|
||||
return new SoapEndpointInvocationChain(endpoint,
|
||||
interceptors.toArray(new EndpointInterceptor[interceptors.size()]), actorsOrRoles, isUltimateReceiver);
|
||||
return new SoapEndpointInvocationChain(endpoint, interceptors.toArray(new EndpointInterceptor[0]),
|
||||
actorsOrRoles, isUltimateReceiver);
|
||||
}
|
||||
|
||||
private boolean supports(AddressingVersion version, SoapMessage request) {
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.springframework.beans.BeansException;
|
||||
public class SimpleActionEndpointMapping extends AbstractActionEndpointMapping {
|
||||
|
||||
// contents will be copied over to endpointMap
|
||||
private final Map<URI, Object> actionMap = new HashMap<URI, Object>();
|
||||
private final Map<URI, Object> actionMap = new HashMap<>();
|
||||
|
||||
private URI address;
|
||||
|
||||
|
||||
@@ -159,8 +159,7 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
|
||||
|
||||
private Element getSoapHeaderElement(SoapMessage message) {
|
||||
Source source = message.getSoapHeader().getSource();
|
||||
if (source instanceof DOMSource) {
|
||||
DOMSource domSource = (DOMSource) source;
|
||||
if (source instanceof DOMSource domSource) {
|
||||
if (domSource.getNode() != null && domSource.getNode().getNodeType() == Node.ELEMENT_NODE) {
|
||||
return (Element) domSource.getNode();
|
||||
}
|
||||
@@ -295,12 +294,10 @@ public abstract class AbstractAddressingVersion extends TransformerObjectSupport
|
||||
}
|
||||
|
||||
private SoapFault addAddressingFault(SoapMessage message, QName subcode, String reason) {
|
||||
if (message.getSoapBody() instanceof Soap11Body) {
|
||||
Soap11Body soapBody = (Soap11Body) message.getSoapBody();
|
||||
if (message.getSoapBody() instanceof Soap11Body soapBody) {
|
||||
return soapBody.addFault(subcode, reason, Locale.ENGLISH);
|
||||
}
|
||||
else if (message.getSoapBody() instanceof Soap12Body) {
|
||||
Soap12Body soapBody = (Soap12Body) message.getSoapBody();
|
||||
else if (message.getSoapBody() instanceof Soap12Body soapBody) {
|
||||
Soap12Fault soapFault = soapBody.addClientOrSenderFault(reason, Locale.ENGLISH);
|
||||
soapFault.addFaultSubcode(subcode);
|
||||
return soapFault;
|
||||
|
||||
@@ -45,7 +45,7 @@ class SaajSoap11Header extends SaajSoapHeader implements Soap11Header {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] actors) {
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
List<SOAPHeaderElement> result = new ArrayList<>();
|
||||
Iterator<SOAPHeaderElement> iterator = getSaajHeader().examineAllHeaderElements();
|
||||
while (iterator.hasNext()) {
|
||||
SOAPHeaderElement saajHeaderElement = iterator.next();
|
||||
|
||||
@@ -72,7 +72,7 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] roles, boolean isUltimateDestination)
|
||||
throws SoapHeaderException {
|
||||
List<SOAPHeaderElement> result = new ArrayList<SOAPHeaderElement>();
|
||||
List<SOAPHeaderElement> result = new ArrayList<>();
|
||||
Iterator<SOAPHeaderElement> iterator = getSaajHeader().examineAllHeaderElements();
|
||||
while (iterator.hasNext()) {
|
||||
SOAPHeaderElement saajHeaderElement = iterator.next();
|
||||
@@ -89,14 +89,16 @@ class SaajSoap12Header extends SaajSoapHeader implements Soap12Header {
|
||||
if (!StringUtils.hasLength(headerRole)) {
|
||||
return true;
|
||||
}
|
||||
if (SOAPConstants.URI_SOAP_1_2_ROLE_NEXT.equals(headerRole)) {
|
||||
return true;
|
||||
}
|
||||
if (SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER.equals(headerRole)) {
|
||||
return isUltimateDestination;
|
||||
}
|
||||
if (SOAPConstants.URI_SOAP_1_2_ROLE_NONE.equals(headerRole)) {
|
||||
return false;
|
||||
switch (headerRole) {
|
||||
case SOAPConstants.URI_SOAP_1_2_ROLE_NEXT -> {
|
||||
return true;
|
||||
}
|
||||
case SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER -> {
|
||||
return isUltimateDestination;
|
||||
}
|
||||
case SOAPConstants.URI_SOAP_1_2_ROLE_NONE -> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(roles)) {
|
||||
for (String role : roles) {
|
||||
|
||||
@@ -243,8 +243,7 @@ public class SaajSoapMessage extends AbstractSoapMessage {
|
||||
try {
|
||||
SOAPMessage message = getSaajMessage();
|
||||
message.saveChanges();
|
||||
if (outputStream instanceof TransportOutputStream) {
|
||||
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream;
|
||||
if (outputStream instanceof TransportOutputStream transportOutputStream) {
|
||||
// some SAAJ implementations (Axis 1) do not have a Content-Type header by
|
||||
// default
|
||||
MimeHeaders headers = message.getMimeHeaders();
|
||||
|
||||
@@ -242,8 +242,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
|
||||
|
||||
private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException {
|
||||
MimeHeaders mimeHeaders = new MimeHeaders();
|
||||
if (inputStream instanceof TransportInputStream) {
|
||||
TransportInputStream transportInputStream = (TransportInputStream) inputStream;
|
||||
if (inputStream instanceof TransportInputStream transportInputStream) {
|
||||
for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) {
|
||||
String headerName = headerNames.next();
|
||||
for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SaajContentHandler implements ContentHandler {
|
||||
|
||||
private final SOAPEnvelope envelope;
|
||||
|
||||
private Map<String, String> namespaces = new LinkedHashMap<String, String>();
|
||||
private Map<String, String> namespaces = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Constructs a new instance of the {@code SaajContentHandler} that creates children
|
||||
@@ -65,7 +65,7 @@ public class SaajContentHandler implements ContentHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char ch[], int start, int length) throws SAXException {
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {
|
||||
try {
|
||||
String text = new String(ch, start, length);
|
||||
element.addTextNode(text);
|
||||
@@ -151,7 +151,7 @@ public class SaajContentHandler implements ContentHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
|
||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -129,8 +129,7 @@ public class SaajXmlReader extends AbstractXmlReader {
|
||||
if (node instanceof SOAPElement) {
|
||||
handleElement((SOAPElement) node);
|
||||
}
|
||||
else if (node instanceof Text) {
|
||||
Text text = (Text) node;
|
||||
else if (node instanceof Text text) {
|
||||
handleText(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +90,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
if (messageContext.getRequest() instanceof SoapMessage) {
|
||||
String[] actorsOrRoles = null;
|
||||
boolean isUltimateReceiver = true;
|
||||
if (mappedEndpoint instanceof SoapEndpointInvocationChain) {
|
||||
SoapEndpointInvocationChain soapChain = (SoapEndpointInvocationChain) mappedEndpoint;
|
||||
if (mappedEndpoint instanceof SoapEndpointInvocationChain soapChain) {
|
||||
actorsOrRoles = soapChain.getActorsOrRoles();
|
||||
isUltimateReceiver = soapChain.isUltimateReceiver();
|
||||
}
|
||||
@@ -115,7 +114,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
headerIterator = ((Soap12Header) soapHeader).examineHeaderElementsToProcess(actorsOrRoles,
|
||||
isUltimateReceiver);
|
||||
}
|
||||
List<QName> notUnderstoodHeaderNames = new ArrayList<QName>();
|
||||
List<QName> notUnderstoodHeaderNames = new ArrayList<>();
|
||||
while (headerIterator.hasNext()) {
|
||||
SoapHeaderElement headerElement = headerIterator.next();
|
||||
QName headerName = headerElement.getName();
|
||||
@@ -171,8 +170,7 @@ public class SoapMessageDispatcher extends MessageDispatcher {
|
||||
fault.setFaultActorOrRole(actorsOrRoles[0]);
|
||||
}
|
||||
SoapHeader header = soapResponse.getSoapHeader();
|
||||
if (header instanceof Soap12Header) {
|
||||
Soap12Header soap12Header = (Soap12Header) header;
|
||||
if (header instanceof Soap12Header soap12Header) {
|
||||
for (QName headerName : notUnderstoodHeaderNames) {
|
||||
soap12Header.addNotUnderstoodHeaderElement(headerName);
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ public abstract class AbstractFaultCreatingValidatingMarshallingPayloadEndpoint
|
||||
String msg = messageSource.getMessage(objectError, getFaultLocale());
|
||||
logger.warn("Validation error on request object[" + requestObject + "]: " + msg);
|
||||
}
|
||||
if (messageContext.getResponse() instanceof SoapMessage) {
|
||||
SoapMessage response = (SoapMessage) messageContext.getResponse();
|
||||
if (messageContext.getResponse() instanceof SoapMessage response) {
|
||||
SoapBody body = response.getSoapBody();
|
||||
SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultLocale());
|
||||
if (getAddValidationErrorDetail()) {
|
||||
|
||||
@@ -89,12 +89,10 @@ public abstract class AbstractSoapFaultDefinitionExceptionResolver extends Abstr
|
||||
fault = soapBody.addClientOrSenderFault(faultStringOrReason, definition.getLocale());
|
||||
}
|
||||
else {
|
||||
if (soapBody instanceof Soap11Body) {
|
||||
Soap11Body soap11Body = (Soap11Body) soapBody;
|
||||
if (soapBody instanceof Soap11Body soap11Body) {
|
||||
fault = soap11Body.addFault(definition.getFaultCode(), faultStringOrReason, definition.getLocale());
|
||||
}
|
||||
else if (soapBody instanceof Soap12Body) {
|
||||
Soap12Body soap12Body = (Soap12Body) soapBody;
|
||||
else if (soapBody instanceof Soap12Body soap12Body) {
|
||||
Soap12Fault soap12Fault = soap12Body.addServerOrReceiverFault(faultStringOrReason,
|
||||
definition.getLocale());
|
||||
soap12Fault.addFaultSubcode(definition.getFaultCode());
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*/
|
||||
public class SoapFaultMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
|
||||
|
||||
private Map<String, String> exceptionMappings = new LinkedHashMap<String, String>();
|
||||
private Map<String, String> exceptionMappings = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Set the mappings between exception class names and SOAP Faults. The exception class
|
||||
|
||||
@@ -71,8 +71,7 @@ public class SoapHeaderElementMethodArgumentResolver implements MethodArgumentRe
|
||||
// List<SoapHeaderElement> parameter
|
||||
if (List.class.equals(parameterType)) {
|
||||
Type genericType = parameter.getGenericParameterType();
|
||||
if (genericType instanceof ParameterizedType) {
|
||||
ParameterizedType parameterizedType = (ParameterizedType) genericType;
|
||||
if (genericType instanceof ParameterizedType parameterizedType) {
|
||||
Type[] typeArguments = parameterizedType.getActualTypeArguments();
|
||||
if (typeArguments.length == 1 && SoapHeaderElement.class.equals(typeArguments[0])) {
|
||||
return true;
|
||||
@@ -120,7 +119,7 @@ public class SoapHeaderElementMethodArgumentResolver implements MethodArgumentRe
|
||||
|
||||
private List<SoapHeaderElement> extractSoapHeaderList(QName qname,
|
||||
org.springframework.ws.soap.SoapHeader soapHeader) {
|
||||
List<SoapHeaderElement> result = new ArrayList<SoapHeaderElement>();
|
||||
List<SoapHeaderElement> result = new ArrayList<>();
|
||||
Iterator<SoapHeaderElement> elements = soapHeader.examineAllHeaderElements();
|
||||
while (elements.hasNext()) {
|
||||
SoapHeaderElement e = elements.next();
|
||||
|
||||
@@ -70,7 +70,7 @@ public enum FaultCode {
|
||||
|
||||
private final QName value;
|
||||
|
||||
private FaultCode(QName value) {
|
||||
FaultCode(QName value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,8 +161,7 @@ public abstract class AbstractFaultCreatingValidatingInterceptor extends Abstrac
|
||||
for (SAXParseException error : errors) {
|
||||
logger.warn("XML validation error on request: " + error.getMessage());
|
||||
}
|
||||
if (messageContext.getResponse() instanceof SoapMessage) {
|
||||
SoapMessage response = (SoapMessage) messageContext.getResponse();
|
||||
if (messageContext.getResponse() instanceof SoapMessage response) {
|
||||
SoapBody body = response.getSoapBody();
|
||||
SoapFault fault = body.addClientOrSenderFault(getFaultStringOrReason(), getFaultStringOrReasonLocale());
|
||||
if (getAddValidationErrorDetail()) {
|
||||
|
||||
@@ -61,8 +61,7 @@ public class SoapEnvelopeLoggingInterceptor extends AbstractLoggingInterceptor i
|
||||
|
||||
@Override
|
||||
protected Source getSource(WebServiceMessage message) {
|
||||
if (message instanceof SoapMessage) {
|
||||
SoapMessage soapMessage = (SoapMessage) message;
|
||||
if (message instanceof SoapMessage soapMessage) {
|
||||
return soapMessage.getEnvelope().getSource();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -93,8 +93,7 @@ public class SoapActionAnnotationMethodEndpointMapping extends AbstractAnnotatio
|
||||
|
||||
@Override
|
||||
protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
|
||||
if (messageContext.getRequest() instanceof SoapMessage) {
|
||||
SoapMessage request = (SoapMessage) messageContext.getRequest();
|
||||
if (messageContext.getRequest() instanceof SoapMessage request) {
|
||||
String soapAction = request.getSoapAction();
|
||||
if (StringUtils.hasLength(soapAction) && soapAction.charAt(0) == '"'
|
||||
&& soapAction.charAt(soapAction.length() - 1) == '"') {
|
||||
@@ -117,7 +116,7 @@ public class SoapActionAnnotationMethodEndpointMapping extends AbstractAnnotatio
|
||||
|
||||
@Override
|
||||
protected List<String> getLookupKeysForMethod(Method method) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
SoapActions soapActions = AnnotationUtils.findAnnotation(method, SoapActions.class);
|
||||
if (soapActions != null) {
|
||||
|
||||
@@ -92,8 +92,7 @@ public class SoapActionEndpointMapping extends AbstractMapBasedEndpointMapping i
|
||||
|
||||
@Override
|
||||
protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
|
||||
if (messageContext.getRequest() instanceof SoapMessage) {
|
||||
SoapMessage request = (SoapMessage) messageContext.getRequest();
|
||||
if (messageContext.getRequest() instanceof SoapMessage request) {
|
||||
String soapAction = request.getSoapAction();
|
||||
if (StringUtils.hasLength(soapAction) && soapAction.charAt(0) == '"'
|
||||
&& soapAction.charAt(soapAction.length() - 1) == '"') {
|
||||
|
||||
@@ -157,8 +157,7 @@ public class DefaultStrategiesHelper {
|
||||
/** Instantiates the given bean, simulating the standard bean life cycle. */
|
||||
private <T> T instantiateBean(Class<T> clazz, ApplicationContext applicationContext) {
|
||||
T strategy = BeanUtils.instantiateClass(clazz);
|
||||
if (strategy instanceof BeanNameAware) {
|
||||
BeanNameAware beanNameAware = (BeanNameAware) strategy;
|
||||
if (strategy instanceof BeanNameAware beanNameAware) {
|
||||
beanNameAware.setBeanName(clazz.getName());
|
||||
}
|
||||
if (applicationContext != null) {
|
||||
@@ -177,8 +176,7 @@ public class DefaultStrategiesHelper {
|
||||
if (strategy instanceof MessageSourceAware) {
|
||||
((MessageSourceAware) strategy).setMessageSource(applicationContext);
|
||||
}
|
||||
if (strategy instanceof ApplicationContextAware) {
|
||||
ApplicationContextAware applicationContextAware = (ApplicationContextAware) strategy;
|
||||
if (strategy instanceof ApplicationContextAware applicationContextAware) {
|
||||
applicationContextAware.setApplicationContext(applicationContext);
|
||||
}
|
||||
if (applicationContext instanceof WebApplicationContext && strategy instanceof ServletContextAware) {
|
||||
@@ -186,8 +184,7 @@ public class DefaultStrategiesHelper {
|
||||
((ServletContextAware) strategy).setServletContext(servletContext);
|
||||
}
|
||||
}
|
||||
if (strategy instanceof InitializingBean) {
|
||||
InitializingBean initializingBean = (InitializingBean) strategy;
|
||||
if (strategy instanceof InitializingBean initializingBean) {
|
||||
try {
|
||||
initializingBean.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ public abstract class MarshallingUtils {
|
||||
if (payload == null) {
|
||||
return null;
|
||||
}
|
||||
else if (unmarshaller instanceof MimeUnmarshaller && message instanceof MimeMessage) {
|
||||
MimeUnmarshaller mimeUnmarshaller = (MimeUnmarshaller) unmarshaller;
|
||||
else if (unmarshaller instanceof MimeUnmarshaller mimeUnmarshaller && message instanceof MimeMessage) {
|
||||
MimeMessageContainer container = new MimeMessageContainer((MimeMessage) message);
|
||||
return mimeUnmarshaller.unmarshal(payload, container);
|
||||
}
|
||||
@@ -78,8 +77,7 @@ public abstract class MarshallingUtils {
|
||||
* @throws IOException in case of I/O errors
|
||||
*/
|
||||
public static void marshal(Marshaller marshaller, Object graph, WebServiceMessage message) throws IOException {
|
||||
if (marshaller instanceof MimeMarshaller && message instanceof MimeMessage) {
|
||||
MimeMarshaller mimeMarshaller = (MimeMarshaller) marshaller;
|
||||
if (marshaller instanceof MimeMarshaller mimeMarshaller && message instanceof MimeMessage) {
|
||||
MimeMessageContainer container = new MimeMessageContainer((MimeMessage) message);
|
||||
mimeMarshaller.marshal(graph, message.getPayloadResult(), container);
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ public abstract class TransportInputStream extends InputStream {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[]) throws IOException {
|
||||
public int read(byte[] b) throws IOException {
|
||||
return getInputStream().read(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[], int off, int len) throws IOException {
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
return getInputStream().read(b, off, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ public abstract class TransportOutputStream extends OutputStream {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte b[]) throws IOException {
|
||||
public void write(byte[] b) throws IOException {
|
||||
getOutputStream().write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
getOutputStream().write(b, off, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,14 +140,11 @@ public abstract class AbstractHttpSenderConnection extends AbstractSenderConnect
|
||||
// SOAP 1.1 specifies a 500 status code for faults
|
||||
// SOAP 1.2 specifies a 400 status code for sender faults, and 500 for all other
|
||||
// faults
|
||||
switch (getResponseCode()) {
|
||||
case HttpTransportConstants.STATUS_INTERNAL_SERVER_ERROR:
|
||||
return isSoap11Response() || isSoap12Response();
|
||||
case HttpTransportConstants.STATUS_BAD_REQUEST:
|
||||
return isSoap12Response();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return switch (getResponseCode()) {
|
||||
case HttpTransportConstants.STATUS_INTERNAL_SERVER_ERROR -> isSoap11Response() || isSoap12Response();
|
||||
case HttpTransportConstants.STATUS_BAD_REQUEST -> isSoap12Response();
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
/** Determine whether the response is a SOAP 1.1 message. */
|
||||
|
||||
@@ -188,12 +188,11 @@ public class HttpComponentsMessageSender extends AbstractHttpWebServiceMessageSe
|
||||
*/
|
||||
public void setMaxConnectionsPerHost(Map<String, String> maxConnectionsPerHost) throws URISyntaxException {
|
||||
org.apache.http.conn.ClientConnectionManager connectionManager = getHttpClient().getConnectionManager();
|
||||
if (!(connectionManager instanceof org.apache.http.impl.conn.PoolingClientConnectionManager)) {
|
||||
if (!(connectionManager instanceof org.apache.http.impl.conn.PoolingClientConnectionManager poolingConnectionManager)) {
|
||||
throw new IllegalArgumentException(
|
||||
"maxConnectionsPerHost is not supported on " + connectionManager.getClass().getName() + ". Use "
|
||||
+ org.apache.http.impl.conn.PoolingClientConnectionManager.class.getName() + " instead");
|
||||
}
|
||||
org.apache.http.impl.conn.PoolingClientConnectionManager poolingConnectionManager = (org.apache.http.impl.conn.PoolingClientConnectionManager) connectionManager;
|
||||
|
||||
for (Map.Entry<String, String> entry : maxConnectionsPerHost.entrySet()) {
|
||||
URI uri = new URI(entry.getKey());
|
||||
|
||||
@@ -108,12 +108,12 @@ public class HttpServletConnection extends AbstractReceiverConnection
|
||||
|
||||
@Override
|
||||
public Iterator<String> getRequestHeaderNames() throws IOException {
|
||||
return new EnumerationIterator<String>(getHttpServletRequest().getHeaderNames());
|
||||
return new EnumerationIterator<>(getHttpServletRequest().getHeaderNames());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getRequestHeaders(String name) throws IOException {
|
||||
return new EnumerationIterator<String>(getHttpServletRequest().getHeaders(name));
|
||||
return new EnumerationIterator<>(getHttpServletRequest().getHeaders(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -106,7 +106,7 @@ public class HttpUrlConnection extends AbstractHttpSenderConnection {
|
||||
|
||||
@Override
|
||||
public Iterator<String> getResponseHeaderNames() throws IOException {
|
||||
Set<String> headerNames = new HashSet<String>();
|
||||
Set<String> headerNames = new HashSet<>();
|
||||
// Header field 0 is the status line, so we start at 1
|
||||
int i = 1;
|
||||
while (true) {
|
||||
|
||||
@@ -68,11 +68,10 @@ public class HttpUrlConnectionMessageSender extends AbstractHttpWebServiceMessag
|
||||
public WebServiceConnection createConnection(URI uri) throws IOException {
|
||||
URL url = uri.toURL();
|
||||
URLConnection connection = url.openConnection();
|
||||
if (!(connection instanceof HttpURLConnection)) {
|
||||
if (!(connection instanceof HttpURLConnection httpURLConnection)) {
|
||||
throw new HttpTransportException("URI [" + uri + "] is not an HTTP URL");
|
||||
}
|
||||
else {
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
|
||||
prepareConnection(httpURLConnection);
|
||||
return new HttpUrlConnection(httpURLConnection);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ public abstract class LocationTransformerObjectSupport extends TransformerObject
|
||||
|
||||
List<Node> locationNodes = xPathExpression.evaluateAsNodeList(definitionDocument);
|
||||
for (Node locationNode : locationNodes) {
|
||||
if (locationNode instanceof Attr) {
|
||||
Attr location = (Attr) locationNode;
|
||||
if (locationNode instanceof Attr location) {
|
||||
if (StringUtils.hasLength(location.getValue())) {
|
||||
String newLocation = transformLocation(location.getValue(), request);
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class WsdlDefinitionHandlerAdapter extends LocationTransformerObjectSuppo
|
||||
|
||||
private static final String CONTENT_TYPE = "text/xml";
|
||||
|
||||
private Map<String, String> expressionNamespaces = new HashMap<String, String>();
|
||||
private Map<String, String> expressionNamespaces = new HashMap<>();
|
||||
|
||||
private String locationExpression = DEFAULT_LOCATION_EXPRESSION;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class XsdSchemaHandlerAdapter extends LocationTransformerObjectSupport
|
||||
|
||||
private static final String CONTENT_TYPE = "text/xml";
|
||||
|
||||
private Map<String, String> expressionNamespaces = new HashMap<String, String>();
|
||||
private Map<String, String> expressionNamespaces = new HashMap<>();
|
||||
|
||||
private String schemaLocationExpression = DEFAULT_SCHEMA_LOCATION_EXPRESSION;
|
||||
|
||||
|
||||
@@ -92,10 +92,8 @@ public abstract class WebServiceMessageReceiverObjectSupport implements Initiali
|
||||
receiver.receive(messageContext);
|
||||
if (messageContext.hasResponse()) {
|
||||
WebServiceMessage response = messageContext.getResponse();
|
||||
if (response instanceof FaultAwareWebServiceMessage
|
||||
&& connection instanceof FaultAwareWebServiceConnection) {
|
||||
FaultAwareWebServiceMessage faultResponse = (FaultAwareWebServiceMessage) response;
|
||||
FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
|
||||
if (response instanceof FaultAwareWebServiceMessage faultResponse
|
||||
&& connection instanceof FaultAwareWebServiceConnection faultConnection) {
|
||||
faultConnection.setFaultCode(faultResponse.getFaultCode());
|
||||
}
|
||||
connection.send(messageContext.getResponse());
|
||||
|
||||
@@ -52,8 +52,7 @@ public class DefaultMessagesProvider implements MessagesProvider {
|
||||
Assert.notNull(types, "No types element present in definition");
|
||||
for (Object element : types.getExtensibilityElements()) {
|
||||
ExtensibilityElement extensibilityElement = (ExtensibilityElement) element;
|
||||
if (extensibilityElement instanceof Schema) {
|
||||
Schema schema = (Schema) extensibilityElement;
|
||||
if (extensibilityElement instanceof Schema schema) {
|
||||
if (schema.getElement() != null) {
|
||||
createMessages(definition, schema.getElement());
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractWebServiceMessageFactoryTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateEmptyMessage() throws Exception {
|
||||
public void testCreateEmptyMessage() {
|
||||
|
||||
WebServiceMessage message = messageFactory.createWebServiceMessage();
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ public class MockWebServiceMessage implements FaultAwareWebServiceMessage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char cbuf[], int off, int len) {
|
||||
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();
|
||||
|
||||
@@ -219,7 +219,7 @@ public abstract class AbstractSoap12WebServiceTemplateIntegrationTest {
|
||||
Marshaller marshaller = new Marshaller() {
|
||||
|
||||
@Override
|
||||
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
|
||||
public void marshal(Object graph, Result result) throws XmlMappingException {
|
||||
|
||||
assertThat(requestObject).isEqualTo(graph);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DomPoxWebServiceTemplateIntegrationTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
resp.sendError(sc);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SimpleFaultMessageResolverTest {
|
||||
private SimpleFaultMessageResolver resolver;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
resolver = new SimpleFaultMessageResolver();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class WebServiceTemplateTest {
|
||||
template.setMessageSender(new WebServiceMessageSender() {
|
||||
|
||||
@Override
|
||||
public WebServiceConnection createConnection(URI uri) throws IOException {
|
||||
public WebServiceConnection createConnection(URI uri) {
|
||||
return connectionMock;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class WebServiceTemplateTest {
|
||||
template.setMessageSender(new WebServiceMessageSender() {
|
||||
|
||||
@Override
|
||||
public WebServiceConnection createConnection(URI uri) throws IOException {
|
||||
public WebServiceConnection createConnection(URI uri) {
|
||||
return connectionMock;
|
||||
}
|
||||
|
||||
@@ -347,8 +347,8 @@ public class WebServiceTemplateTest {
|
||||
when(interceptorMock2.handleRequest(isA(MessageContext.class))).thenReturn(true);
|
||||
when(interceptorMock2.handleResponse(isA(MessageContext.class))).thenReturn(true);
|
||||
when(interceptorMock1.handleResponse(isA(MessageContext.class))).thenReturn(true);
|
||||
interceptorMock2.afterCompletion(isA(MessageContext.class), (Exception) isNull());
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), (Exception) isNull());
|
||||
interceptorMock2.afterCompletion(isA(MessageContext.class), isNull());
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), isNull());
|
||||
|
||||
WebServiceMessageCallback requestCallback = mock(WebServiceMessageCallback.class);
|
||||
requestCallback.doWithMessage(isA(WebServiceMessage.class));
|
||||
@@ -377,7 +377,7 @@ public class WebServiceTemplateTest {
|
||||
ClientInterceptor interceptorMock2 = mock(ClientInterceptor.class);
|
||||
template.setInterceptors(new ClientInterceptor[] { interceptorMock1, interceptorMock2 });
|
||||
when(interceptorMock1.handleRequest(isA(MessageContext.class))).thenReturn(false);
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), (Exception) isNull());
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), isNull());
|
||||
|
||||
WebServiceMessageCallback requestCallback = mock(WebServiceMessageCallback.class);
|
||||
requestCallback.doWithMessage(messageContext.getRequest());
|
||||
@@ -401,7 +401,7 @@ public class WebServiceTemplateTest {
|
||||
template.setInterceptors(new ClientInterceptor[] { interceptorMock1, interceptorMock2 });
|
||||
when(interceptorMock1.handleRequest(isA(MessageContext.class))).thenReturn(false);
|
||||
when(interceptorMock1.handleResponse(isA(MessageContext.class))).thenReturn(true);
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), (Exception) isNull());
|
||||
interceptorMock1.afterCompletion(isA(MessageContext.class), isNull());
|
||||
|
||||
WebServiceMessageCallback requestCallback = mock(WebServiceMessageCallback.class);
|
||||
requestCallback.doWithMessage(messageContext.getRequest());
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Wsdl11DestinationProviderTest {
|
||||
private Wsdl11DestinationProvider provider;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
provider = new Wsdl11DestinationProvider();
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class PayloadValidatingInterceptorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonExistingSchema() throws Exception {
|
||||
public void testNonExistingSchema() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class AnnotationDrivenBeanDefinitionParserTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
applicationContext = new ClassPathXmlApplicationContext("annotationDrivenBeanDefinitionParserTest.xml",
|
||||
getClass());
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class InterceptorsBeanDefinitionParserTest {
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
|
||||
"interceptorsBeanDefinitionParserOrderTest.xml", getClass());
|
||||
|
||||
List<DelegatingSmartEndpointInterceptor> interceptors = new ArrayList<DelegatingSmartEndpointInterceptor>(
|
||||
List<DelegatingSmartEndpointInterceptor> interceptors = new ArrayList<>(
|
||||
applicationContext.getBeansOfType(DelegatingSmartEndpointInterceptor.class).values());
|
||||
|
||||
assertThat(interceptors).hasSize(6);
|
||||
@@ -75,7 +75,7 @@ public class InterceptorsBeanDefinitionParserTest {
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
|
||||
"interceptorsBeanDefinitionParserInjectionTest.xml", getClass());
|
||||
|
||||
List<DelegatingSmartEndpointInterceptor> interceptors = new ArrayList<DelegatingSmartEndpointInterceptor>(
|
||||
List<DelegatingSmartEndpointInterceptor> interceptors = new ArrayList<>(
|
||||
applicationContext.getBeansOfType(DelegatingSmartEndpointInterceptor.class).values());
|
||||
|
||||
assertThat(interceptors).hasSize(1);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class WebServicesNamespaceHandlerTigerTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
applicationContext = new ClassPathXmlApplicationContext("webServicesNamespaceHandlerTest-tiger.xml",
|
||||
getClass());
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class WsdlBeanDefinitionParserTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
applicationContext = new ClassPathXmlApplicationContext("wsdlBeanDefinitionParserTest.xml", getClass());
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DefaultWsConfigurationTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
|
||||
applicationContext.register(TestConfig.class);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class WsConfigurationSupportTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
|
||||
applicationContext.register(TestConfig.class);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WsConfigurerAdapterTest {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
|
||||
applicationContext.register(TestConfig.class);
|
||||
@@ -131,7 +131,7 @@ public class WsConfigurerAdapterTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
|
||||
public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -145,8 +145,7 @@ public class WsConfigurerAdapterTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
|
||||
throws Exception {
|
||||
public void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class DefaultMessageContextTest {
|
||||
private WebServiceMessage request;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
factoryMock = createMock(WebServiceMessageFactory.class);
|
||||
request = new MockWebServiceMessage();
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.ws.WebServiceMessageFactory;
|
||||
public class DomPoxMessageFactoryTest extends AbstractWebServiceMessageFactoryTest {
|
||||
|
||||
@Override
|
||||
protected WebServiceMessageFactory createMessageFactory() throws Exception {
|
||||
protected WebServiceMessageFactory createMessageFactory() {
|
||||
return new DomPoxMessageFactory();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MessageDispatcherTest {
|
||||
private WebServiceMessageFactory factoryMock;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
dispatcher = new MessageDispatcher();
|
||||
factoryMock = createMock(WebServiceMessageFactory.class);
|
||||
@@ -395,7 +395,7 @@ public class MessageDispatcherTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoEndpointFound() throws Exception {
|
||||
public void testNoEndpointFound() {
|
||||
|
||||
dispatcher.setEndpointMappings(Collections.emptyList());
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Dom4jPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDom4jPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) {
|
||||
|
||||
assertThat(requestElement).isNotNull();
|
||||
assertThat(responseDocument).isNotNull();
|
||||
@@ -47,7 +47,7 @@ public class Dom4jPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDom4jPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -59,7 +59,7 @@ public class Dom4jPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDom4jPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) {
|
||||
|
||||
assertThat(requestElement).isNull();
|
||||
return null;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document document) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document document) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -41,7 +41,7 @@ public class DomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) {
|
||||
|
||||
assertThat(requestElement).isNotNull();
|
||||
assertThat(responseDocument).isNotNull();
|
||||
@@ -59,7 +59,7 @@ public class DomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement, Document responseDocument) {
|
||||
|
||||
assertThat(requestElement).isNull();
|
||||
return null;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EndpointExceptionResolverTest {
|
||||
};
|
||||
|
||||
exceptionResolver.setMappedEndpoints(Collections.singleton(this));
|
||||
methodEndpoint = new MethodEndpoint(this, getClass().getMethod("emptyMethod", new Class[0]));
|
||||
methodEndpoint = new MethodEndpoint(this, getClass().getMethod("emptyMethod"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -29,7 +29,7 @@ public class JDomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractJDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -41,7 +41,7 @@ public class JDomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractJDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement) {
|
||||
|
||||
assertThat(requestElement).isNotNull();
|
||||
assertThat(requestElement.getName()).isEqualTo(REQUEST_ELEMENT);
|
||||
@@ -58,7 +58,7 @@ public class JDomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractJDomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement) {
|
||||
|
||||
assertThat(requestElement).isNull();
|
||||
return null;
|
||||
|
||||
@@ -116,7 +116,7 @@ public class MarshallingPayloadEndpointTest {
|
||||
AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Object invokeInternal(Object requestObject) throws Exception {
|
||||
protected Object invokeInternal(Object requestObject) {
|
||||
|
||||
assertThat(requestObject).isEqualTo(42L);
|
||||
return "result";
|
||||
@@ -174,7 +174,7 @@ public class MarshallingPayloadEndpointTest {
|
||||
AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Object invokeInternal(Object requestObject) throws Exception {
|
||||
protected Object invokeInternal(Object requestObject) {
|
||||
|
||||
assertThat(requestObject).isEqualTo(42L);
|
||||
return null;
|
||||
@@ -201,7 +201,7 @@ public class MarshallingPayloadEndpointTest {
|
||||
AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Object invokeInternal(Object requestObject) throws Exception {
|
||||
protected Object invokeInternal(Object requestObject) {
|
||||
|
||||
assertThat(requestObject).isNull();
|
||||
return null;
|
||||
@@ -239,7 +239,7 @@ public class MarshallingPayloadEndpointTest {
|
||||
AbstractMarshallingPayloadEndpoint endpoint = new AbstractMarshallingPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Object invokeInternal(Object requestObject) throws Exception {
|
||||
protected Object invokeInternal(Object requestObject) {
|
||||
|
||||
assertThat(requestObject).isEqualTo(42L);
|
||||
return "result";
|
||||
@@ -261,12 +261,12 @@ public class MarshallingPayloadEndpointTest {
|
||||
private static class SimpleMarshaller implements Marshaller, Unmarshaller {
|
||||
|
||||
@Override
|
||||
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
|
||||
public void marshal(Object graph, Result result) throws XmlMappingException {
|
||||
fail("Not expected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object unmarshal(Source source) throws XmlMappingException, IOException {
|
||||
public Object unmarshal(Source source) throws XmlMappingException {
|
||||
fail("Not expected");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ public class MethodEndpointTest {
|
||||
@Test
|
||||
public void testEquals() throws Exception {
|
||||
|
||||
assertThat(endpoint).isEqualTo(endpoint);
|
||||
assertThat(endpoint).isEqualTo(new MethodEndpoint(this, method));
|
||||
|
||||
Method otherMethod = getClass().getMethod("testEquals");
|
||||
|
||||
@@ -58,7 +58,7 @@ public class XomPayloadEndpointTest extends AbstractPayloadEndpointTest {
|
||||
return new AbstractXomPayloadEndpoint() {
|
||||
|
||||
@Override
|
||||
protected Element invokeInternal(Element requestElement) throws Exception {
|
||||
protected Element invokeInternal(Element requestElement) {
|
||||
|
||||
assertThat(requestElement).isNull();
|
||||
return null;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testNoResponse() throws Exception {
|
||||
|
||||
Method noResponse = getClass().getMethod("noResponse", new Class[] { MyType.class });
|
||||
Method noResponse = getClass().getMethod("noResponse", MyType.class);
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, noResponse);
|
||||
expect(unmarshallerMock.unmarshal(isA(Source.class))).andReturn(new MyType());
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
|
||||
MockWebServiceMessage request = new MockWebServiceMessage();
|
||||
messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
|
||||
Method noResponse = getClass().getMethod("noResponse", new Class[] { MyType.class });
|
||||
Method noResponse = getClass().getMethod("noResponse", MyType.class);
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, noResponse);
|
||||
|
||||
replay(marshallerMock, unmarshallerMock);
|
||||
@@ -106,7 +106,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testResponse() throws Exception {
|
||||
|
||||
Method response = getClass().getMethod("response", new Class[] { MyType.class });
|
||||
Method response = getClass().getMethod("response", MyType.class);
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, response);
|
||||
expect(unmarshallerMock.unmarshal(isA(Source.class))).andReturn(new MyType());
|
||||
marshallerMock.marshal(isA(MyType.class), isA(Result.class));
|
||||
@@ -125,7 +125,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testSupportedNoResponse() throws NoSuchMethodException {
|
||||
|
||||
Method noResponse = getClass().getMethod("noResponse", new Class[] { MyType.class });
|
||||
Method noResponse = getClass().getMethod("noResponse", MyType.class);
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, noResponse);
|
||||
expect(unmarshallerMock.supports(MyType.class)).andReturn(true);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testSupportedResponse() throws NoSuchMethodException {
|
||||
|
||||
Method response = getClass().getMethod("response", new Class[] { MyType.class });
|
||||
Method response = getClass().getMethod("response", MyType.class);
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, response);
|
||||
expect(unmarshallerMock.supports(MyType.class)).andReturn(true);
|
||||
expect(marshallerMock.supports(MyType.class)).andReturn(true);
|
||||
@@ -154,8 +154,7 @@ 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", String.class, String.class);
|
||||
|
||||
replay(marshallerMock, unmarshallerMock);
|
||||
|
||||
@@ -167,7 +166,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testUnsupportedMethodWrongParam() throws NoSuchMethodException {
|
||||
|
||||
Method unsupported = getClass().getMethod("unsupportedWrongParam", new Class[] { String.class });
|
||||
Method unsupported = getClass().getMethod("unsupportedWrongParam", String.class);
|
||||
expect(unmarshallerMock.supports(String.class)).andReturn(false);
|
||||
expect(marshallerMock.supports(String.class)).andReturn(true);
|
||||
|
||||
@@ -181,7 +180,7 @@ public class MarshallingMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testUnsupportedMethodWrongReturnType() throws NoSuchMethodException {
|
||||
|
||||
Method unsupported = getClass().getMethod("unsupportedWrongParam", new Class[] { String.class });
|
||||
Method unsupported = getClass().getMethod("unsupportedWrongParam", String.class);
|
||||
expect(marshallerMock.supports(String.class)).andReturn(false);
|
||||
|
||||
replay(marshallerMock, unmarshallerMock);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class MessageEndpointAdapterTest {
|
||||
private MessageEndpoint endpointMock;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
adapter = new MessageEndpointAdapter();
|
||||
endpointMock = createMock(MessageEndpoint.class);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MessageMethodEndpointAdapterTest {
|
||||
private MessageContext messageContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
adapter = new MessageMethodEndpointAdapter();
|
||||
messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());
|
||||
}
|
||||
@@ -44,30 +44,28 @@ public class MessageMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testSupported() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "supported", new Class[] { MessageContext.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "supported", MessageContext.class);
|
||||
assertThat(adapter.supportsInternal(methodEndpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException {
|
||||
|
||||
assertThat(adapter.supportsInternal(new MethodEndpoint(this, "unsupportedMultipleParams",
|
||||
new Class[] { MessageContext.class, MessageContext.class })))
|
||||
assertThat(adapter.supportsInternal(
|
||||
new MethodEndpoint(this, "unsupportedMultipleParams", 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", String.class))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvokeSupported() throws Exception {
|
||||
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "supported", new Class[] { MessageContext.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "supported", MessageContext.class);
|
||||
|
||||
assertThat(supportedInvoked).isFalse();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PayloadEndpointAdapterTest {
|
||||
private PayloadEndpoint endpointMock;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
adapter = new PayloadEndpointAdapter();
|
||||
endpointMock = createMock(PayloadEndpoint.class);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PayloadMethodEndpointAdapterTest {
|
||||
private MessageContext messageContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
adapter = new PayloadMethodEndpointAdapter();
|
||||
messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());
|
||||
@@ -53,45 +53,42 @@ public class PayloadMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testSupportedNoResponse() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "noResponse", new Class[] { DOMSource.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "noResponse", DOMSource.class);
|
||||
assertThat(adapter.supportsInternal(methodEndpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportedResponse() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", new Class[] { StreamSource.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", StreamSource.class);
|
||||
assertThat(adapter.supportsInternal(methodEndpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsupportedMethodMultipleParams() throws NoSuchMethodException {
|
||||
|
||||
assertThat(adapter.supportsInternal(
|
||||
new MethodEndpoint(this, "unsupportedMultipleParams", new Class[] { Source.class, Source.class })))
|
||||
assertThat(adapter
|
||||
.supportsInternal(new MethodEndpoint(this, "unsupportedMultipleParams", Source.class, Source.class)))
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsupportedMethodWrongReturnType() throws NoSuchMethodException {
|
||||
|
||||
assertThat(adapter
|
||||
.supportsInternal(new MethodEndpoint(this, "unsupportedWrongReturnType", new Class[] { Source.class })))
|
||||
assertThat(adapter.supportsInternal(new MethodEndpoint(this, "unsupportedWrongReturnType", 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", String.class))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoResponse() throws Exception {
|
||||
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "noResponse", new Class[] { DOMSource.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "noResponse", DOMSource.class);
|
||||
|
||||
assertThat(noResponseInvoked).isFalse();
|
||||
|
||||
@@ -105,7 +102,7 @@ public class PayloadMethodEndpointAdapterTest {
|
||||
|
||||
WebServiceMessage request = new MockWebServiceMessage("<request/>");
|
||||
messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", new Class[] { StreamSource.class });
|
||||
MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", StreamSource.class);
|
||||
|
||||
assertThat(responseInvoked).isFalse();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
|
||||
@Test
|
||||
public void testUnsupportedInvalidParam() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidParamType", new Class[] { Integer.TYPE });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidParamType", Integer.TYPE);
|
||||
|
||||
assertThat(adapter.supports(endpoint)).isFalse();
|
||||
}
|
||||
@@ -79,45 +79,43 @@ 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", String.class);
|
||||
assertThat(adapter.supports(endpoint)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsupportedInvalidParams() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidParams",
|
||||
new Class[] { String.class, String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "unsupportedInvalidParams", String.class, String.class);
|
||||
assertThat(adapter.supports(endpoint)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportedTypes() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedTypes",
|
||||
new Class[] { Boolean.TYPE, Double.TYPE, Node.class, NodeList.class, String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedTypes", Boolean.TYPE, Double.TYPE, Node.class,
|
||||
NodeList.class, String.class);
|
||||
assertThat(adapter.supports(endpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportsStringSource() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedStringSource", new Class[] { String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedStringSource", String.class);
|
||||
assertThat(adapter.supports(endpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportsSource() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedSource", new Class[] { String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedSource", String.class);
|
||||
assertThat(adapter.supports(endpoint)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupportsVoid() throws NoSuchMethodException {
|
||||
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedVoid", new Class[] { String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedVoid", String.class);
|
||||
assertThat(adapter.supports(endpoint)).isTrue();
|
||||
}
|
||||
|
||||
@@ -130,8 +128,8 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
|
||||
replay(messageMock, factoryMock);
|
||||
|
||||
MessageContext messageContext = new DefaultMessageContext(messageMock, factoryMock);
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedTypes",
|
||||
new Class[] { Boolean.TYPE, Double.TYPE, Node.class, NodeList.class, String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedTypes", Boolean.TYPE, Double.TYPE, Node.class,
|
||||
NodeList.class, String.class);
|
||||
adapter.invoke(messageContext, endpoint);
|
||||
|
||||
assertThat(supportedTypesInvoked).isTrue();
|
||||
@@ -151,7 +149,7 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
|
||||
replay(requestMock, responseMock, factoryMock);
|
||||
|
||||
MessageContext messageContext = new DefaultMessageContext(requestMock, factoryMock);
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedSource", new Class[] { String.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "supportedSource", String.class);
|
||||
adapter.invoke(messageContext, endpoint);
|
||||
|
||||
assertThat(supportedSourceInvoked).isTrue();
|
||||
@@ -185,13 +183,13 @@ public class XPathParamAnnotationMethodEndpointAdapterTest {
|
||||
|
||||
replay(requestMock, factoryMock);
|
||||
|
||||
Map<String, String> namespaces = new HashMap<String, String>();
|
||||
Map<String, String> namespaces = new HashMap<>();
|
||||
namespaces.put("root", rootNamespace);
|
||||
namespaces.put("child", childNamespace);
|
||||
adapter.setNamespaces(namespaces);
|
||||
|
||||
MessageContext messageContext = new DefaultMessageContext(requestMock, factoryMock);
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "namespaces", new Class[] { Node.class });
|
||||
MethodEndpoint endpoint = new MethodEndpoint(this, "namespaces", Node.class);
|
||||
adapter.invoke(messageContext, endpoint);
|
||||
|
||||
assertThat(namespacesInvoked).isTrue();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SourcePayloadMethodProcessorTest extends AbstractPayloadMethodProce
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getReturnValue(MethodParameter returnType) throws Exception {
|
||||
protected Object getReturnValue(MethodParameter returnType) {
|
||||
return new StringSource(XML);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class EndpointMappingTest {
|
||||
private MessageContext messageContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
messageContext = new DefaultMessageContext(new MockWebServiceMessageFactory());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class EndpointMappingTest {
|
||||
Object defaultEndpoint = new Object();
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) {
|
||||
assertThat(givenRequest).isEqualTo(messageContext);
|
||||
return null;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class EndpointMappingTest {
|
||||
final Object endpoint = new Object();
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) {
|
||||
assertThat(givenRequest).isEqualTo(messageContext);
|
||||
return endpoint;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class EndpointMappingTest {
|
||||
EndpointInterceptor interceptor = new EndpointInterceptorAdapter();
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) {
|
||||
assertThat(givenRequest).isEqualTo(messageContext);
|
||||
return endpoint;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class EndpointMappingTest {
|
||||
EndpointInterceptor interceptor = new EndpointInterceptorAdapter();
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext givenRequest) {
|
||||
assertThat(givenRequest).isEqualTo(messageContext);
|
||||
return endpoint;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class EndpointMappingTest {
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext message) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext message) {
|
||||
assertThat(message).isEqualTo(messageContext);
|
||||
return "endpoint";
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class EndpointMappingTest {
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext message) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext message) {
|
||||
assertThat(message).isEqualTo(messageContext);
|
||||
return "noSuchBean";
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class EndpointMappingTest {
|
||||
AbstractEndpointMapping mapping = new AbstractEndpointMapping() {
|
||||
|
||||
@Override
|
||||
protected Object getEndpointInternal(MessageContext message) throws Exception {
|
||||
protected Object getEndpointInternal(MessageContext message) {
|
||||
assertThat(message).isEqualTo(messageContext);
|
||||
return "endpoint";
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class MapBasedSoapEndpointMappingTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
|
||||
protected String getLookupKeyForMessage(MessageContext messageContext) {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,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.singletonList(mapping));
|
||||
messageDispatcher.setEndpointAdapters(Collections.singletonList(adapter));
|
||||
|
||||
messageDispatcher.receive(messageContext);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PayloadRootQNameEndpointMappingTest {
|
||||
private PayloadRootQNameEndpointMapping mapping;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
mapping = new PayloadRootQNameEndpointMapping();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UriEndpointMappingTest {
|
||||
private MessageContext context;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
|
||||
mapping = new UriEndpointMapping();
|
||||
context = new DefaultMessageContext(new MockWebServiceMessageFactory());
|
||||
|
||||
@@ -31,7 +31,7 @@ public class XPathPayloadEndpointMappingTest {
|
||||
private XPathPayloadEndpointMapping mapping;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
mapping = new XPathPayloadEndpointMapping();
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class XmlRootElementEndpointMappingTest {
|
||||
private XmlRootElementEndpointMapping mapping;
|
||||
|
||||
@BeforeEach
|
||||
public void createMapping() throws NoSuchMethodException {
|
||||
public void createMapping() {
|
||||
mapping = new XmlRootElementEndpointMapping();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,12 +109,10 @@ public abstract class AbstractSoapMessageTest extends AbstractMimeMessageTest {
|
||||
@Test
|
||||
public void testSetStreamingPayload() throws Exception {
|
||||
|
||||
if (!(soapMessage instanceof StreamingWebServiceMessage)) {
|
||||
if (!(soapMessage instanceof StreamingWebServiceMessage streamingMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
StreamingWebServiceMessage streamingMessage = (StreamingWebServiceMessage) soapMessage;
|
||||
|
||||
final QName name = new QName("http://springframework.org", "root", "");
|
||||
|
||||
streamingMessage.setStreamingPayload(new StreamingPayload() {
|
||||
@@ -146,7 +144,7 @@ public abstract class AbstractSoapMessageTest extends AbstractMimeMessageTest {
|
||||
protected abstract Resource[] getSoapSchemas();
|
||||
|
||||
@Test
|
||||
public abstract void testGetVersion() throws Exception;
|
||||
public abstract void testGetVersion();
|
||||
|
||||
@Test
|
||||
public abstract void testWriteToTransportOutputStream() throws Exception;
|
||||
|
||||
@@ -46,14 +46,10 @@ public abstract class AbstractWsAddressingTest {
|
||||
mimeHeaders.addHeader("Content-Type", " application/soap+xml");
|
||||
InputStream is = AbstractWsAddressingTest.class.getResourceAsStream(fileName);
|
||||
|
||||
assertThat(is).isNotNull();
|
||||
|
||||
try {
|
||||
try (is) {
|
||||
assertThat(is).isNotNull();
|
||||
return new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, is));
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected void assertXMLSimilar(SaajSoapMessage expected, SaajSoapMessage result) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user