ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1144834 - in /webservices/commons/trunk/modules/axiom/modules: axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/ axiom-testsuite/src/main/java/org/apache/axiom/ts/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/
Date Sun, 10 Jul 2011 11:23:39 GMT
Author: veithen
Date: Sun Jul 10 11:23:39 2011
New Revision: 1144834

URL: http://svn.apache.org/viewvc?rev=1144834&view=rev
Log:
AXIOM-311: Refactored OMHeaderTest.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExamineAllHeaderBlocksWithParser.java
  (with props)
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderTest.java
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlock.java

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=1144834&r1=1144833&r2=1144834&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 Jul 10 11:23:39 2011
@@ -74,6 +74,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace1(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace2(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.header.TestExamineAllHeaderBlocks(metaFactory,
spec));
+        addTest(new org.apache.axiom.ts.soap.header.TestExamineAllHeaderBlocksWithParser(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));

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlock.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlock.java?rev=1144834&r1=1144833&r2=1144834&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlock.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlock.java
Sun Jul 10 11:23:39 2011
@@ -37,10 +37,11 @@ public class TestAddHeaderBlock extends 
         SOAPEnvelope soapEnvelope = soapFactory.createSOAPEnvelope();
         SOAPHeader soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
         OMNamespace namespace = soapFactory.createOMNamespace("http://www.example.org", "test");
-        soapHeader.addHeaderBlock("echoOk1", namespace);
-        soapHeader.addHeaderBlock("echoOk2", namespace);
+        SOAPHeaderBlock headerBlock1 = soapHeader.addHeaderBlock("echoOk1", namespace);
+        SOAPHeaderBlock headerBlock2 = soapHeader.addHeaderBlock("echoOk2", namespace);
         Iterator iterator = soapHeader.getChildren();
-        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();
+        assertSame(headerBlock1, iterator.next());
+        assertSame(soapHeader, headerBlock1.getParent());
         assertNotNull(
                 "SOAP Header Test : - After calling addHeaderBlock method twice, getChildren
method returns empty iterator",
                 headerBlock1);
@@ -50,7 +51,8 @@ public class TestAddHeaderBlock extends 
                 "SOAP Header Test : - HeaderBlock1 namespace uri mismatch",
                 "http://www.example.org", headerBlock1.getNamespace().getNamespaceURI());
 
-        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();
+        assertSame(headerBlock2, iterator.next());
+        assertSame(soapHeader, headerBlock2.getParent());
         assertNotNull(
                 "SOAP Header Test : - After calling addHeaderBlock method twice, getChildren
method returns an iterator with only one object",
                 headerBlock2);

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExamineAllHeaderBlocksWithParser.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExamineAllHeaderBlocksWithParser.java?rev=1144834&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExamineAllHeaderBlocksWithParser.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestExamineAllHeaderBlocksWithParser.java
Sun Jul 10 11:23:39 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestExamineAllHeaderBlocksWithParser extends SOAPTestCase {
+    public TestExamineAllHeaderBlocksWithParser(OMMetaFactory metaFactory, SOAPSpec spec)
{
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPHeader header = getTestMessage(MESSAGE).getHeader();
+        Iterator iterator = header.examineAllHeaderBlocks();
+        int headerElementCount = 0;
+        while (iterator.hasNext()) {
+            iterator.next();
+            headerElementCount++;
+        }
+        assertEquals("Number of header elements in the header differs from expected value
of 3",
+                3, headerElementCount);
+    }
+}

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



Mime
View raw message