You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2014/05/31 20:19:54 UTC
svn commit: r1598893 - in /webservices/axiom/trunk/modules:
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/ ax...
Author: veithen
Date: Sat May 31 18:19:54 2014
New Revision: 1598893
URL: http://svn.apache.org/r1598893
Log:
* Increased SOAPFactory test coverage.
* Implemented some methods missing in the DOOM SOAPFactory implementations.
* Enabled DOOM tests that are working now.
Modified:
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java Sat May 31 18:19:54 2014
@@ -25,13 +25,7 @@ import org.apache.axiom.om.OMXMLParserWr
import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
-import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFaultNode;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultText;
-import org.apache.axiom.soap.SOAPFaultValue;
-import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.SOAPMessage;
import org.apache.axiom.soap.SOAPProcessingException;
@@ -66,30 +60,6 @@ public abstract class DOMSOAPFactory ext
return new SOAPMessageImpl(this);
}
- public SOAPHeader createSOAPHeader() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
- public SOAPBody createSOAPBody() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
- public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
- public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
- public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
- public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {
- throw new UnsupportedOperationException("TODO");
- }
-
public SOAPHeaderBlock createSOAPHeaderBlock(OMDataSource source) {
throw new UnsupportedOperationException("TODO");
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java Sat May 31 18:19:54 2014
@@ -76,6 +76,10 @@ public class SOAP11Factory extends DOMSO
return new SOAPEnvelopeImpl(null, ns, null, this, true);
}
+ public SOAPHeader createSOAPHeader() throws SOAPProcessingException {
+ return new SOAP11HeaderImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPHeader createSOAPHeader(SOAPEnvelope envelope)
throws SOAPProcessingException {
return new SOAP11HeaderImpl(envelope, this);
@@ -120,6 +124,10 @@ public class SOAP11Factory extends DOMSO
return new SOAP11FaultImpl((ParentNode)parent, null, builder, this, false);
}
+ public SOAPBody createSOAPBody() throws SOAPProcessingException {
+ return new SOAP11BodyImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPBody createSOAPBody(SOAPEnvelope envelope)
throws SOAPProcessingException {
return new SOAP11BodyImpl(envelope, (SOAPFactory) envelope
@@ -145,6 +153,10 @@ public class SOAP11Factory extends DOMSO
return new SOAP11FaultCodeImpl(null, null, null, this, true);
}
+ public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent)
throws SOAPProcessingException {
throw new UnsupportedOperationException();
@@ -156,6 +168,10 @@ public class SOAP11Factory extends DOMSO
throw new UnsupportedOperationException();
}
+ public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
//changed
public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent)
throws SOAPProcessingException {
@@ -181,11 +197,19 @@ public class SOAP11Factory extends DOMSO
return new SOAP11FaultReasonImpl(null, null, null, this, true);
}
+ public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent)
throws SOAPProcessingException {
throw new UnsupportedOperationException();
}
+ public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
public SOAPFaultNode createSOAPFaultNode(SOAPFault parent)
throws SOAPProcessingException {
throw new UnsupportedOperationException("SOAP 1.1 has no SOAP Fault Node");
Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java Sat May 31 18:19:54 2014
@@ -76,6 +76,10 @@ public class SOAP12Factory extends DOMSO
return new SOAPEnvelopeImpl(null, ns, null, this, true);
}
+ public SOAPHeader createSOAPHeader() throws SOAPProcessingException {
+ return new SOAP12HeaderImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
return new SOAP12HeaderImpl(envelope, this);
}
@@ -116,6 +120,10 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultImpl((ParentNode)parent, null, builder, this, false);
}
+ public SOAPBody createSOAPBody() throws SOAPProcessingException {
+ return new SOAP12BodyImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
return new SOAP12BodyImpl(envelope, this);
}
@@ -138,6 +146,10 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultCodeImpl(null, getNamespace(), null, this, true);
}
+ public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {
+ return new SOAP12FaultValueImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent)
throws SOAPProcessingException {
return new SOAP12FaultValueImpl(parent, this);
@@ -160,6 +172,10 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultValueImpl((ParentNode)parent, null, builder, this, false);
}
+ public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException {
+ return new SOAP12FaultSubCodeImpl(null, getNamespace(), null, this, true);
+ }
+
//changed
public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent)
throws SOAPProcessingException {
@@ -195,6 +211,10 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultReasonImpl(null, getNamespace(), null, this, true);
}
+ public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {
+ return new SOAP12FaultTextImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent)
throws SOAPProcessingException {
return new SOAP12FaultTextImpl(parent, this);
@@ -205,6 +225,10 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultTextImpl((ParentNode)parent, null, builder, this, false);
}
+ public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {
+ return new SOAP12FaultNodeImpl(null, getNamespace(), null, this, true);
+ }
+
public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
return new SOAP12FaultNodeImpl(parent, this);
}
Modified: webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java Sat May 31 18:19:54 2014
@@ -24,26 +24,10 @@ import junit.framework.TestSuite;
import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
import org.apache.axiom.ts.soap.SOAPTestSuiteBuilder;
import org.apache.axiom.ts.soap.envelope.TestSerialize;
-import org.apache.axiom.ts.soap.faultdetail.TestWSCommons202;
-import org.apache.axiom.ts.soap.faulttext.TestSetLang;
-import org.apache.axiom.ts.soap12.fault.TestMoreChildrenAddition;
-import org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQNameWithExistingValue;
public class SOAPImplementationTest extends TestCase {
public static TestSuite suite() {
SOAPTestSuiteBuilder builder = new SOAPTestSuiteBuilder(new OMDOMMetaFactory(), false, false);
- builder.exclude(TestWSCommons202.class);
-
- // TODO: not sure if this is an issue in DOOM or if the test case is wrong
- builder.exclude(TestMoreChildrenAddition.class);
-
- // SOAPFaultText is currently unsupported in DOOM
- builder.exclude(TestSetLang.class);
-
- // TODO: a couple of prerequisites for these tests are not implemented
- builder.exclude(org.apache.axiom.ts.soap11.faultcode.TestSetValueFromQName.class);
- builder.exclude(org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQName.class);
- builder.exclude(TestSetValueFromQNameWithExistingValue.class);
// TODO: AXIOM-430
builder.exclude(TestSerialize.class, "(&(file=*/empty-header.xml)(|(serializationStrategy=OutputStream)(serializationStrategy=Writer)(serializationStrategy=XMLStreamWriter)(serializationStrategy=SAXSource)))");
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java Sat May 31 18:19:54 2014
@@ -40,7 +40,7 @@ import org.apache.axiom.soap.SOAPVersion
*/
public abstract class SOAPSpec {
public static final SOAPSpec SOAP11 = new SOAPSpec(SOAP11Version.getSingleton(),
- new BooleanLiteral[] { BooleanLiteral.ONE, BooleanLiteral.ZERO }, null) {
+ new BooleanLiteral[] { BooleanLiteral.ONE, BooleanLiteral.ZERO }, null, null, null, null) {
public String getName() {
return "soap11";
}
@@ -64,7 +64,10 @@ public abstract class SOAPSpec {
public static final SOAPSpec SOAP12 = new SOAPSpec(SOAP12Version.getSingleton(),
new BooleanLiteral[] { BooleanLiteral.TRUE, BooleanLiteral.FALSE, BooleanLiteral.ONE, BooleanLiteral.ZERO },
- new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) {
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME),
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME),
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME),
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) {
public String getName() {
return "soap12";
}
@@ -89,13 +92,24 @@ public abstract class SOAPSpec {
private final SOAPVersion version;
private final BooleanLiteral[] booleanLiterals;
private final QName envelopeQName;
+ private final QName headerQName;
+ private final QName bodyQName;
+ private final QName faultValueQName;
+ private final QName faultSubCodeQName;
private final QName faultTextQName;
+ private final QName faultNodeQName;
- public SOAPSpec(SOAPVersion version, BooleanLiteral[] booleanLiterals, QName faultTextQName) {
+ public SOAPSpec(SOAPVersion version, BooleanLiteral[] booleanLiterals, QName faultValueQName,
+ QName faultSubCodeQName, QName faultTextQName, QName faultNodeQName) {
this.version = version;
this.booleanLiterals = booleanLiterals;
envelopeQName = new QName(getEnvelopeNamespaceURI(), SOAPConstants.SOAPENVELOPE_LOCAL_NAME);
+ headerQName = new QName(getEnvelopeNamespaceURI(), SOAPConstants.HEADER_LOCAL_NAME);
+ bodyQName = new QName(getEnvelopeNamespaceURI(), SOAPConstants.BODY_LOCAL_NAME);
+ this.faultValueQName = faultValueQName;
+ this.faultSubCodeQName = faultSubCodeQName;
this.faultTextQName = faultTextQName;
+ this.faultNodeQName = faultNodeQName;
}
public abstract String getName();
@@ -120,14 +134,38 @@ public abstract class SOAPSpec {
return envelopeQName;
}
+ public final QName getHeaderQName() {
+ return headerQName;
+ }
+
+ public final QName getBodyQName() {
+ return bodyQName;
+ }
+
public final QName getFaultCodeQName() {
return version.getFaultCodeQName();
}
+ public final QName getFaultValueQName() {
+ return faultValueQName;
+ }
+
+ public final QName getFaultSubCodeQName() {
+ return faultSubCodeQName;
+ }
+
public final QName getFaultReasonQName() {
return version.getFaultReasonQName();
}
+ public final QName getFaultTextQName() {
+ return faultTextQName;
+ }
+
+ public final QName getFaultNodeQName() {
+ return faultNodeQName;
+ }
+
public final QName getFaultRoleQName() {
return version.getFaultRoleQName();
}
@@ -136,10 +174,6 @@ public abstract class SOAPSpec {
return version.getFaultDetailQName();
}
- public final QName getFaultTextQName() {
- return faultTextQName;
- }
-
/**
* Get the boolean literals recognized by this SOAP version. While SOAP 1.2 refers to the
* <tt>xs:boolean</tt> type and therefore recognizes <tt>true</tt>, <tt>false</tt>, <tt>1</tt>
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Sat May 31 18:19:54 2014
@@ -64,8 +64,14 @@ public class SOAPTestSuiteBuilder extend
private static final SOAPElementType[] soapElementTypes = {
SOAPElementType.ENVELOPE,
+ SOAPElementType.HEADER,
+ SOAPElementType.BODY,
SOAPFaultChild.CODE,
+ SOAPElementType.VALUE,
+ SOAPElementType.SUB_CODE,
SOAPFaultChild.REASON,
+ SOAPElementType.TEXT,
+ SOAPFaultChild.NODE,
SOAPFaultChild.ROLE,
SOAPFaultChild.DETAIL,
};
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java Sat May 31 18:19:54 2014
@@ -21,8 +21,13 @@ package org.apache.axiom.ts.soap.factory
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.testutils.suite.Dimension;
import org.apache.axiom.testutils.suite.MatrixTestCase;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -46,7 +51,107 @@ public interface SOAPElementType extends
}
};
+ SOAPElementType HEADER = new SOAPElementType() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPHeader");
+ }
+
+ public Class getType() {
+ return SOAPHeader.class;
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getHeaderQName();
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPHeader();
+ }
+ };
+
+ SOAPElementType BODY = new SOAPElementType() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPBody");
+ }
+
+ public Class getType() {
+ return SOAPBody.class;
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getBodyQName();
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPBody();
+ }
+ };
+
+ SOAPElementType VALUE = new SOAPElementType() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPFaultValue");
+ }
+
+ public Class getType() {
+ return SOAPFaultValue.class;
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getFaultValueQName();
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultValue();
+ }
+ };
+
+ SOAPElementType SUB_CODE = new SOAPElementType() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPFaultSubCode");
+ }
+
+ public Class getType() {
+ return SOAPFaultSubCode.class;
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getFaultSubCodeQName();
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultSubCode();
+ }
+ };
+
+ SOAPElementType TEXT = new SOAPElementType() {
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPFaultText");
+ }
+
+ public Class getType() {
+ return SOAPFaultText.class;
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getFaultTextQName();
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultText();
+ }
+ };
+
Class getType();
+
+ /**
+ * Get the qualified name for this element type in the given SOAP version.
+ *
+ * @param spec
+ * the SOAP version
+ * @return the element name, or <code>null</code> if the element type doesn't exist in the given
+ * SOAP version
+ */
QName getQName(SOAPSpec spec);
+
OMElement create(SOAPFactory factory);
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java Sat May 31 18:19:54 2014
@@ -25,6 +25,7 @@ import org.apache.axiom.soap.SOAPFactory
import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPFaultRole;
import org.apache.axiom.testutils.suite.MatrixTestCase;
@@ -91,6 +92,36 @@ public interface SOAPFaultChild extends
}
};
+ SOAPFaultChild NODE = new SOAPFaultChild() {
+ public Class getType() {
+ return SOAPFaultNode.class;
+ }
+
+ public void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", "SOAPFaultNode");
+ }
+
+ public QName getQName(SOAPSpec spec) {
+ return spec.getFaultNodeQName();
+ }
+
+ public int getOrder() {
+ return 3;
+ }
+
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultNode();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultNode(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setNode((SOAPFaultNode)element);
+ }
+ };
+
SOAPFaultChild ROLE = new SOAPFaultChild() {
public Class getType() {
return SOAPFaultRole.class;
@@ -105,7 +136,7 @@ public interface SOAPFaultChild extends
}
public int getOrder() {
- return 3;
+ return 4;
}
public OMElement create(SOAPFactory factory) {
@@ -135,7 +166,7 @@ public interface SOAPFaultChild extends
}
public int getOrder() {
- return 4;
+ return 5;
}
public OMElement create(SOAPFactory factory) {
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java?rev=1598893&r1=1598892&r2=1598893&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java Sat May 31 18:19:54 2014
@@ -32,8 +32,9 @@ import org.apache.axiom.ts.soap.SOAPTest
/**
* Tests {@link SOAPFactory#createSOAPEnvelope()}, {@link SOAPFactory#createSOAPFaultCode()},
- * {@link SOAPFactory#createSOAPFaultReason()}, {@link SOAPFactory#createSOAPFaultRole()} and
- * {@link SOAPFactory#createSOAPFaultDetail()}.
+ * {@link SOAPFactory#createSOAPFaultValue()}, {@link SOAPFactory#createSOAPFaultSubCode()},
+ * {@link SOAPFactory#createSOAPFaultReason()}, {@link SOAPFactory#createSOAPFaultText()},
+ * {@link SOAPFactory#createSOAPFaultRole()} and {@link SOAPFactory#createSOAPFaultDetail()}.
*/
public class TestCreateSOAPElement extends SOAPTestCase {
private final SOAPElementType type;
@@ -46,21 +47,30 @@ public class TestCreateSOAPElement exten
protected void runTest() throws Throwable {
QName expectedName = type.getQName(spec);
- String expectedPrefix = expectedName.getNamespaceURI().length() == 0 ? "" : SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX;
- OMElement child = type.create(soapFactory);
- QName actualName = child.getQName();
- assertEquals(expectedName, actualName);
- assertEquals(expectedPrefix, actualName.getPrefix());
- assertNull(child.getParent());
- Iterator it = child.getAllDeclaredNamespaces();
- if (expectedPrefix.length() != 0) {
- assertTrue(it.hasNext());
- OMNamespace ns = (OMNamespace)it.next();
- assertEquals(expectedName.getNamespaceURI(), ns.getNamespaceURI());
- assertEquals(expectedPrefix, ns.getPrefix());
+ if (expectedName == null) {
+ try {
+ type.create(soapFactory);
+ fail("Expect UnsupportedOperationException");
+ } catch (UnsupportedOperationException ex) {
+ // Expected
+ }
+ } else {
+ String expectedPrefix = expectedName.getNamespaceURI().length() == 0 ? "" : SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX;
+ OMElement child = type.create(soapFactory);
+ QName actualName = child.getQName();
+ assertEquals(expectedName, actualName);
+ assertEquals(expectedPrefix, actualName.getPrefix());
+ assertNull(child.getParent());
+ Iterator it = child.getAllDeclaredNamespaces();
+ if (expectedPrefix.length() != 0) {
+ assertTrue(it.hasNext());
+ OMNamespace ns = (OMNamespace)it.next();
+ assertEquals(expectedName.getNamespaceURI(), ns.getNamespaceURI());
+ assertEquals(expectedPrefix, ns.getPrefix());
+ }
+ assertFalse(it.hasNext());
+ assertFalse(child.getAllAttributes().hasNext());
+ assertNull(child.getFirstOMChild());
}
- assertFalse(it.hasNext());
- assertFalse(child.getAllAttributes().hasNext());
- assertNull(child.getFirstOMChild());
}
}