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 2011/10/23 19:58:32 UTC
svn commit: r1187942 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/soap/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/ axi...
Author: veithen
Date: Sun Oct 23 17:58:32 2011
New Revision: 1187942
URL: http://svn.apache.org/viewvc?rev=1187942&view=rev
Log:
Added a SOAP version independent method to set the fault code value as a QName.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultClassifier.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPImplementationTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultClassifier.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultClassifier.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultClassifier.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultClassifier.java Sun Oct 23 17:58:32 2011
@@ -19,6 +19,8 @@
package org.apache.axiom.soap;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
/**
@@ -39,6 +41,19 @@ public interface SOAPFaultClassifier ext
SOAPFaultValue getValue();
/**
+ * Set the value of this fault code or subcode. The effect of this method depends on the SOAP
+ * version. For SOAP 1.1, the method sets the text content of the {@link SOAPFaultCode} element.
+ * For SOAP 1.2, the method ensures that the {@link SOAPFaultCode} or {@link SOAPFaultSubCode}
+ * element has a child of type {@link SOAPFaultValue} child (creating one if necessary) and sets
+ * the text content of that child. In both cases, the method adds an appropriate namespace
+ * declaration if necessary.
+ *
+ * @param value
+ * the QName for the fault code or subcode value
+ */
+ void setValue(QName value);
+
+ /**
* Fault SubCode can contain an optional SubCode
*
* @param subCode
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -31,6 +31,7 @@ import org.apache.axiom.soap.SOAPFaultVa
import org.apache.axiom.soap.SOAPProcessingException;
import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -105,4 +106,8 @@ public class SOAP11FaultCodeImpl extends
public String getLocalName() {
return SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME;
}
+
+ public void setValue(QName value) {
+ setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.dom.soap11;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -87,5 +89,8 @@ public class SOAP11FaultSubCodeImpl exte
super.setValue(soapFaultSubCodeValue);
}
-
+ public void setValue(QName value) {
+ // TODO: AXIOM-394: SOAPFaultSubCode should not exist for SOAP 1.1
+ throw new UnsupportedOperationException();
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -81,4 +81,12 @@ public class SOAP12FaultCodeImpl extends
"the parent. But received some other implementation");
}
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.dom.soap12;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -84,4 +86,12 @@ public class SOAP12FaultSubCodeImpl exte
}
super.setValue(soapFaultSubCodeValue);
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPImplementationTest.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPImplementationTest.java Sun Oct 23 17:58:32 2011
@@ -27,6 +27,7 @@ import org.apache.axiom.ts.soap.factory.
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() {
@@ -40,6 +41,11 @@ public class SOAPImplementationTest exte
// 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);
+
return builder.build();
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java Sun Oct 23 17:58:32 2011
@@ -787,10 +787,6 @@ public class OMElementImpl extends OMNod
getOMFactory().createOMText(this, text);
}
- /**
- * Sets the text, as a QName, of the given element. caution - This method will wipe out all the
- * text elements (and hence any mixed content) before setting the text.
- */
public void setText(QName text) {
OMNode child = this.getFirstOMChild();
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -30,6 +30,7 @@ import org.apache.axiom.soap.SOAPFaultVa
import org.apache.axiom.soap.SOAPProcessingException;
import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
@@ -97,4 +98,8 @@ public class SOAP11FaultCodeImpl extends
return null;
// throw new UnsupportedOperationException("getSubCode() not supported for SOAP 1.1 faults");
}
+
+ public void setValue(QName value) {
+ setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.llom.soap11;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -88,4 +90,9 @@ public class SOAP11FaultSubCodeImpl exte
}
super.setValue(soapFaultSubCodeValue);
}
+
+ public void setValue(QName value) {
+ // TODO: AXIOM-394: SOAPFaultSubCode should not exist for SOAP 1.1
+ throw new UnsupportedOperationException();
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -88,4 +88,12 @@ public class SOAP12FaultCodeImpl extends
public SOAPFaultSubCode getSubCode() {
return (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java Sun Oct 23 17:58:32 2011
@@ -19,6 +19,8 @@
package org.apache.axiom.soap.impl.llom.soap12;
+import javax.xml.namespace.QName;
+
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAP12Constants;
@@ -86,4 +88,12 @@ public class SOAP12FaultSubCodeImpl exte
}
super.setValue(soapFaultSubCodeValue);
}
+
+ public void setValue(QName value) {
+ SOAPFaultValue valueElement = getValue();
+ if (valueElement == null) {
+ valueElement = ((SOAPFactory)getOMFactory()).createSOAPFaultValue(this);
+ }
+ valueElement.setText(value);
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java?rev=1187942&r1=1187941&r2=1187942&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java Sun Oct 23 17:58:32 2011
@@ -102,6 +102,7 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap11.envelope.TestAddElementAfterBody(metaFactory));
addTest(new org.apache.axiom.ts.soap11.fault.TestGetNode(metaFactory));
addTest(new org.apache.axiom.ts.soap11.fault.TestSetNode(metaFactory));
+ addTest(new org.apache.axiom.ts.soap11.faultcode.TestSetValueFromQName(metaFactory));
addTest(new org.apache.axiom.ts.soap11.faultreason.TestAddSOAPText(metaFactory));
addTest(new org.apache.axiom.ts.soap11.faultreason.TestGetFirstSOAPText(metaFactory));
addTest(new org.apache.axiom.ts.soap11.header.TestExamineAllHeaderBlocksWithParser(metaFactory));
@@ -121,6 +122,8 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap12.faultcode.TestGetSubCodeWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.faultcode.TestGetTextAsQNameWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.faultcode.TestGetValueWithParser(metaFactory));
+ addTest(new org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQName(metaFactory));
+ addTest(new org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQNameWithExistingValue(metaFactory));
addTest(new org.apache.axiom.ts.soap12.faultreason.TestAddSOAPText(metaFactory));
addTest(new org.apache.axiom.ts.soap12.faultreason.TestAddSOAPTextWithSOAPVersionMismatch(metaFactory));
addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFirstSOAPText(metaFactory));
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java?rev=1187942&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java Sun Oct 23 17:58:32 2011
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap11.faultcode;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFaultClassifier;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPFaultClassifier#setValue(QName)} when invoked on a SOAP 1.1
+ * {@link SOAPFaultCode}.
+ */
+public class TestSetValueFromQName extends SOAPTestCase {
+ public TestSetValueFromQName(OMMetaFactory metaFactory) {
+ super(metaFactory, SOAPSpec.SOAP11);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPFaultCode code = soapFactory.getDefaultFaultEnvelope().getBody().getFault().getCode();
+ code.setValue(new QName("urn:test", "MyFaultCode", "p"));
+ assertEquals("p:MyFaultCode", code.getText());
+ Iterator it = code.getAllDeclaredNamespaces();
+ assertTrue(it.hasNext());
+ OMNamespace ns = (OMNamespace)it.next();
+ assertEquals("p", ns.getPrefix());
+ assertEquals("urn:test", ns.getNamespaceURI());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestSetValueFromQName.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java?rev=1187942&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java Sun Oct 23 17:58:32 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap12.faultcode;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFaultClassifier;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPFaultClassifier#setValue(QName)} when invoked on an empty SOAP
+ * 1.2 {@link SOAPFaultCode}.
+ */
+public class TestSetValueFromQName extends SOAPTestCase {
+ public TestSetValueFromQName(OMMetaFactory metaFactory) {
+ super(metaFactory, SOAPSpec.SOAP12);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPFaultCode code = soapFactory.createSOAPFaultCode();
+ code.setValue(new QName("urn:test", "MyFaultCode", "p"));
+ SOAPFaultValue value = code.getValue();
+ assertNotNull(value);
+ assertEquals("p:MyFaultCode", value.getText());
+ Iterator it = value.getAllDeclaredNamespaces();
+ assertTrue(it.hasNext());
+ OMNamespace ns = (OMNamespace)it.next();
+ assertEquals("p", ns.getPrefix());
+ assertEquals("urn:test", ns.getNamespaceURI());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQName.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java?rev=1187942&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java Sun Oct 23 17:58:32 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap12.faultcode;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFaultClassifier;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPFaultClassifier#setValue(QName)} when invoked on a SOAP 1.2
+ * {@link SOAPFaultCode} that already has a {@link SOAPFaultValue} child.
+ */
+public class TestSetValueFromQNameWithExistingValue extends SOAPTestCase {
+ public TestSetValueFromQNameWithExistingValue(OMMetaFactory metaFactory) {
+ super(metaFactory, SOAPSpec.SOAP12);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPFaultCode code = soapFactory.getDefaultFaultEnvelope().getBody().getFault().getCode();
+ SOAPFaultValue value = code.getValue();
+ assertNotNull(value);
+ code.setValue(new QName("urn:test", "MyFaultCode", "p"));
+ assertEquals("p:MyFaultCode", value.getText());
+ Iterator it = value.getAllDeclaredNamespaces();
+ assertTrue(it.hasNext());
+ OMNamespace ns = (OMNamespace)it.next();
+ assertEquals("p", ns.getPrefix());
+ assertEquals("urn:test", ns.getNamespaceURI());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultcode/TestSetValueFromQNameWithExistingValue.java
------------------------------------------------------------------------------
svn:eol-style = native