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 2013/01/19 23:00:45 UTC

svn commit: r1435730 - 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/ axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/ axiom-testsuite...

Author: veithen
Date: Sat Jan 19 22:00:44 2013
New Revision: 1435730

URL: http://svn.apache.org/viewvc?rev=1435730&view=rev
Log:
Added a new test case for SOAPEnvelope#getHeader() and reviewed the Javadoc.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.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/SOAPEnvelope.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java?rev=1435730&r1=1435729&r2=1435730&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java Sat Jan 19 22:00:44 2013
@@ -26,15 +26,13 @@ import org.apache.axiom.om.OMNamespace;
 /** Interface SOAPEnvelope */
 public interface SOAPEnvelope extends OMElement {
     /**
-     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE> object. <P>
-     * This SOAPHeader will just be a container for all the headers in the <CODE>OMMessage</CODE>
-     * </P>
-     *
-     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there is none
-     * @throws org.apache.axiom.om.OMException
-     *          if there is a problem obtaining the <CODE>SOAPHeader</CODE> object
+     * Returns the {@link SOAPHeader} object for this envelope. This method takes advantage of the
+     * fact that the {@link SOAPHeader} must be the first child element (if it exists) to avoid
+     * building the {@link SOAPBody} if it is still incomplete.
+     * 
+     * @return the {@link SOAPHeader} object or <code>null</code> if there is none
      */
-    SOAPHeader getHeader() throws OMException;
+    SOAPHeader getHeader();
 
     /**
      * Returns the <CODE>SOAPBody</CODE> object associated with this <CODE>SOAPEnvelope</CODE>

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1435730&r1=1435729&r2=1435730&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Sat Jan 19 22:00:44 2013
@@ -62,18 +62,7 @@ public class SOAPEnvelopeImpl extends SO
         return ((SOAPFactory)factory).getSOAPVersion();
     }
 
-    /**
-     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE> object.
-     * <p/>
-     * This SOAPHeader will just be a container for all the headers in the <CODE>OMMessage</CODE>
-     * </P>
-     *
-     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there is none
-     * @throws org.apache.axiom.om.OMException
-     *                     if there is a problem obtaining the <CODE>SOAPHeader</CODE> object
-     * @throws OMException
-     */
-    public SOAPHeader getHeader() throws OMException {
+    public SOAPHeader getHeader() {
         // Header must be the first child
         OMElement header = getFirstElement();
         if (header == null || !(header instanceof SOAPHeader)) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1435730&r1=1435729&r2=1435730&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java Sat Jan 19 22:00:44 2013
@@ -78,15 +78,7 @@ public class SOAPEnvelopeImpl extends SO
         return ((SOAPFactory)factory).getSOAPVersion();
     }
 
-    /**
-     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE> object. <P>
-     * This SOAPHeader will just be a container for all the headers in the <CODE>OMMessage</CODE>
-     * </P>
-     *
-     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there is none
-     * @throws OMException if there is a problem obtaining the <CODE>SOAPHeader</CODE> object
-     */
-    public SOAPHeader getHeader() throws OMException {
+    public SOAPHeader getHeader() {
         // The soap header is the first element in the envelope.
         OMElement e = getFirstElement();
         if (e instanceof SOAPHeader) {

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=1435730&r1=1435729&r2=1435730&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 Sat Jan 19 22:00:44 2013
@@ -123,6 +123,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.envelope.TestGetBodyWithParser(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.envelope.TestGetHeader(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.envelope.TestGetHeaderWithParser(metaFactory, spec));
+        addTest(new org.apache.axiom.ts.soap.envelope.TestGetHeaderWithParserNoHeader(metaFactory, spec));
         for (int i=0; i<generalQNames.length; i++) {
             QName qname = generalQNames[i];
             addTest(new org.apache.axiom.ts.soap.envelope.TestGetSOAPBodyFirstElementLocalNameAndNS(metaFactory, spec, qname));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java?rev=1435730&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java Sat Jan 19 22:00:44 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.soap.envelope;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPEnvelope#getHeader()} on a message that has no header. In
+ * particular it tests that the call doesn't build the {@link SOAPBody}.
+ */
+public class TestGetHeaderWithParserNoHeader extends SOAPTestCase {
+    public TestGetHeaderWithParserNoHeader(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope envelope = getTestMessage(MESSAGE_WITHOUT_HEADER);
+        assertNull(envelope.getHeader());
+        assertFalse(envelope.getBody().isComplete());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetHeaderWithParserNoHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native