Skip to content

Commit

Permalink
SWS-922 Upgrade to Axiom 1.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
gregturn committed Dec 15, 2015
1 parent 1aafa53 commit 6907b50
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 38 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ configure(allprojects) {

ext.springVersion = "4.0.9.RELEASE"
ext.springSecurityVersion = "3.2.7.RELEASE"
ext.axiomVersion = "1.2.14"
ext.axiomVersion = "1.2.15"

apply plugin: "java"

Expand Down Expand Up @@ -59,6 +59,7 @@ configure(allprojects) {
testCompile("junit:junit:4.10")
testCompile("org.easymock:easymock:3.1")
testCompile("xmlunit:xmlunit:1.5")
testCompile("com.sun.mail:javax.mail:1.5.4")
testRuntime("org.codehaus.woodstox:woodstox-core-asl:4.2.0")
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Tue Dec 15 09:56:17 CST 2015
#Tue Dec 15 10:03:30 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String
XMLStreamReader reader = inputFactory.createXMLStreamReader(inputStream, getCharSetEncoding(contentType));
String envelopeNamespace = getSoapEnvelopeNamespace(contentType);
StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapFactory, envelopeNamespace);
SOAPMessage soapMessage = builder.getSoapMessage();
SOAPMessage soapMessage = builder.getSOAPMessage();
return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching, langAttributeOnSoap11FaultString);
}

