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/06/22 22:40:55 UTC

svn commit: r1138624 - in /webservices/commons/trunk/modules/axiom/modules: axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/ axiom-testsuite/src/main/java/org/apache/axiom/ts/ axiom-testsui...

Author: veithen
Date: Wed Jun 22 20:40:54 2011
New Revision: 1138624

URL: http://svn.apache.org/viewvc?rev=1138624&view=rev
Log:
Fixed an incorrect iterator usage reported by Ivan (xuhaihong).

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExtractAllHeaderBlocks.java   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPImplementationTest.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-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java?rev=1138624&r1=1138623&r2=1138624&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java Wed Jun 22 20:40:54 2011
@@ -222,7 +222,9 @@ public abstract class SOAPHeaderImpl ext
     public Iterator extractAllHeaderBlocks() {
         Collection result = new ArrayList();
         for (Iterator iter = getChildrenWithName(null); iter.hasNext();) {
-            result.add(((ElementImpl) iter.next()).detach());
+            ElementImpl headerBlock = (ElementImpl) iter.next();
+            iter.remove();
+            result.add(headerBlock);
         }
         return result.iterator();
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPImplementationTest.java?rev=1138624&r1=1138623&r2=1138624&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPImplementationTest.java Wed Jun 22 20:40:54 2011
@@ -23,10 +23,15 @@ import junit.framework.TestSuite;
 
 import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
 import org.apache.axiom.ts.SOAPTestSuiteBuilder;
+import org.apache.axiom.ts.soap.header.TestExtractAllHeaderBlocks;
 
 public class SOAPImplementationTest extends TestCase {
     public static TestSuite suite() {
         SOAPTestSuiteBuilder builder = new SOAPTestSuiteBuilder(new OMLinkedListMetaFactory());
+        
+        // TODO: unsupported in LLOM
+        builder.exclude(TestExtractAllHeaderBlocks.class);
+        
         return builder.build();
     }
 }

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=1138624&r1=1138623&r2=1138624&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 Wed Jun 22 20:40:54 2011
@@ -73,6 +73,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlock(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestExamineAllHeaderBlocks(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestExamineHeaderBlocks(metaFactory, spec));
+        addTest(new org.apache.axiom.ts.soap.header.TestExtractAllHeaderBlocks(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestGetHeaderBlocksWithNSURI(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestGetMustUnderstand(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestGetRole(metaFactory, spec));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExtractAllHeaderBlocks.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExtractAllHeaderBlocks.java?rev=1138624&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExtractAllHeaderBlocks.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExtractAllHeaderBlocks.java Wed Jun 22 20:40:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.header;
+
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestExtractAllHeaderBlocks extends SOAPTestCase {
+    public TestExtractAllHeaderBlocks(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+        SOAPHeader header = soapFactory.createSOAPHeader(envelope);
+        OMNamespace ns = soapFactory.createOMNamespace("urn:ns", "p");
+        SOAPHeaderBlock h1 = header.addHeaderBlock("header1", ns);
+        SOAPHeaderBlock h2 = header.addHeaderBlock("header2", ns);
+        Iterator it = header.extractAllHeaderBlocks();
+        assertTrue(it.hasNext());
+        assertSame(h1, it.next());
+        assertTrue(it.hasNext());
+        assertSame(h2, it.next());
+        assertFalse(it.hasNext());
+    }
+}

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