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 2012/08/24 20:08:11 UTC

svn commit: r1377017 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/soap/ axiom-api/src/test/java/org/apache/axiom/soap/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-dom/src/main/java/or...

Author: veithen
Date: Fri Aug 24 18:08:10 2012
New Revision: 1377017

URL: http://svn.apache.org/viewvc?rev=1377017&view=rev
Log:
* AXIOM-311: Refactored the unit tests for SOAPFaultCode#getValue() for SOAP 1.1.
* Improved the Javadoc of SOAPFaultCode#getValue().
* Streamlined the DOOM implementation of SOAPFaultCode#getValue().

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.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-api/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestBase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.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/soap12/SOAP12FaultCodeImpl.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-testsuite/src/main/java/org/apache/axiom/ts/soap/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=1377017&r1=1377016&r2=1377017&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 Fri Aug 24 18:08:10 2012
@@ -37,7 +37,13 @@ public interface SOAPFaultClassifier ext
      */
     void setValue(SOAPFaultValue value) throws SOAPProcessingException;
 
-    /** @return Returns SOAPFaultValue. */
+    /**
+     * Get the {@link SOAPFaultValue} for this fault code or subcode. Note that for SOAP 1.1, the
+     * return value will always be <code>null</code>.
+     * 
+     * @return the {@link SOAPFaultValue} object or <code>null</code> if there is no
+     *         {@link SOAPFaultValue}
+     */
     SOAPFaultValue getValue();
 
     /**

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestBase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestBase.java?rev=1377017&r1=1377016&r2=1377017&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestBase.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestBase.java Fri Aug 24 18:08:10 2012
@@ -45,18 +45,6 @@ public class SOAPFaultCodeTestBase exten
 //
 //    }
 
-    public void testSOAP11GetValue() {
-        assertNull(soap11FaultCode.getValue());
-//        assertTrue(
-//                "SOAP 1.1 Fault Code Test :- After creating soapfaultcode, it has a value",
-//                soap11FaultCode.getValue() == null);
-//        soap11FaultCode.setValue(
-//                soap11Factory.createSOAPFaultValue(soap11FaultCode));
-//        assertFalse(
-//                "SOAP 1.1 Fault Code Test :- After calling setValue method, getValue method returns null",
-//                soap11FaultCode.getValue() == null);
-    }
-
     //SOAP 1.2 Fault Code Test (Programaticaly Created)
     public void testSOAP12SetValue() {
         soap12FaultCode.setValue(
@@ -130,9 +118,4 @@ public class SOAPFaultCodeTestBase exten
                 "SOAP 1.2 Fault Code Test :- After calling setSubCode method, getSubCode method returns null",
                 soap12FaultCode.getSubCode() == null);
     }
-
-    //SOAP 1.1 Fault Code Test (With Parser)
-    public void testSOAP11GetValueWithParser() {
-        assertNull(soap11FaultCodeWithParser.getValue());
-    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java?rev=1377017&r1=1377016&r2=1377017&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java Fri Aug 24 18:08:10 2012
@@ -51,10 +51,6 @@ public abstract class SOAPFaultCodeImpl 
         ElementHelper.setNewElement(this, value, value);
     }
 
-    public SOAPFaultValue getValue() {
-        return (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
-    }
-
     public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
         ElementHelper.setNewElement(this, getSubCode(), value);
     }

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=1377017&r1=1377016&r2=1377017&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 Fri Aug 24 18:08:10 2012
@@ -105,6 +105,10 @@ public class SOAP11FaultCodeImpl extends
         return SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME;
     }
 
+    public SOAPFaultValue getValue() {
+        return null;
+    }
+
     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/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=1377017&r1=1377016&r2=1377017&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 Fri Aug 24 18:08:10 2012
@@ -25,6 +25,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPFault;
 import org.apache.axiom.soap.SOAPFaultSubCode;
@@ -80,6 +81,10 @@ public class SOAP12FaultCodeImpl extends
         }
     }
 
+    public SOAPFaultValue getValue() {
+        return (SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
+    }
+
     public void setValue(QName value) {
         SOAPFaultValue valueElement = getValue();
         if (valueElement == null) {

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=1377017&r1=1377016&r2=1377017&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 Fri Aug 24 18:08:10 2012
@@ -91,7 +91,6 @@ public class SOAP11FaultCodeImpl extends
 
     public SOAPFaultValue getValue() {
         return null;
-//        throw new UnsupportedOperationException("getValue() not supported for SOAP 1.1 faults");
     }
 
     public SOAPFaultSubCode getSubCode() {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1377017&r1=1377016&r2=1377017&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Fri Aug 24 18:08:10 2012
@@ -224,6 +224,8 @@ 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.TestGetValue(metaFactory));
+        addTest(new org.apache.axiom.ts.soap11.faultcode.TestGetValueWithParser(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));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java?rev=1377017&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java Fri Aug 24 18:08:10 2012
@@ -0,0 +1,47 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+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 that {@link SOAPFaultClassifier#getValue()} returns <code>null</code> when invoked on a
+ * SOAP 1.1 {@link SOAPFaultCode}.
+ */
+public class TestGetValue extends SOAPTestCase {
+    public TestGetValue(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSpec.SOAP11);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+        SOAPFault fault = soapFactory.createSOAPFault(env.getBody());
+        SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
+        code.setText(new QName("urn:test", "test"));
+        assertNull(code.getValue());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.java?rev=1377017&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.java Fri Aug 24 18:08:10 2012
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetValueWithParser extends SOAPTestCase {
+    public TestGetValueWithParser(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSpec.SOAP11);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPFaultCode code = getTestMessage(MESSAGE).getBody().getFault().getCode();
+        assertNull(code.getValue());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultcode/TestGetValueWithParser.java
------------------------------------------------------------------------------
    svn:eol-style = native