Expand All @@ -297,7 +297,7 @@ else if (MTOMConstants.MTOM_TYPE.equals(attachments.getAttachmentSpecType())) {
throw new AxiomSoapMessageCreationException(
"Unknown attachment type: [" + attachments.getAttachmentSpecType() + "]");
}
return new AxiomSoapMessage(builder.getSoapMessage(), attachments, soapAction, payloadCaching,
return new AxiomSoapMessage(builder.getSOAPMessage(), attachments, soapAction, payloadCaching,
langAttributeOnSoap11FaultString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;

import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -42,6 +40,11 @@
import org.springframework.ws.soap.axiom.AxiomSoapMessageFactory;
import org.springframework.xml.transform.StringResult;

import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class JaxbElementPayloadMethodProcessorTest {

private JaxbElementPayloadMethodProcessor processor;
Expand Down Expand Up @@ -141,7 +144,7 @@ public void handleReturnValueAxiom() throws Exception {
response.writeTo(bos);
String messageResult = bos.toString("UTF-8");

assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body>" +
assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header/><soapenv:Body>" +
"<type xmlns='http://springframework.org'><string>Foo</string></type>" +
"</soapenv:Body></soapenv:Envelope>", messageResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;

import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.ContentHandler;
Expand All @@ -52,6 +50,11 @@
import org.springframework.xml.sax.AbstractXmlReader;
import org.springframework.xml.transform.StringResult;

import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class XmlRootElementPayloadMethodProcessorTest {

private XmlRootElementPayloadMethodProcessor processor;
Expand Down Expand Up @@ -207,7 +210,7 @@ public void handleReturnValueAxiom() throws Exception {
response.writeTo(bos);
String messageResult = bos.toString("UTF-8");

assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body>" +
assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header/><soapenv:Body>" +
"<root xmlns='http://springframework.org'><string>Foo</string></root>" +
"</soapenv:Body></soapenv:Envelope>", messageResult);

Expand All @@ -230,7 +233,7 @@ public void handleReturnValueAxiomNoPayloadCaching() throws Exception {
response.writeTo(bos);
String messageResult = bos.toString("UTF-8");

assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body>" +
assertXMLEqual("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header/><soapenv:Body>" +
"<root xmlns='http://springframework.org'><string>Foo</string></root>" +
"</soapenv:Body></soapenv:Envelope>", messageResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import org.junit.Test;
import org.xml.sax.SAXParseException;

import org.springframework.core.io.Resource;
import org.springframework.util.StringUtils;
import org.springframework.ws.mime.AbstractMimeMessageTestCase;
Expand All @@ -36,14 +39,19 @@
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.validation.XmlValidatorFactory;

import org.junit.Test;
import org.xml.sax.SAXParseException;

import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.*;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public abstract class AbstractSoapMessageTestCase extends AbstractMimeMessageTestCase {

protected abstract String getNS();

protected String getHeader() {
return "<" + getNS() + ":Header/>";
}

protected SoapMessage soapMessage;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

public class AxiomSoap11MessageTest extends AbstractSoap11MessageTestCase {

@Override
protected String getNS() {
return "soapenv";
}

@Override
protected SoapMessage createSoapMessage() throws Exception {
SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@
package org.springframework.ws.soap.axiom;

import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
import static org.junit.Assert.*;

import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.soap11.AbstractSoap11MessageTestCase;

import static org.junit.Assert.*;

public class AxiomSoap11NonCachingMessageTest extends AbstractSoap11MessageTestCase {

@Override
protected String getNS() {
return "soapenv";
}

@Override
protected SoapMessage createSoapMessage() throws Exception {
AxiomSoapMessageFactory messageFactory = new AxiomSoapMessageFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

public class AxiomSoap12MessageTest extends AbstractSoap12MessageTestCase {

@Override
protected String getNS() {
return "soapenv";
}

@Override
protected SoapMessage createSoapMessage() throws Exception {
SOAPFactory axiomFactory = OMAbstractFactory.getSOAP12Factory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@

package org.springframework.ws.soap.axiom;

import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;

import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.soap12.AbstractSoap12MessageTestCase;

import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;

import static org.junit.Assert.*;

public class AxiomSoap12NonCachingMessageTest extends AbstractSoap12MessageTestCase {

@Override
protected String getNS() {
return "soapenv";
}

@Override
protected SoapMessage createSoapMessage() throws Exception {
AxiomSoapMessageFactory messageFactory = new AxiomSoapMessageFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,31 @@
import javax.xml.transform.Result;
import javax.xml.transform.Source;

import org.junit.Test;

import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.soap11.AbstractSoap11MessageTestCase;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;

import org.junit.Test;

import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class SaajSoap11MessageTest extends AbstractSoap11MessageTestCase {

private SOAPMessage saajMessage;

@Override
protected String getNS() {
return "SOAP-ENV";
}

@Override
protected String getHeader() {
return "";
}

@Override
protected final SoapMessage createSoapMessage() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@

public class SaajSoap12MessageTest extends AbstractSoap12MessageTestCase {

@Override
protected String getNS() {
return "env";
}

@Override
protected String getHeader() {
return "";
}

private SOAPMessage saajMessage;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;

import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -55,6 +54,8 @@
import org.springframework.xml.validation.ValidationErrorHandler;
import org.springframework.xml.xsd.SimpleXsdSchema;

import static org.custommonkey.xmlunit.XMLAssert.*;

public class PayloadValidatingInterceptorTest {

private PayloadValidatingInterceptor interceptor;
Expand Down Expand Up @@ -302,7 +303,7 @@ public void testCreateRequestValidationFaultAxiom() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
messageContext.getResponse().writeTo(os);
assertXMLEqual(
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Body>" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Header/>" + "<soapenv:Body>" +
"<soapenv:Fault>" + "<faultcode>soapenv:Client</faultcode>" +
"<faultstring xml:lang='en'>Validation error</faultstring>" + "<detail>" +
"<spring-ws:ValidationError xmlns:spring-ws=\"http://springframework.org/spring-ws\">Message 1</spring-ws:ValidationError>" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import javax.xml.transform.stream.StreamSource;

import junit.framework.Assert;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

Expand All @@ -39,6 +37,11 @@
import org.springframework.ws.transport.MockTransportOutputStream;
import org.springframework.xml.transform.StringSource;

import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public abstract class AbstractSoap11MessageTestCase extends AbstractSoapMessageTestCase {

@Override
Expand All @@ -64,7 +67,7 @@ public void testWriteToTransportOutputStream() throws Exception {
soapMessage.writeTo(tos);
String result = bos.toString("UTF-8");
assertXMLEqual(
"<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Body><payload xmlns='http://www.springframework.org' /></Body></Envelope>",
"<" + getNS() + ":Envelope xmlns:" + getNS() + "='http://schemas.xmlsoap.org/soap/envelope/'>" + getHeader() + "<" + getNS() + ":Body><payload xmlns='http://www.springframework.org' /></" + getNS() + ":Body></" + getNS() + ":Envelope>",
result);
String contentType = tos.getHeaders().get("Content-Type");
assertTrue("Invalid Content-Type set", contentType.indexOf(SoapVersion.SOAP_11.getContentType()) != -1);
Expand Down Expand Up @@ -99,6 +102,12 @@ public void testToDocument() throws Exception {
Document expected = documentBuilder.newDocument();
Element envelope = expected.createElementNS("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
expected.appendChild(envelope);

if (!getHeader().isEmpty()) {
Element header = expected.createElementNS("http://schemas.xmlsoap.org/soap/envelope/", "Header");
envelope.appendChild(header);
}

Element body = expected.createElementNS("http://schemas.xmlsoap.org/soap/envelope/", "Body");
envelope.appendChild(body);
Element payload = expected.createElementNS("http://www.springframework.org", "payload");
Expand All @@ -123,7 +132,7 @@ public void testSetLiveDocument() throws Exception {

String result = bos.toString("UTF-8");
assertXMLEqual(
"<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Body><payload xmlns='http://www.springframework.org' /></Body></Envelope>",
"<" + getNS() + ":Envelope xmlns:" + getNS() + "='http://schemas.xmlsoap.org/soap/envelope/'>" + getHeader() + "<" + getNS() + ":Body><payload xmlns='http://www.springframework.org' /></" + getNS() + ":Body></" + getNS() + ":Envelope>",
result);
}

Expand All @@ -148,7 +157,7 @@ public void testSetOtherDocument() throws Exception {

String result = bos.toString("UTF-8");
assertXMLEqual(
"<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Body><payload xmlns='http://www.springframework.org' /></Body></Envelope>",
"<" + getNS() + ":Envelope xmlns:" + getNS() + "='http://schemas.xmlsoap.org/soap/envelope/'>" + getHeader() + "<" + getNS() + ":Body><payload xmlns='http://www.springframework.org' /></" + getNS() + ":Body></" + getNS() + ":Envelope>",
result);
}

Expand Down
Loading

0 comments on commit 6907b50

Please sign in to comment.