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/07/03 22:15:43 UTC

svn commit: r1356910 - in /webservices/commons/trunk/modules/axiom/modules: axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-testsuite/src/main/resources/badsoap/soap12/

Author: veithen
Date: Tue Jul  3 20:15:41 2012
New Revision: 1356910

URL: http://svn.apache.org/viewvc?rev=1356910&view=rev
Log:
Refactored StAXSOAPModelBuilderTest#testBadEnvelope using the existing BadInputTest facility.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.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-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java?rev=1356910&r1=1356909&r2=1356910&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java Tue Jul  3 20:15:41 2012
@@ -20,7 +20,6 @@
 package org.apache.axiom.soap.impl.builder;
 
 import org.apache.axiom.om.OMXMLBuilderFactory;
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -33,48 +32,6 @@ import java.io.StringReader;
 
 public class StAXSOAPModelBuilderTest extends XMLTestCase {
     /**
-     * Test a couple of malformed envelopes, make sure parsing fails correctly.
-     *
-     * @throws Exception
-     */
-    public void testBadEnvelope() throws Exception {
-        String badEnvStart =
-                "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n";
-        String badEnvHeader =
-                "       <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
-                        "                    env:role=\"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\"\n" +
-                        "                    env:mustUnderstand=\"true\">\n" +
-                        "                       foo\n" +
-                        "       </test:echoOk>\n";
-        String badEnvEnd =
-                "   <env:Body><content/></env:Body>\n" +
-                        "</env:Envelope>";
-        String [] badHeaders = {
-                "env:HeaDER",   // Bad case
-                "Header"        // No namespace
-        };
-
-        for (int i = 0; i < badHeaders.length; i++) {
-            String soap12Message = badEnvStart + "<" + badHeaders[i] + ">\n" +
-                    badEnvHeader + "</" + badHeaders[i] + ">\n" +
-                    badEnvEnd;
-            SOAPModelBuilder soap12Builder = OMXMLBuilderFactory.createSOAPModelBuilder(new StringReader(soap12Message));
-            try {
-                SOAPEnvelope soap12Envelope = (SOAPEnvelope) soap12Builder.getDocumentElement();
-                try {
-                    soap12Envelope.getHeader();
-                } catch (OMException e) {
-                    // Good, we failed.  Keep going.
-                    continue;
-                }
-            } finally {
-                soap12Builder.close();
-            }
-            fail("Successfully parsed bad envelope ('" + badHeaders[i] + "')");
-        }
-    }
-
-    /**
      * @throws Exception
      */
     public void testOptimizedFault() throws Exception {

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=1356910&r1=1356909&r2=1356910&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 Tue Jul  3 20:15:41 2012
@@ -28,7 +28,7 @@ import org.apache.axiom.testutils.suite.
 public class SOAPTestSuiteBuilder extends TestSuiteBuilder {
     private static final String[] badSOAPFiles = { "wrongSoapNs.xml", "notnamespaceQualified.xml", "soap11/twoheaders.xml", "soap11/twoBodymessage.xml",
             "soap11/envelopeMissing.xml", "soap11/haederBodyWrongOrder.xml", "soap11/invalid-faultcode.xml", "soap11/invalid-faultstring.xml",
-            "soap11/invalid-faultactor.xml" };
+            "soap11/invalid-faultactor.xml", "soap12/header-bad-case.xml", "soap12/header-no-namespace.xml" };
     
     private static final String[] goodSOAPFiles = { TestConstants.WHITESPACE_MESSAGE,
         TestConstants.MINIMAL_MESSAGE, TestConstants.REALLY_BIG_MESSAGE,

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml?rev=1356910&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml Tue Jul  3 20:15:41 2012
@@ -0,0 +1,10 @@
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+   <env:HeaDER>
+       <test:echoOk xmlns:test="http://example.org/ts-tests"
+                    env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+                    env:mustUnderstand=\"true\">
+                       foo
+       </test:echoOk>
+   </env:HeaDER>
+   <env:Body><content/></env:Body>
+</env:Envelope>

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-bad-case.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml?rev=1356910&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml Tue Jul  3 20:15:41 2012
@@ -0,0 +1,10 @@
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+   <Header>
+       <test:echoOk xmlns:test="http://example.org/ts-tests"
+                    env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+                    env:mustUnderstand=\"true\">
+                       foo
+       </test:echoOk>
+   </Header>
+   <env:Body><content/></env:Body>
+</env:Envelope>

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap12/header-no-namespace.xml
------------------------------------------------------------------------------
    svn:eol-style = native